Rate this page:

Client

The Client class is used to control platform functions. Can't be instantiated directly (singleton), so use the getInstancemethod to get the class instance.Example:

// Getting an instance
const vox = VoxImplant.getInstance();

Props

alreadyInitialized

Copy URL
alreadyInitialized: 

boolean

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. 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

    Tells if video should be supported for the call. It's false by default.

  • customData:

    string

    Optional

    Custom string associated with the call session. It can be passed to the cloud to be obtained from the CallAlerting event or Call History using HTTP API. Maximum size is 200 bytes. Use the Call.sendMessagemethod to pass a string over the limit; in order to pass a large data use media_session_access_url on your backend.

  • extraHeaders:

    {[id: string]: string}

    Optional

    Optional custom parameters (SIP headers) that should be passed with call (INVITE) message. Parameter names must start with "X-" to be processed by application. IMPORTANT: Headers size limit is 200 bytes.

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. 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

    Tells if video should be supported for the call. It's false by default.

  • customData:

    string

    Optional

    Custom string associated with the call session. It can be passed to the cloud to be obtained from the CallAlerting event or Call History using HTTP API. Maximum size is 200 bytes. Use the Call.sendMessagemethod to pass a string over the limit; in order to pass a large data use media_session_access_url on your backend.

  • extraHeaders:

    {[id: string]: string}

    Optional

    Optional custom parameters (SIP headers) that should be passed with call (INVITE) message. Parameter names must start with "X-" to be processed by application. IMPORTANT: Headers size limit is 200 bytes.

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(connectivityCheck: 

boolean

):

Promise<any>

Connect to VoxImplant Cloud

Parameters

  • connectivityCheck:

    boolean

    Optional

Returns

  • type:

    Promise<any>

connected

Copy URL
connected(): 

boolean

Check if connected to VoxImplant Cloud

Returns

  • type:

    boolean

disconnect

Copy URL
disconnect(): 

void

Disconnect from VoxImplant Cloud

Returns

  • type:

    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 getSilentLogfunction and clean it by the clearSilentLogfunction.

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

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<SDKReady,string>

Initialize SDK. The Events.SDKReadyevent will be dispatched after successful SDK initialization. SDK can't be used until it's initialized

Parameters

Returns

isRTCsupported

Copy URL
isRTCsupported(): 

boolean

Check if WebRTC support is available

Returns

  • type:

    boolean

login

Copy URL
login(username: 

string

,
password:

string

,
options:

LoginOptions

):

Promise<AuthResult>

Log in to an application. The method triggers the Events.AuthResultevent.

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<any>

Log in to an application using the 'onetimekey' auth method. Hash should be calculated with the key from the triggered Events.AuthResultevent.Please, read the how-to page.

Parameters

Returns

  • type:

    Promise<any>

loginWithToken

Copy URL
loginWithToken(username: 

string

,
token:

string

,
options:

LoginOptions

):

Promise<any>

Log in to an application using an accessToken. The method triggers the Events.AuthResultevent.

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

  • type:

    Promise<any>

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<Object>

Request a key for the 'onetimekey' auth method. Server will send the key in the Events.AuthResultevent with the code 302.Please, read the how-to page.

Parameters

  • username:

    string

Returns

  • type:

    Promise<Object>

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>

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

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

    Defaults on:  false
  • detachCamera:

    boolean

    Defaults on:  false

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<AuthTokenResult>

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.TransferCompleteor CallEvents.TransferFailedevent will be dispatched.

Parameters

  • call1:

    Call

    Call which will be transferred

  • call2:

    Call

    Call where call1 will be transferred

Returns

  • type:

    void