Skip to main content

Call

A Call represents a one-to-one call with another browser, a SIP endpoint, or even a phone number. The Call object supports both audio and video.

Properties​

NameTypeDescription
idstringThe identifier of the call.
directionstringThe direction of the call. Can be either inbound or outbound.
statestringThe state of the call. See State for all the possible call states.
prevStatestringThe previous state of the call. See State for all the possible call states.
localStreamMediaStreamThe local stream of the call. This can be used in a video/audio element to play the local media.
remoteStreamMediaStreamThe remote stream of the call. This can be used in a video/audio element to play the remote media.

State​

The state and prevState properties of a Call have the following values:

ValueDescription
new New Call has been created in the client.
trying You are attempting to call someone.
requesting Your outbound call is being sent to the server.
recovering Your previous call is recovering after the page refresh. If you refresh the page during a call, you will automatically be joined with the latest call.
ringing Someone is attempting to call you.
answering You are attempting to answer the inbound Call.
early You received 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.

Methods​

answer​

Start the process to answer the incoming Call.

Parameters

None

Returns

None

Example

call.answer()

deaf​

Turn off the audio input track.

Example

call.deaf()

dtmf​

Send a Dual Tone Multi Frequency (DTMF) string to Relay.

Parameters

NameTypeRequiredDescription
stringstringrequiredDTMF to send.

Returns

None

Examples

call.dtmf('0')

hangup​

Hangs up the call.

Parameters

None

Returns

None

Examples

call.hangup()

hold​

Holds the call.

Parameters

None

Returns

None

Examples

call.hold()

muteAudio​

Turn off the audio output track.

Example

call.muteAudio()

muteVideo​

Turn off the video output track.

Example

call.muteVideo()

setAudioInDevice​

Change the audio input device used for the Call.

Example

// within an async function ..
const success = await call.setAudioInDevice('d346d0f78627e3b808cdf0c2bc0b25b4539848ecf852ff03df5ac7545f4f5398')
if (success) {
// The Call audio input has been set to the device 'd346d0f78627e3b808cdf0c2bc0b25b4539848ecf852ff03df5ac7545f4f5398'
} else {
// The browser does not support the .setSinkId() API..
}

setAudioOutDevice​

Change the audio output device used for the Call.

Example

// within an async function ..
const success = await call.setAudioOutDevice('d346d0f78627e3b808cdf0c2bc0b25b4539848ecf852ff03df5ac7545f4f5398')
if (success) {
// The Call audio has been redirect to the device 'd346d0f78627e3b808cdf0c2bc0b25b4539848ecf852ff03df5ac7545f4f5398'
} else {
// The browser does not support the .setSinkId() API..
}

setVideoDevice​

Change the video output device used for the Call.

Example

// within an async function ..
const success = await call.setVideoDevice('d346d0f78627e3b808cdf0c2bc0b25b4539848ecf852ff03df5ac7545f4f5398')
if (success) {
// The Call video has been redirect to the device 'd346d0f78627e3b808cdf0c2bc0b25b4539848ecf852ff03df5ac7545f4f5398'
} else {
// The browser does not support the .setSinkId() API..
}

toggleAudioMute​

Toggle the audio output track.

Example

call.toggleAudioMute()

toggleHold​

Toggles the hold state of the call.

Parameters

None

Returns

None

Examples

call.toggleHold()

toggleVideoMute​

Toggle the video output track.

Example

call.toggleVideoMute()

undeaf​

Turn on the audio input track.

Example

call.undeaf()

unhold​

Un-holds the call.

Parameters

None

Returns

None

Examples

call.unhold()

unmuteAudio​

Turn on the audio output track.

Example

call.unmuteAudio()

unmuteVideo​

Turn on the video output track.

Example

call.unmuteVideo()