Rate this page:

VIClient

Interface that may be used to connect, login to the Voximplant CLoud, make and receive audio and video calls.

Methods

call

Copy URL

Future<VICall>

call(

String

number,

VICallSettings?

settings
)

Creates a new VICall instance and starts the outgoing call.

Throws VIException, if the client is not logged in, otherwise returns VICall instance.

Errors:

Parameters

  • number:

    String

    The call destination that might be Voximplant username, phone number or SIP URI. Actual routing is then performed by a VoxEngine scenario.

  • settings:

    VICallSettings?

    Optional

    Additional call parameters like video direction for the call, preferred video codec, custom data.

Returns

conference

Copy URL

Future<VICall>

conference(

String

conference,

VICallSettings?

settings
)

Creates a new VICall instance and starts the conference.

Throws VIException, if the client is not logged in, otherwise returns VICall instance.

Errors:

Parameters

  • conference:

    String

    The call destination. For SIP compatibility reasons it should be a non-empty string even if the number itself is not used by a Voximplant cloud scenario.

  • settings:

    VICallSettings?

    Optional

    Additional call parameters like video direction for the call, preferred video codec, custom data.

Returns

connect

Copy URL

Future<void>

connect({

VINode

node,

bool

connectivityCheck = false,

List<String>?

servers
}
)

Connects to the Voximplant Cloud.

Checks whether UDP traffic will flow correctly between device and the Voximplant Cloud if [connectivityCheck] is enabled (disabled by default).

Throws VIException if the connection to the Voximplant Cloud could not be established.

Errors:

  • ERROR_CONNECTION_FAILED - If the connection is currently establishing or already established, or an error occurred.

Parameters

  • node:

    VINode

    Specifies the node the Voximplant account belongs to.

  • connectivityCheck:

    bool

    Optional

    Checks whether UDP traffic will flow correctly between device and Voximplant cloud. This check reduces connection speed.

  • servers:

    List<String>?

    Optional

    List of server names of particular media gateways for connection.

Returns

  • type:

    Future<void>

disconnect

Copy URL

Future<void>

disconnect()

Closes the connection with the Voximplant Cloud.

Returns

  • type:

    Future<void>

getClientState

Copy URL

Future<VIClientState>

getClientState()

Returns the current client state

Returns

handlePushNotification

Copy URL

Future<void>

handlePushNotification(

Map<String, dynamic>

message
)

Handles incoming push notification.

Throws VIException, if [message] is null.

Errors:

Parameters

  • message:

    Map<String, dynamic>

    Incoming push notification payload

Returns

  • type:

    Future<void>

login

Copy URL

Future<VIAuthResult>

login(

String

username,

String

password
)

Logs in a user with the given Voximplant username and password.

Throws VIException, if login process failed, otherwise returns VIAuthResult.

Errors:

Parameters

  • username:

    String

    Full user name, including Voximplant user, application, and account name in the format user@application.account.voximplant.com.

  • password:

    String

    User password.

Returns

loginWithAccessToken

Copy URL

Future<VIAuthResult>

loginWithAccessToken(

String

username,

String

token
)

Logs in a user with the given Voximplant username and access token.

Throws VIException, if login process failed, otherwise returns VIAuthResult.

Errors:

Parameters

  • username:

    String

    Full user name, including Voximplant user, application, and account name in the format user@application.account.voximplant.com.

  • token:

    String

    Access token that was obtained from VIAuthResult.loginTokens after previous successful login.

Returns

loginWithOneTimeKey

Copy URL

Future<VIAuthResult>

loginWithOneTimeKey(

String

username,

String

hash
)

Logs in a user with the given Voximplant username and one time key that was generated before.

Throws VIException, if login process failed, otherwise returns VIAuthResult.

Errors:

Parameters

  • username:

    String

    Full user name, including Voximplant user, application, and account name in the format user@application.account.voximplant.com.

  • hash:

    String

    Hash that was generated using following formula: MD5(oneTimeKey+"|"+MD5(user+":voximplant.com:"+password)).

Returns

registerForPushNotifications

Copy URL

Future<void>

registerForPushNotifications(

String

pushToken
)

Registers for VoIP push notification with the given token.

Application will receive push notifications from Voximplant Server after first login.

Throws VIException, if [pushToken] is null.

Errors:

Parameters

  • pushToken:

    String

    Push notification token.

Returns

  • type:

    Future<void>

registerIMPushNotificationsTokenIOS

Copy URL

Future<void>

registerIMPushNotificationsTokenIOS(

String

imToken
)

Register Apple Push Notifications token.

After calling this function application will receive push notifications from Voximplant Server. If the provided token is not nil, but the client is not logged in, the token will be registered just after login.

IOS ONLY.

Parameters

  • imToken:

    String

    The APNS token for IM push notification.

Returns

  • type:

    Future<void>

requestOneTimeLoginKey

Copy URL

Future<String>

requestOneTimeLoginKey(

String

username
)

Generates one time login key for the given Voximplant username.

Throws VIException, if an error occurred, otherwise returns one time key.

Errors:

Parameters

  • username:

    String

    Full user name, including Voximplant user, application, and account name in the format user@application.account.voximplant.com.

Returns

  • type:

    Future<String>

tokenRefresh

Copy URL

Future<VILoginTokens>

tokenRefresh(

String

username,

String

token
)

Performs refresh of access token for the given Voximplant username using refresh token.

Throws VIException, if refresh process failed, otherwise returns new tokens.

Errors:

Parameters

  • username:

    String

    Full user name, including Voximplant user, application, and account name in the format user@application.account.voximplant.com.

  • token:

    String

    Refresh token can be obtained from VIAuthResult.loginTokens after previous successful login.

Returns

unregisterFromPushNotifications

Copy URL

Future<void>

unregisterFromPushNotifications(

String

pushToken
)

Unregisters from VoIP push notifications.

Application will no longer receive push notifications from Voximplant Server.

Throws VIException, if [pushToken] is null.

Errors:

Parameters

  • pushToken:

    String

    Push notification token.

Returns

  • type:

    Future<void>

unregisterIMPushNotificationsTokenIOS

Copy URL

Future<void>

unregisterIMPushNotificationsTokenIOS(

String

imToken
)

Unregister Apple Push Notifications token.

After calling this function application stops receive push notifications from Voximplant Server. If the provided token is not nil, but the client is not logged in, the token will be unregistered just after login.

IOS ONLY.

Parameters

  • imToken:

    String

    The APNS token for IM push notification.

Returns

  • type:

    Future<void>

Props

clientStateStream

Copy URL

Stream<VIClientState>

clientStateStream

Receive VIClientState each time the state is changed.

Returns

onIncomingCall

Copy URL

VIIncomingCall?

onIncomingCall

Callback for getting notified about new incoming call.

Returns

onPushDidExpire

Copy URL

VIPushDidExpire?

onPushDidExpire

Callback for getting notified when push notification is expired.

Returns