Class Client

Client class used to control platform functions. Can't be instantiated directly (singleton), please use VoxImplant.getInstance to get the class instance.

Index

Constructors

constructor

Methods

attachRecordingDevice

  • attachRecordingDevice(successCallback?: Function, failedCallback?: Function): Promise<MediaStreamTrack>
  • Enable microphone/camera if micRequired in VoxImplant.Config was set to false

    Parameters

    • Optional successCallback: Function
    • Optional failedCallback: Function

    Returns Promise<MediaStreamTrack>

audioOutputs

  • audioOutputs(): AudioOutputInfo[]
  • Get a list of all currently available audio playback devices

    Returns AudioOutputInfo[]

audioSources

  • audioSources(): AudioSourceInfo[]
  • Get a list of all currently available audio sources / microphones

    Returns AudioSourceInfo[]

call

  • Create call

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

    • Optional useVideo: boolean | VideoFlags

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

    • Optional customData: string

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

    • Optional extraHeaders: object

      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.

      • [id: string]: string

    Returns Call

config

  • Get current config

    Returns Config

connect

  • connect(connectivityCheck?: boolean): Promise<Object>
  • Connect to VoxImplant Cloud

    Parameters

    • Optional connectivityCheck: boolean

    Returns Promise<Object>

connected

  • connected(): boolean

detachRecordingDevice

  • detachRecordingDevice(): void
  • Disable microphone/camera if micRequired in VoxImplant.Config was set to false

    Returns void

disconnect

  • disconnect(): void
  • Disconnect from VoxImplant Cloud

    Returns void

getClientState

init

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

    Parameters

    Returns Promise<SDKReady | string>

isRTCsupported

  • isRTCsupported(): boolean
  • Check if WebRTC support is available

    Returns boolean

login

  • login(username: string, password: string, options?: LoginOptions): Promise<Object>
  • 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
    • Optional options: LoginOptions

    Returns Promise<Object>

loginWithOneTimeKey

  • 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

    • username: string
    • hash: string
    • Optional options: LoginOptions

    Returns Promise<Object>

loginWithToken

  • 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
    • Optional options: LoginOptions

    Returns Promise<Object>

off

  • off(event: Events, handler?: Function): void

on

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

playToneScript

  • playToneScript(script: string, loop?: boolean): void
  • Play ToneScript using WebAudio API

    Parameters

    • script: string

      Tonescript string

    • Default value loop: boolean = false

    Returns void

requestOneTimeLoginKey

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

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

sendVideo

  • sendVideo(flag?: boolean): void
  • Start/stop sending local video to remote party/parties

    Parameters

    • Default value flag: boolean = true

    Returns void

setCallActive

  • setCallActive(call: Call, active?: boolean): Promise<Updated>
  • Set active call

    Parameters

    • call: Call

      VoxImplant call instance

    • Default value active: boolean = true

    Returns Promise<Updated>

setOperatorACDStatus

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 void

setVideoSettings

  • setVideoSettings(settings: VideoSettings, successCallback?: Function, failedCallback?: Function): void
  • Set video settings globally. This settings will be used for the next call.

    Parameters

    • settings: VideoSettings

      Video settings

    • Optional successCallback: Function
    • Optional failedCallback: Function

    Returns void

showLocalVideo

  • showLocalVideo(flag?: boolean, mirror?: boolean, detachCamera?: boolean): void
  • Show/hide local video

    Parameters

    • Default value flag: boolean = true
    • Default value mirror: boolean = false
    • Default value detachCamera: boolean = false

    Returns void

stopPlayback

  • stopPlayback(): void
  • Stop playing ToneScript using WebAudio API

    Returns void

tokenRefresh

  • 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
    • Optional deviceToken: string

      A unique token for the current device

    Returns Promise<AuthTokenResult>

transferCall

  • transferCall(call1: Call, call2: Call): void

useAudioOutput

  • useAudioOutput(id: string): Promise<void>
  • Use specified audio output for new calls, use audioOutputs to get the list of available audio output

    Parameters

    • id: string

      Id of the audio source

    Returns Promise<void>

useAudioSource

  • useAudioSource(id: string, successCallback?: Function, failedCallback?: Function): Promise<MediaStream>
  • Use specified audio source, use audioSources to get the list of available audio sources If SDK was init with micRequired: false, force attach microphone.

    Parameters

    • id: string

      Id of the audio source

    • Optional successCallback: Function
    • Optional failedCallback: Function

    Returns Promise<MediaStream>

useVideoSource

  • useVideoSource(id: string, successCallback?: Function, failedCallback?: Function): Promise<MediaStream>
  • Use specified video source, use videoSources to get the list of available video sources

    Parameters

    • id: string

      Id of the video source

    • Optional successCallback: Function
    • Optional failedCallback: Function

    Returns Promise<MediaStream>

videoSources

  • videoSources(): VideoSourceInfo[]
  • Get a list of all currently available video sources / cameras

    Returns VideoSourceInfo[]