Rate this page:

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

Copy URL
call(num: 

string

|

CallSettings

,
useVideo:

boolean

|

VideoFlags

,
customData:

string

,
extraHeaders:

{[id: string]: string}

):

Call

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

    Optional

    Deprecated: Please, use CallSettings instead.

  • customData:

    string

    Optional

    Deprecated: Please, use CallSettings instead.

  • extraHeaders:

    {[id: string]: string}

    Optional

    Deprecated: Please, use CallSettings instead.

Returns

callConference

Copy URL
callConference(num: 

string

|

CallSettings

,
useVideo:

boolean

|

VideoFlags

,
customData:

string

,
extraHeaders:

{[id: string]: string}

):

Call

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

    Optional

    Deprecated: Please, use CallSettings instead.

  • customData:

    string

    Optional

    Deprecated: Please, use CallSettings instead.

  • extraHeaders:

    {[id: string]: string}

    Optional

    Deprecated: Please, use CallSettings instead.

Returns

clearSilentLog

Copy URL
clearSilentLog(): 

void

Clear the logger journal and free some memory.

Returns

  • type:

    void

config

Copy URL
config(): 

Config

Get current config

Returns

connect

Copy URL
connect(): 

Promise<boolean>

Connect to VoxImplant Cloud

Returns

  • type:

    Promise<boolean>

connected

Deprecated
Copy URL
See Available Roles
connected(): 

boolean

Check if connected to VoxImplant Cloud

Returns

  • type:

    boolean

disconnect

Copy URL
disconnect(): 

Promise<void>

Disconnect from VoxImplant Cloud

Returns

  • type:

    Promise<void>

enableSilentLogging

Copy URL
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

getClientState

Copy URL
getClientState(): 

ClientState

Get current client state

Returns

getOperatorACDStatus

Copy URL
getOperatorACDStatus(): 

Promise<OperatorACDStatuses>

Return current ACD status of the operator.

Returns

getOperatorSQMessagingStatus

Copy URL
getOperatorSQMessagingStatus(): 

Promise<OperatorACDStatuses>

Return current SmartQueue Messaging status of the operator.

Returns

getSilentLog

Copy URL
getSilentLog(): 

string[]

Get records from the logger journal.

Returns

  • type:

    string[]

handlePushNotification

Copy URL
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

Copy URL
init(config: 

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

Returns

isInsertableStreamsSupported

Copy URL
isInsertableStreamsSupported(): 

boolean

Returns

  • type:

    boolean

isMediaTrackInsertableStreamSupported

Copy URL
isMediaTrackInsertableStreamSupported(): 

boolean

Returns

  • type:

    boolean

isRTCsupported

Copy URL
isRTCsupported(): 

boolean

Check if WebRTC support is available

Returns

  • type:

    boolean

joinAsSharing

Copy URL
joinAsSharing(num: 

string

|

number

,
sendAudio:

boolean

,
extraHeaders:

{[id: string]: string}

):

SharingCall

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

joinAsViewer

Copy URL
joinAsViewer(num: 

string

|

number

,
extraHeaders:

{[id: string]: string}

):

ViewerCall

Allows you to join a conference only for receiving audio/video

Parameters

  • num:

    string

  • extraHeaders:

    {[id: string]: string}

    Optional

Returns

limitAudioCodecs

Copy URL
limitAudioCodecs(codecs: 

CodecDescription[]

):

Promise<boolean>

Specify the audio codecs that can be used for calls.

Parameters

Returns

  • type:

    Promise<boolean>

limitVideoCodecs

Copy URL
limitVideoCodecs(codecs: 

CodecDescription[]

):

Promise<boolean>

Specify the video codecs that can be used for calls.

Parameters

Returns

  • type:

    Promise<boolean>

login

Copy URL
login(username: 

string

,
password:

string

,
options:

LoginOptions

):

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:

    LoginOptions

    Optional

Returns

loginWithOneTimeKey

Copy URL
loginWithOneTimeKey(username: 

string

,
hash:

string

,
options:

LoginOptions

):

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

Returns

loginWithToken

Copy URL
loginWithToken(username: 

string

,
token:

string

,
options:

LoginOptions

):

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:

    LoginOptions

    Optional

Returns

off

Copy URL
off(event: 

Events

,
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

Returns

  • type:

    void

on

Copy URL
on(event: 

Events

,
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:

    Events

    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

Copy URL
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

Copy URL
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

Copy URL
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

screenSharingSupported

Copy URL
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

Copy URL
setConnectionData(gateway: 

any

,
connectionId:

any

):

void

Parameters

  • gateway:

    any

  • connectionId:

    any

Returns

  • type:

    void

setLoggerCallback

Copy URL
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

Copy URL
setOperatorACDStatus(status: 

OperatorACDStatuses

):

Promise<OperatorACDStatuses>

Set ACD status

Parameters

Returns

setOperatorSQMessagingStatus

Copy URL
setOperatorSQMessagingStatus(status: 

OperatorACDStatuses

):

Promise<OperatorACDStatuses>

Set SmartQueue Messaging status

Parameters

Returns

setVideoBandwidth

Copy URL
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

Copy URL
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:  true
  • mirror:

    boolean

    Optional

    Deprecated

  • detachCamera:

    boolean

    Optional

    Deprecated

Returns

stopPlayback

Copy URL
stopPlayback(): 

void

Stop playing ToneScript using WebAudio API

Returns

  • type:

    void

tokenRefresh

Copy URL
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

    Optional

    A unique token for the current device

Returns

transferCall

Copy URL
transferCall(call1: 

Call

,
call2:

Call

):

void

Transfer call, depending on the result CallEvents.TransferComplete or CallEvents.TransferFailed event will be dispatched.

Parameters

  • call1:

    Call

    Call which will be transferred

  • call2:

    Call

    Call where call1 will be transferred

Returns

  • type:

    void

Props

alreadyInitialized

Copy URL
alreadyInitialized: 

boolean