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. |
| agreeChangeVideo | (params: AgreeChangeVideoParamsType) => Promise<boolean> | Whether to accept a switch to video call. If not specified, the system will reject by default. |
| 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 thisNote: 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.
- Answer a call
- This method is equivalent to the 'Answer a call' method of PhoneOperator object.
- Hang up a call
- This method is equivalent to the 'Hang up a call' method of PhoneOperator object.
- Perform a blind transfer
- This method is equivalent to the 'Perform a blind transfer' method of PhoneOperator object.
- Perform an attended transfer
- This method is equivalent to the 'Perform an attended transfer' method of PhoneOperator object.
- Hold a call
- This method is equivalent to the 'Hold a call' method of PhoneOperator object.
- Resume a call
- This method is equivalent to the 'Resume a call' method of PhoneOperator object.
- Send DTMF
- This method is equivalent to the 'Send DTMF' method of PhoneOperator object.
- Mute a call
- This method is equivalent to the 'Mute a call' method of PhoneOperator object.
- Unmute a call
- This method is equivalent to the 'Unmute a call' method of PhoneOperator object.
- Start recording
- This method is equivalent to the 'Start recording' method of PhoneOperator object.
- Pause recording
- This method is equivalent to the 'Pause recording' method of PhoneOperator object.
- Terminate a call
- This method is equivalent to the 'Terminate a call' method of PhoneOperator object.
- Renegotiate a call
-
Method renegotiate(offerToReceiveVideo?: boolean)Parameters offerToReceiveVideo: Whether to receive video.Return value type boolean - Switch audio to video
-
Method audioToVideo(allowNoneCamera: boolean = true)Parameters allowNoneCamera: Whether to allow calls without a camera.Return value Promise<Result>
- Switch video to audio
-
Method videoToAudio()Parameters Null Return value 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 includename,avatar, andcompany.startManualModel: Optional. Whether to enable manual mode. If enabled, the static properties will NOT be automatically updated.
Return value this
- Destroy Session instance
- This method will cancel all the event subscriptions, and stop the RTCSession.
Events
| Event Name | Description | Report Parameter |
|---|---|---|
| callReport | The call quality report is updated, with a frequency of once every 3 seconds. |
|
| streamAdded | A media stream is added to the call. |
|
| ended | The call is ended. |
|
| failed | Failed to make a call. |
|
| clientError | Errors occurred on the client, resulting in the failure to make a call. |
|
| reinvite | The other party performed attended transfer during a call. |
|
| accepted | Received the success status response code 200 OK. |
|
| confirmed | The session is confirmed (received the response of ACK packet). |
|
| statusChange | Call status is changed. |
|
| staticStatusChange | The static properties of the call is changed. |
|