Call is the representation of an audio or video call between
two browsers, SIP clients or phone numbers. The call object is
created whenever a new call is initiated, either by you or the
remote caller. You can access and act upon calls initiated by
a remote caller in a telnyx.notification event handler.
Examples
To create a new call, i.e. dial:
Hierarchy
-
default↳Call
Table of contents
Properties
Accessors
Methods
- answer
- deaf
- dtmf
- getStats
- hold
- muteAudio
- muteVideo
- setAudioInDevice
- setAudioOutDevice
- setVideoDevice
- toggleAudioMute
- toggleDeaf
- toggleHold
- toggleVideoMute
- undeaf
- unhold
- unmuteAudio
- unmuteVideo
Properties
direction
• direction:Direction
The direction of the call.
Can be either inbound or outbound.
Inherited from
BaseCall.directionid
• id:string = ''
The call identifier.
Inherited from
BaseCall.idprevState
• prevState:string = ''
The previous state of the call.
See Call.state for all possible values.
Inherited from
BaseCall.prevStatestate
• state:string
The state of the call.
| Value | Description |
|---|---|
new | New call has been created in the client. |
trying | It’s attempting to call someone. |
requesting | The outbound call is being sent to the server. |
recovering | The previous call is recovering after the page refreshes. If the user refreshes the page during a call, it will automatically join the latest call. |
ringing | Someone is attempting to call you. |
answering | You are attempting to answer this inbound call. |
early | It receives the media before the call has been answered. |
active | Call has become active. |
held | Call has been held. |
hangup | Call has ended. |
destroy | Call has been destroyed. |
purge | Call has been purged. |
Inherited from
BaseCall.stateAccessors
isAudioMuted
•get isAudioMuted(): boolean
Checks whether the microphone is muted.
Returns
boolean
Examples
Inherited from
BaseCall.isAudioMutedlocalStream
•get localStream(): MediaStream
Gets the local stream of the call.
This can be used in a video/audio element to play the local media.
See MediaStream.
Returns
MediaStream
Examples
Inherited from
BaseCall.localStreamremoteStream
•get remoteStream(): MediaStream
Gets the remote stream of the call.
This can be used in a video/audio element to play the remote media.
See MediaStream.
Returns
MediaStream
Examples
Inherited from
BaseCall.remoteStreamsignalingStateClosed
•get signalingStateClosed(): boolean
Indicates if the peer connection’s signaling state has transitioned to ‘closed’
while the connection was previously active. Used to determine if the call
can be recovered on reconnection.
Returns
boolean
Inherited from
BaseCall.signalingStateClosedtelnyxIDs
•get telnyxIDs(): Object
Gets Telnyx call IDs, if using Telnyx Call Control services.
You can use these IDs to identify specific calls in your application code.
Returns
Object
| Name | Type |
|---|---|
telnyxCallControlId | string |
telnyxLegId | string |
telnyxSessionId | string |
Examples
Inherited from
BaseCall.telnyxIDsMethods
answer
▸ answer(params?): Promise<void>
Starts the process to answer the incoming call.
Parameters
| Name | Type |
|---|---|
params | AnswerParams |
Returns
Promise<void>
Examples
Inherited from
BaseCall.answerdeaf
▸ deaf():void
Turns off the remote stream audio.
Returns
void
Examples
Inherited from
BaseCall.deafdtmf
▸ dtmf(dtmf): void
Sends dual-tone multi-frequency (DTMF) signal
Parameters
| Name | Type | Description |
|---|---|---|
dtmf | string | Single DTMF key |
Returns
void
Examples
Inherited from
BaseCall.dtmfgetStats
▸ getStats(callback, constraints): void
Registers callback for stats.
Parameters
| Name | Type |
|---|---|
callback | Function |
constraints | any |
Returns
void
Inherited from
BaseCall.getStatshold
▸ hold():Promise<any>
Holds the call.
Returns
Promise<any>
Promise that resolves or rejects based on server response
Examples
Using async/await:
Promises:
Inherited from
BaseCall.holdmuteAudio
▸ muteAudio():void
Turns off audio output, i.e. makes it so other
call participants cannot hear your audio.
Returns
void
Examples
Inherited from
BaseCall.muteAudiomuteVideo
▸ muteVideo():void
Turns off the video output, i.e. hides
video from other call participants.
Returns
void
Examples
Deprecated
Inherited from
BaseCall.muteVideosetAudioInDevice
▸ setAudioInDevice(deviceId, muted?): Promise<void>
Changes the audio input device (i.e. microphone) used for the call.
Parameters
| Name | Type | Description |
|---|---|---|
deviceId | string | The target audio input device ID |
muted | boolean | Whether the audio track should be muted. Defaults to mutedMicOnStart call option. |
Returns
Promise<void>
Promise that resolves if the audio input device has been updated
Examples
Using async/await:
Promises:
.getAudioInDevices:
Inherited from
BaseCall.setAudioInDevicesetAudioOutDevice
▸ setAudioOutDevice(deviceId): Promise<boolean>
Changes the audio output device (i.e. speaker) used for the call.
Parameters
| Name | Type | Description |
|---|---|---|
deviceId | string | The target audio output device ID |
Returns
Promise<boolean>
Promise that returns a boolean
Examples
Using async/await:
Promises:
.getAudioOutDevices:
setVideoDevice
▸ setVideoDevice(deviceId): Promise<void>
Changes the video device (i.e. webcam) used for the call.
Parameters
| Name | Type | Description |
|---|---|---|
deviceId | string | the target video device ID |
Returns
Promise<void>
Promise that resolves if the video device has been updated
Examples
Using async/await:
Promises:
.getVideoDevices:
Deprecated
Inherited from
BaseCall.setVideoDevicetoggleAudioMute
▸ toggleAudioMute():void
Toggles the audio output on/off.
Returns
void
Examples
Inherited from
BaseCall.toggleAudioMutetoggleDeaf
▸ toggleDeaf():void
Toggles the remote stream audio.
Returns
void
Examples
Inherited from
BaseCall.toggleDeaftoggleHold
▸ toggleHold():Promise<any>
Toggles hold state of the call.
Returns
Promise<any>
Promise that resolves or rejects based on server response
Examples
Using async/await:
Inherited from
BaseCall.toggleHoldtoggleVideoMute
▸ toggleVideoMute():void
Toggles the video output on/off.
Returns
void
Examples
Deprecated
Inherited from
BaseCall.toggleVideoMuteundeaf
▸ undeaf():void
Turns on the remote stream audio.
Returns
void
Examples
Inherited from
BaseCall.undeafunhold
▸ unhold():Promise<any>
Removes hold from the call.
Returns
Promise<any>
Promise that resolves or rejects based on server response
Examples
Using async/await:
Promises:
Inherited from
BaseCall.unholdunmuteAudio
▸ unmuteAudio():void
Turns on audio output, i.e. makes it so other
call participants can hear your audio.
Returns
void
Examples
Inherited from
BaseCall.unmuteAudiounmuteVideo
▸ unmuteVideo():void
Turns on the video output, i.e. makes
video visible to other call participants.
Returns
void
Examples
Deprecated