Call Status and Call Features (Session)

The Session object is a call instance for managing call status and performing related operations during a call. This topic describes the attributes, methods, and events related to call status and call feature (Session object).

Attributes

Attributes Type Description
RTCSession RTCSession Call instance.
callReport Report Call quality report.
status CallStatus Call status, including name, number, profile image, status of call mute, etc.
incomingList Session[] Incoming call array.
timer TimerType Call timer.
localStream MediaStream Local stream with video track only, no audio.
remoteStream MediaStream Remote stream with both audio and video tracks.

Method

Method Overview
Stop the call timer
Method
stopTimer()
Parameters Null.
Return value
this
Listen for events
Method
on(eventName:string,listener: (...args: any[]) => void)
Parameters
  • eventName: The event name.
  • listener: Callback function.
Return value Null.
Note: For more information about the events that you can listen for, see Events.
Reject a call
This method is equivalent to the 'Reject a call' method of PhoneOperator object.
Method
reject()
Parameters Null.
Return value type boolean
Answer a call
This method is equivalent to the 'Answer a call' method of PhoneOperator object.
Method
answer(option?: CallOptions)
Parameters option: Optional. Specify userMedia constraints.
Return value
Promise<Result>
Hang up a call
This method is equivalent to the 'Hang up a call' method of PhoneOperator object.
Method
hangup() 
Parameters Null.
Return value type boolean
Perform a blind transfer
This method is equivalent to the 'Perform a blind transfer' method of PhoneOperator object.
Method
blindTransfer(number: string) 
Parameters number: The number of the transfer target.
Return value type boolean
Perform an attended transfer
This method is equivalent to the 'Perform an attended transfer' method of PhoneOperator object.
Method
attendedTransfer(number: string) 
Parameters number: The number of the transfer target.
Return value type boolean
Hold a call
This method is equivalent to the 'Hold a call' method of PhoneOperator object.
Method
hold()
Parameters Null.
Return value type boolean
Resume a call
This method is equivalent to the 'Resume a call' method of PhoneOperator object.
Method
unhold()
Parameters Null.
Return value type boolean
Send DTMF
This method is equivalent to the 'Send DTMF' method of PhoneOperator object.
Method
dtmf(dtmf: string)
Parameters dtmf: String (0123456789*#)
Return value type boolean
Mute a call
This method is equivalent to the 'Mute a call' method of PhoneOperator object.
Method
mute()
Parameters Null.
Return value type boolean
Unmute a call
This method is equivalent to the 'Unmute a call' method of PhoneOperator object.
Method
unmute()
Parameters Null.
Return value type boolean
Start recording
This method is equivalent to the 'Start recording' method of PhoneOperator object.
Method
startRecord()
Parameters Null.
Return value type boolean
Pause recording
This method is equivalent to the 'Pause recording' method of PhoneOperator object.
Method
pauseRecord()
Parameters Null.
Return value type boolean
Terminate a call
This method is equivalent to the 'Terminate a call' method of PhoneOperator object.
Method
terminate(type: 'hangup' | 'reject' | 'terminate' = 'terminate')
Parameters type: Type of call termination.
Return value type boolean
Update the call status
Method
setStatus(status: Partial<CallStatus>)
Parameters status: The call status object.
Return value
this
Update the static properties of Session
Method
setStaticStatus(staticStatus: Partial<StaticCallStatus>, startManualModel?: boolean)
Parameters
  • staticStatus: The static properties of Session include name, avatar, and company.
  • startManualModel: Optional. Whether to enable manual mode. If enabled, the static properties will NOT be automatically updated.
Return value
thi
Destroy Session instance
This method will cancel all the event subscriptions, and stop the RTCSession.
Method
destroy()
Parameters Null.
Return value Null.

Events

Event Name Description Report Parameter
callReport The call quality report is updated, with a frequency of once every 3 seconds.
  • callId: string: The unique ID of the call.
  • callReport: Report: Call quality report.
streamAdded A media stream is added to the call.
  • callId: string: The unique ID of the call.
  • communicationType: "outbound" | "inbound": Call type.
  • stream: MediaStream: Media stream.
ended The call is ended.
  • callId: string: The unique ID of the call.
  • cause: string: Reason for ending the call.
failed Failed to make a call.
  • callId: string: The unique ID of the call.
  • cause: string: Reasons for the call failure.
  • code: number: Error code.
clientError Errors occurred on the client, resulting in the failure to make a call.
  • callId: string: The unique ID of the call.
  • cause: string: Reason for the error.
reinvite The other party performed attended transfer during a call.
  • callId: string: The unique ID of the call.
  • session: Session: The current call instance.
accepted Received the success status response code 200 OK.
  • callId: string: The unique ID of the call.
  • session: Session: The current call instance.
confirmed The session is confirmed (received the response of ACK packet).
  • callId: string: The unique ID of the call.
  • session: Session: The current call instance.
statusChange Call status is changed.
  • newStatus: New call status.
  • oldStatus: Previous call status.
staticStatusChange The static properties of the call is changed.
  • newStatus: New static properties.
  • oldStatus: Previous static properties.