Client
The Client class is used to control platform functions. Can't be instantiated directly (singleton), so use the getInstance method to get the class instance.
Methods
call
call(num: string
| , useVideo: boolean
| , customData: string
, extraHeaders: {[id: string]: string}
):
Create call
Parameters
num:
string
The number to call or CallSettings. For SIP compatibility reasons it should be a non-empty string even if the number itself is not used by a Voximplant cloud scenario.
useVideo:
boolean
OptionalDeprecated: Please, use CallSettings instead.
customData:
string
OptionalDeprecated: Please, use CallSettings instead.
extraHeaders:
{[id: string]: string}
OptionalDeprecated: Please, use CallSettings instead.
Returns
type:
callConference
callConference(num: string
| , useVideo: boolean
| , customData: string
, extraHeaders: {[id: string]: string}
):
Create call to a dedicated conference without proxy session. For details see the video conferencing guide
Parameters
num:
string
The number to call or CallSettings. For SIP compatibility reasons it should be a non-empty string even if the number itself is not used by a Voximplant cloud scenario.
useVideo:
boolean
OptionalDeprecated: Please, use CallSettings instead.
customData:
string
OptionalDeprecated: Please, use CallSettings instead.
extraHeaders:
{[id: string]: string}
OptionalDeprecated: Please, use CallSettings instead.
Returns
type:
clearSilentLog
clearSilentLog(): void
Clear the logger journal and free some memory.
Returns
type:
void
connect
connect(): Promise<boolean>
Connect to VoxImplant Cloud
Returns
type:
Promise<boolean>
connected
connected(): boolean
Check if connected to VoxImplant Cloud
Returns
type:
boolean
disconnect
disconnect(): Promise<void>
Disconnect from VoxImplant Cloud
Returns
type:
Promise<void>
enableSilentLogging
enableSilentLogging(flag: boolean
): void
Set the state of the silent logging inside SDK (it is disabled by default). When it is enabled, the WebSDK will save all logger messages into the logger until you disable it.Note that enabling of the silent logging automatically clears all existed logger records before the start.
You can get current logger by the getSilentLog function and clean it by the clearSilentLog function.
Parameters
flag:
boolean
Returns
type:
void
getOperatorACDStatus
getOperatorACDStatus(): Promise<OperatorACDStatuses>
Return current ACD status of the operator.
Returns
type:
Promise<OperatorACDStatuses>
getOperatorSQMessagingStatus
getOperatorSQMessagingStatus(): Promise<OperatorACDStatuses>
Return current SmartQueue Messaging status of the operator.
Returns
type:
Promise<OperatorACDStatuses>
getSilentLog
getSilentLog(): string[]
Get records from the logger journal.
Returns
type:
string[]
handlePushNotification
handlePushNotification(message: any
): Promise<void>
Handle incoming push notification
Parameters
message:
any
Incoming push notification that comes from the firebase.messaging().setBackgroundMessageHandler callback inside a service worker
Returns
type:
Promise<void>
init
init(config: ): Promise<Events.SDKReady,string>
Initialize SDK. The Events.SDKReady event will be dispatched after successful SDK initialization. SDK can't be used until it's initialized
Parameters
config:
Returns
type:
Promise<Events.SDKReady,string>
isInsertableStreamsSupported
isInsertableStreamsSupported(): boolean
Returns
type:
boolean
isMediaTrackInsertableStreamSupported
isMediaTrackInsertableStreamSupported(): boolean
Returns
type:
boolean
isRTCsupported
isRTCsupported(): boolean
Check if WebRTC support is available
Returns
type:
boolean
joinAsSharing
joinAsSharing(num: string
| number
, sendAudio: boolean
, extraHeaders: {[id: string]: string}
):
Allows you to join a conference as a separate screen sharing member
Parameters
num:
string
sendAudio:
boolean
Defaults on: false(works only for Chrome, Edge)
extraHeaders:
{[id: string]: string}
Optional
Returns
type:
joinAsViewer
joinAsViewer(num: string
| number
, extraHeaders: {[id: string]: string}
):
Allows you to join a conference only for receiving audio/video
Parameters
num:
string
extraHeaders:
{[id: string]: string}
Optional
Returns
type:
limitAudioCodecs
limitAudioCodecs(codecs: ): Promise<boolean>
Specify the audio codecs that can be used for calls.
Parameters
codecs:
Returns
type:
Promise<boolean>
limitVideoCodecs
limitVideoCodecs(codecs: ): Promise<boolean>
Specify the video codecs that can be used for calls.
Parameters
codecs:
Returns
type:
Promise<boolean>
login
login(username: string
, password: string
, options: ): Promise<Events.AuthResult>
Log in to an application. The method triggers the Events.AuthResult event.
Parameters
username:
string
Fully-qualified username that includes Voximplant user, application and account names. The format is: "username@appname.accname.voximplant.com".
password:
string
options:
Optional
Returns
type:
Promise<Events.AuthResult>
loginWithOneTimeKey
loginWithOneTimeKey(username: string
, hash: string
, options: ): Promise<Events.AuthResult>
Log in to an application using the 'onetimekey' auth method. Hash should be calculated with the key from the triggered Events.AuthResult event.Please, read the how-to page.
Parameters
username:
string
hash:
string
options:
Optional
Returns
type:
Promise<Events.AuthResult>
loginWithToken
loginWithToken(username: string
, token: string
, options: ): Promise<Events.AuthResult>
Log in to an application using an accessToken. The method triggers the Events.AuthResult event.
Parameters
username:
string
Fully-qualified username that includes Voximplant user, application and account names. The format is: "username@appname.accname.voximplant.com".
token:
string
options:
Optional
Returns
type:
Promise<Events.AuthResult>
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 class (i.e. Events.SDKReady). See Events
handler:
Function
Optional
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 Client.off method to delete a handler.
Parameters
event:
Event class (i.e. Events.SDKReady). See Events
handler:
Function
Handler function. A single parameter is passed - object with event information
options:
EventListenerOption
Optional
Returns
type:
void
playToneScript
playToneScript(script: string
, loop: boolean
): void
Play ToneScript using WebAudio API
Parameters
script:
string
Tonescript string
loop:
boolean
Defaults on: false
Returns
type:
void
registerForPushNotifications
registerForPushNotifications(token: string
): Promise<void>
Register for push notifications. Application will receive push notifications from VoxImplant Server after first logger in.
Parameters
token:
string
FCM registration token that can be retrieved by calling firebase.messaging().getToken() inside a service worker
Returns
type:
Promise<void>
requestOneTimeLoginKey
requestOneTimeLoginKey(username: string
): Promise<Events.AuthResult>
Request a key for the 'onetimekey' auth method. Server will send the key in the Events.AuthResult event with the code 302.Please read the article about the authorization with one-time key.
Parameters
username:
string
Returns
type:
Promise<Events.AuthResult>
screenSharingSupported
screenSharingSupported(): Promise<boolean>
Returns promise that is resolved with a boolean flag. The boolean flag is set to 'true' if screen sharing is supported. Promise is rejected in case of an internal error.
Returns
type:
Promise<boolean>
setConnectionData
setConnectionData(gateway: any
, connectionId: any
): void
Parameters
gateway:
any
connectionId:
any
Returns
type:
void
setLoggerCallback
setLoggerCallback(callback: Function
): void
Set outer logging callback.The method allows integrating logging pipeline of the WebSDK into your own logger i.e. the method call sends all events to your function. IMPORTANT: the callback strictly ignores Loglevel settings of the WebSDK.
Parameters
callback:
Function
Returns
type:
void
setOperatorACDStatus
setOperatorACDStatus(status: ): Promise<OperatorACDStatuses>
Set ACD status
Parameters
status:
Returns
type:
Promise<OperatorACDStatuses>
setOperatorSQMessagingStatus
setOperatorSQMessagingStatus(status: ): Promise<OperatorACDStatuses>
Set SmartQueue Messaging status
Parameters
status:
Returns
type:
Promise<OperatorACDStatuses>
setVideoBandwidth
setVideoBandwidth(bandwidth: number
): void
Set bandwidth limit for video calls. Currently supported by Chrome/Chromium. (WebRTC mode only). The limit will be applied for the next call.
Parameters
bandwidth:
number
Bandwidth limit in kilobits per second (kbps)
Returns
type:
void
showLocalVideo
showLocalVideo(flag: boolean
, mirror: boolean
, detachCamera: boolean
): Promise<MediaRenderer,void>
Show/hide local video. IMPORTANT: Safari browser for iOS requires a user interface for playing video during a call. It should be interactive element like an HTML "button" with "onclick" handler that calls "play" method on the "video" HTML element.
Parameters
flag:
boolean
Defaults on: truemirror:
boolean
OptionalDeprecated
detachCamera:
boolean
OptionalDeprecated
Returns
type:
Promise<MediaRenderer,void>
stopPlayback
stopPlayback(): void
Stop playing ToneScript using WebAudio API
Returns
type:
void
tokenRefresh
tokenRefresh(username: string
, refreshToken: string
, deviceToken: string
): Promise<Events.RefreshTokenResult>
Refresh expired access token
Parameters
username:
string
Fully-qualified username that includes Voximplant user, application and account names. The format is: "username@appname.accname.voximplant.com".
refreshToken:
string
deviceToken:
string
OptionalA unique token for the current device
Returns
type:
Promise<Events.RefreshTokenResult>
transferCall
transferCall(call1: , call2: ): void
Transfer call, depending on the result CallEvents.TransferComplete or CallEvents.TransferFailed event will be dispatched.
Returns
type:
void
Props
alreadyInitialized
alreadyInitialized: boolean