SIGN UP

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.

Example:

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

Methods

call(num: string|CallSettings, useVideo: boolean|VideoFlags, customData: string, extraHeaders: Object): Call

Create call

Parameters

  • num:

    string|CallSettings

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

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

  • customData:

    stringOptional

    Custom string associated with the call session. It can be later obtained from Call History using HTTP API. Maximum size is 200 bytes.

  • extraHeaders:

    ObjectOptional

    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(num: string|CallSettings, useVideo: boolean|VideoFlags, customData: string, extraHeaders: Object): Call

Create call to a dedicated conference without proxy session. For details see the video conferencing guide

Parameters

  • num:

    string|CallSettings

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

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

  • customData:

    stringOptional

    Custom string associated with the call session. It can be later obtained from Call History using HTTP API. Maximum size is 200 bytes.

  • extraHeaders:

    ObjectOptional

    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(): void

Clear the log journal and free some memory.

Returns

  • Return:

    void
config(): Config

Get current config

Returns

connect(connectivityCheck: boolean): Promise<Object>

Connect to VoxImplant Cloud

Parameters

  • connectivityCheck:

    booleanOptional

Returns

  • Return:

    Promise<Object>
connected(): boolean

Check if connected to VoxImplant Cloud

Returns

  • Return:

    boolean
disconnect(): void

Disconnect from VoxImplant Cloud

Returns

  • Return:

    void
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 log messages into the log until you disable it.
Note that enabling of the silent logging automatically clears all existed log records before the start.
You can get current log by the getSilentLog function and clean it by the clearSilentLog function.

Parameters

  • flag:

    boolean

Returns

  • Return:

    void
getClientState(): ClientState

Get current client state

Returns

getOperatorACDStatus(): Promise<OperatorACDStatuses>

Return current ACD status of the operator.

Returns

getSilentLog(): Array<string>

Get records from the log journal.

Returns

  • Return:

    Array<string>
init(config: Config): Promise<SDKReady|string>

Initialize SDK. SDKReady event will be dispatched after successful SDK initialization. SDK can't be used until it's initialized

Parameters

Returns

isRTCsupported(): boolean

Check if WebRTC support is available

Returns

  • Return:

    boolean
login(username: string, password: string, options: LoginOptions): Promise<AuthResult>

Login into application

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:

    LoginOptionsOptional

Returns

loginWithOneTimeKey(username: string, hash: string, options: LoginOptions): Promise<Object>

Login into application using 'onetimekey' auth method. Hash should be calculated with the key received in AuthResult event
Please, read howto page

Parameters

Returns

  • Return:

    Promise<Object>
loginWithToken(username: string, token: string, options: LoginOptions): Promise<Object>

Login into application using accessToken

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:

    LoginOptionsOptional

Returns

  • Return:

    Promise<Object>
off(event: Events, handler: Function): void

Remove handler for specified event

Parameters

Returns

  • Return:

    void
on(event: Events, handler: Function): void

Register handler for specified event

Parameters

  • event:

    Events

    Event class (i.e. Events.SDKReady). See Events

  • handler:

    Function

    Handler function. A single parameter is passed - object with event information

Returns

  • Return:

    void
playToneScript(script: string, loop: boolean): void

Play ToneScript using WebAudio API

Parameters

  • script:

    string

    Tonescript string

  • loop:

    boolean

Returns

  • Return:

    void
requestOneTimeLoginKey(username: string): Promise<Object>

Request a key for 'onetimekey' auth method. Server will send the key in AuthResult event with code 302
Please, read howto page

Parameters

  • username:

    string

Returns

  • Return:

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

  • Return:

    Promise<boolean>
setLoggerCallback(callback: (record: LogRecord) => void): 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

Type declaration

(record: LogRecord) => void

Parameters

Returns

  • Return:

    void
setOperatorACDStatus(status: OperatorACDStatuses): Promise<OperatorACDStatuses>

Set ACD status

Parameters

Returns

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

  • Return:

    void
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
  • mirror:

    boolean
  • detachCamera:

    boolean

Returns

stopPlayback(): void

Stop playing ToneScript using WebAudio API

Returns

  • Return:

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

    stringOptional

    A unique token for the current device

Returns

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

  • Return:

    void