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.prevStaterecoveredCallId
• recoveredCallId:string = ''
The call ID of the previous call that this call is recovering from.
Present only when the call was created as part of a reattachment/recovery
flow (e.g. after a network reconnection).
Use this to match the new call object to the ended/destroyed call
and prevent duplicate UI elements such as dialers.
Example
Inherited from
BaseCall.recoveredCallIdstate
• state:string
The state of the call.
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
Examples
Inherited from
BaseCall.telnyxIDsMethods
answer
▸ answer(params?): Promise<void>
Starts the process to answer the incoming call.
Parameters
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
Returns
void
Examples
Inherited from
BaseCall.dtmfgetStats
▸ getStats(callback, constraints): void
Registers callback for stats.
Parameters
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
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
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
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