Call
The Call class represents a single call or conference, incoming or outgoing. For an incoming call/conference, get the call instance from the IncomingCall event. To create an outgoing call, use the Client.call API. To create an outgoing conference, use the Client.callConference API.
Methods
active
active(): boolean
Returns 'true' if a call is active, otherwise returns 'false'. A single call (either incoming or outgoing) is active by default, all other calls are inactive and should be activated via the setActive method. Only the active call sends and receives an audio/video stream.
Returns
type:
boolean
answer
answer(customData: string
, extraHeaders: {[id: string]: string}
, useVideo: , H264first: boolean
): void
Answers the incoming call. There are two methods for an Events.IncomingCall: Call.answer and Call.decline. Voice can be sended only after the Call.answer method call.
Parameters
customData:
string
OptionalSet custom string associated with call session. It can be later obtained from Call History via the HTTP API, see the custom_data field in result. Custom data can be retrieved on the part of Voxengine via the customData method. Maximum size is 200 bytes.
extraHeaders:
{[id: string]: string}
OptionalOptional custom parameters (SIP headers) that are sent to another participant after accepting an incoming call. Header names have to begin with the 'X-' prefix. The "X-" headers could be handled only by SIP phones/devices.
useVideo:
OptionalA set of flags defining if sending and receiving video is allowed.
H264first:
boolean
OptionalUse H264 video codec, if exist
Returns
type:
void
decline
decline(extraHeaders: {[id: string]: string}
): void
Rejects the incoming call on all devices, where the current user logged in.
Parameters
extraHeaders:
{[id: string]: string}
OptionalOptional custom parameters (SIP headers) that should be sent after rejecting incoming call. Parameter names should start with "X-" to be processed by application
Returns
type:
void
displayName
displayName(): string
Returns
type:
string
getCallDuration
getCallDuration(): number
Returns
type:
number
hangup
hangup(extraHeaders: {[p: string]: string}
): void
Parameters
extraHeaders:
{[p: string]: string}
Optional
Returns
type:
void
headers
headers(): {[id: string]: string}
Returns headers
Returns
type:
{[id: string]: string}
id
id(): string
Returns
type:
string
isMicrophoneMuted
isMicrophoneMuted(): boolean
Returns the current state of the microphone in this call.
Returns
type:
boolean
muteMicrophone
muteMicrophone(): void
Returns
type:
void
mutePlayback
mutePlayback(): void
Mutes the sound from all participants
Returns
type:
void
number
number(): string
Returns
type:
string
off
off(event: , handler: Function
): void
Remove a handler for the specified event. The method is a shorter equivalent for removeEventListener. If a number of events has the same function as a handler, the method can be called multiple times with the same handler argument.
Parameters
event:
Event name (i.e. CallEvents.Connected). See CallEvents.
handler:
Function
OptionalHandler function, if not specified all event handlers for the specified event are removed
Returns
type:
void
on
on(event: , handler: Function
, options: EventListenerOption
): void
Register a handler for the specified event. The method is a shorter equivalent for addEventListener. One event can have more than one handler; handlers are executed in order of registration. Use the Call.off method to delete a handler.
Parameters
event:
Event name (i.e. CallEvents.Connected. See CallEvents.
handler:
Function
Handler function. A single parameter is passed - object with event information
options:
EventListenerOption
Optional
Returns
type:
void
reject
reject(extraHeaders: {[id: string]: string}
): void
Rejects the incoming call on the side of Web SDK.If a call is initiated from a PSTN, the network receives the "reject" command; in case of a call from another SDK client, it receives the CallEvents.Failed event.
Parameters
extraHeaders:
{[id: string]: string}
OptionalOptional custom parameters (SIP headers) that should be sent after rejecting incoming call. Parameter names should start with "X-" to be processed by application
Returns
type:
void
sendInfo
sendInfo(mimeType: string
, body: string
, extraHeaders: {[id: string]: string}
): void
Send Info (SIP INFO) message inside the callYou can get this message via the Voxengine CallEvents.InfoReceived event in our cloud.
You can get this message in Web SDK on other side via the CallEvents.InfoReceived event; see the similar events for the iOS and Android SDKs.
Parameters
mimeType:
string
MIME type of the message, e.g. "text/plain", "multipart/mixed" etc.
body:
string
Message content
extraHeaders:
{[id: string]: string}
OptionalOptional headers to be passed with the message
Returns
type:
void
sendMessage
sendMessage(msg: string
): void
Parameters
msg:
string
Returns
type:
void
sendTone
sendTone(key: string
): void
Sends a tone (DTMF). It triggers the CallEvents.ToneReceived event in our cloud.
Parameters
key:
string
Send tone according to pressed key: 0-9 , * , #
Returns
type:
void
sendVideo
sendVideo(flag: boolean
): Promise<CallEvents.Updated>
Parameters
flag:
boolean
Returns
type:
Promise<CallEvents.Updated>
setActive
setActive(flag: boolean
): Promise<CallEvents.Updated>
Makes a call active, i.e. change the active flag to 'true'. A single call (either incoming or outgoing) is active by default, all other calls are inactive and should be activated.
Parameters
flag:
boolean
Returns
type:
Promise<CallEvents.Updated>
stopSharingScreen
stopSharingScreen(): Promise<SharingStopped>
Stops screen sharing started via the shareScreen()
method. Since the 4.6.0 version, the BeforeMediaRendererRemoved
and MediaRendererRemoved
events are deprecated for the local video. Use MediaRendererUpdated
instead.
Returns
type:
Promise<SharingStopped>
unmuteMicrophone
unmuteMicrophone(): void
Returns
type:
void
unmutePlayback
unmutePlayback(): void
Unmutes the sound from all participants
Returns
type:
void
Props
audioMediaTrackTransform
audioMediaTrackTransform: (MediaStreamTrack: any) => MediaStreamTrack
audioSenderTransform
audioSenderTransform: TransformStream
rearangeCodecs
rearangeCodecs: (codecList: CodecSorterUserCodecList, incoming: boolean) => Promise<CodecSorterUserCodecList>
Callback for a manual rearrangement or setup compatible codec list. If an unknown/unsupported codec is set, the parameter is ignored
videoMediaTrackTransform
videoMediaTrackTransform: (MediaStreamTrack: any) => MediaStreamTrack
videoSenderTransform
videoSenderTransform: TransformStream