Rate this page:

Call

Interface that represents a call and provides the API to manage it.

Methods

addEventListener

Copy URL
addEventListener(eventName: 

CallEvent

,
listener:

(event: AnyCallEvent) => void | Promise<void>

,
options:

ListenerOptions

):

void

Registers a handler for the specified event.

One event can have more than one handler; handlers are executed in order of their registration.

Parameters

  • eventName:

    CallEvent

    Event name

  • listener:

    (event: AnyCallEvent) => void | Promise<void>

    Handler function that is triggered when an event of the specified type occurs

  • Object that specifies characteristics about the event listener

Returns

  • type:

    void

addStream

Copy URL
addStream(stream: 

LocalStream

):

Promise<void>

Starts sending an audio or video stream to the call.

Returns a promise that is resolved when the operation is completed.

Throws:

Parameters

Returns

  • type:

    Promise<void>

answer

Copy URL
answer(settings: 

CallSettings

):

Promise<void>

Answers an incoming call.

Returns a promise that is resolved if the call connection process has started successfully. A resolved promise does not mean that the call is connected. You should subscribe to CallEvent.Connected to be notified that the call is established.

Throws:

Parameters

  • settings:

    CallSettings

    Optional

    Call settings with additional call parameters, such as the preferred video codec, custom data, extra headers, etc.

Returns

  • type:

    Promise<void>

hangup

Copy URL
hangup(headers: 

Record<string, string>

):

void

Terminates the call.

Parameters

  • headers:

    Record<string, string>

    Optional

    Optional set of headers to be sent. Names should begin with “X-” to be processed by the SDK.

Returns

  • type:

    void

hold

Copy URL
hold(enable: 

boolean

):

Promise<void>

Holds or unholds the call.

Returns a promise that is resolved when the operation is completed.

Throws:

Parameters

  • enable:

    boolean

    Whether to hold or unhold the call

Returns

  • type:

    Promise<void>

muteMicrophone

Copy URL
muteMicrophone(): 

void

Mutes the audio in the call.

Returns

  • type:

    void

reject

Copy URL
reject(rejectMode: 

RejectMode

,
headers:

Record<string, string>

):

void

Rejects an incoming call.

Parameters

  • rejectMode:

    RejectMode

    Call rejection mode

  • headers:

    Record<string, string>

    Optional

    Optional set of headers to be sent. Names should begin with “X-” to be processed by the SDK.

Returns

  • type:

    void

Throws

CallWrongDirectionError if the method is called for the outgoing call

removeEventListener

Copy URL
removeEventListener(eventName: 

CallEvent

,
listener:

(event: AnyCallEvent) => void | Promise<void>

):

void

Removes a previously registered handler for the specified event.

Parameters

  • eventName:

    CallEvent

    Event name

  • listener:

    (event: AnyCallEvent) => void | Promise<void>

    Handler function to remove from the event target

Returns

  • type:

    void

removeStream

Copy URL
removeStream(stream: 

LocalStream

):

Promise<void>

Stops sending audio or video stream to the call.

Returns a promise that is resolved when the operation is completed.

Throws:

Parameters

Returns

  • type:

    Promise<void>

replaceStream

Copy URL
replaceStream(stream: 

LocalStream

,
oldStream:

LocalStream

):

Promise<void>

Replaces the local audio or video stream that is currently being sent to the call with another local audio or video stream.

Returns a promise that is resolved when the operation is completed.

Throws:

Parameters

Returns

  • type:

    Promise<void>

sendDTMF

Copy URL
sendDTMF(tones: 

string

):

void

Sends DTMF(s) within the call.

Parameters

  • tones:

    string

    DTMF(s)

Returns

  • type:

    void

Throws

InvalidArgumentsError if the tones parameter is an empty string

sendInfo

Copy URL
sendInfo(mimeType: 

${string}/${string}

,
body:

string

,
headers:

Record<string, string>

):

void

Sends an INFO message within the call.

Parameters

  • mimeType:

    ${string}/${string}

    MIME type of the info

  • body:

    string

    Custom string data

  • headers:

    Record<string, string>

    Optional

    Optional set of headers to be sent with the message. Names should begin with “X-” to be processed by the SDK.

Returns

  • type:

    void

Throws

InvalidMimeTypeError if the provided mimeType is in an invalid format

sendMessage

Copy URL
sendMessage(message: 

string

):

void

Sends a message within the call.

Implemented atop of SIP INFO for communication between the call endpoint and the Voximplant Cloud, and is separated from Voximplant messaging API.

Parameters

  • message:

    string

    Message text

Returns

  • type:

    void

start

Copy URL
start(): 

Promise<void>

Starts an outgoing call.

Returns a promise that is resolved if the call connection process has started successfully. A resolved promise does not mean that the call is connected. You should subscribe to CallEvent.Connected to be notified that the call is established.

Throws:

Returns

  • type:

    Promise<void>

startScreenSharing

Copy URL
startScreenSharing(stream: 

LocalScreenSharingStream[]

):

Promise<void>

Starts sending a screen sharing stream to the call.

Returns a promise that is resolved when the operation is completed.

Throws:

Parameters

Returns

  • type:

    Promise<void>

stopScreenSharing

Copy URL
stopScreenSharing(): 

Promise<void>

Stops sending a screen sharing stream to the call.

Returns a promise that is resolved when the operation is completed.

Throws:

Returns

  • type:

    Promise<void>

toggleMicrophone

Copy URL
toggleMicrophone(): 

boolean

Toggles the audio mute status in the call.

Returns

  • type:

    boolean

unmuteMicrophone

Copy URL
unmuteMicrophone(): 

void

Unmutes the audio in the call.

Returns

  • type:

    void

Props

destination

Copy URL
destination: 

string

Destination that the call has been created with.

direction

Copy URL
direction: 

CallDirection

Call direction.

duration

Copy URL
duration: 

number

Call duration in seconds.

hasScreenSharing

Copy URL
hasScreenSharing: 

ReadonlyWatchable<boolean>

Watchable property that allows getting the screen sharing sending status and observing its changes.

id

Copy URL
id: 

string

Call id.

isMicrophoneMuted

Copy URL
isMicrophoneMuted: 

ReadonlyWatchable<boolean>

Watchable property that allows getting the audio mute status and observing its changes.

isOnHold

Copy URL
isOnHold: 

ReadonlyWatchable<boolean>

Watchable property that allows getting whether the call is on hold.

isVideoEnabled

Copy URL
isVideoEnabled: 

ReadonlyWatchable<boolean>

Watchable property that indicates whether the video is enabled and allows observing its changes.

localStreams

Copy URL
localStreams: 

ReadonlyWatchable<Set<LocalStream>>

Watchable property that allows getting the array of the local audio and video streams that are currently being sent.

remoteDisplayName

Copy URL
remoteDisplayName: 

ReadonlyWatchable<null | string>

Watchable property that allows getting the call participant user display name and observing its changes.

Null for outgoing calls until the CallEvent.Connected event is triggered.

remoteSipUri

Copy URL
remoteSipUri: 

ReadonlyWatchable<null | string>

Watchable property that allows getting the call participant sip URI and observing its changes.

Null for outgoing calls until the CallEvent.Connected event is triggered.

remoteStreams

Copy URL
remoteStreams: 

ReadonlyWatchable<Set<RemoteStream>>

Watchable property that allows getting the array of the remote audio and video streams that are currently being received.

state

Copy URL
state: 

ReadonlyWatchable<CallState>

Watchable property that allows getting the current call state and observing its changes.