VIClient

Interface that may be used to connect and login to VoxImplant Cloud, make and receive audio/video calls.

Members
Other Methods
+  clientVersion

Get client version

+ (NSString *)clientVersion
Return

Client version

+  setLogLevel:

Set a verbosity level for log messages. This method must be called before creating SDK object instance.

+ (void)setLogLevel:(VILogLevel)logLevel
Parameters
logLevel

VILogLevel log verbosity level

+  saveLogToFileEnable

Enable saving of the logs to file. Log files located at: Library/Caches/Logs This method must be called before creating SDK object instance.

+ (void)saveLogToFileEnable
–  init

Warning: NS_UNAVAILABLE

- (instancetype)init
–  initWithDelegateQueue:

Initialize VIClient instance

- (instancetype)initWithDelegateQueue:(dispatch_queue_t)queue
Parameters
queue

All delegates methods will be called in this queue. Queue should be serial, but not concurrent (main queue is applicable).

messenger

Get instance of messaging subsystem.

@property (nonatomic, strong, readonly) VIMessenger *messenger
Login Methods
–  loginWithUser:password:success:failure:

Login to VoxImplant cloud using password.

- (void)loginWithUser:(NSString *)user password:(NSString *)password success:(VILoginSuccess)success failure:(VILoginFailure)failure
Parameters
user

Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com

password

User password

success

VILoginSuccess completion handler triggered if operation is completed successfully

failure

VILoginFailure completion handler failure triggered if operation is failed

–  loginWithUser:token:success:failure:

Login to VoxImplant cloud using access token.

- (void)loginWithUser:(NSString *)user token:(NSString *)token success:(VILoginSuccess)success failure:(VILoginFailure)failure
Parameters
user

Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com

token

Access token obtained from authParams

success

VILoginSuccess completion handler triggered if operation is completed successfully

failure

VILoginFailure completion handler failure triggered if operation is failed

–  loginWithUser:oneTimeKey:success:failure:

Login to VoxImplant cloud using one time key.

- (void)loginWithUser:(NSString *)user oneTimeKey:(NSString *)oneTimeKey success:(VILoginSuccess)success failure:(VILoginFailure)failure
Parameters
user

Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com

oneTimeKey

Hash that was generated using following formula:

 MD5(oneTimeKey+"|"+MD5(user+":voximplant.com:"+password))

Please note that here user is just a user name, without app name, account name or anything else after “@”. So if you pass myuser@myapp.myacc.voximplant.com as a username, you should only use myuser while computing this hash

success

VILoginSuccess completion handler triggered if operation is completed successfully

failure

VILoginFailure completion handler failure triggered if operation is failed

–  refreshTokenWithUser:token:result:

Perform refresh of login tokens required for login using access token

- (void)refreshTokenWithUser:(NSString *)user token:(NSString *)token result:(VIRefreshTokenResult)result
Parameters
user

Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com

token

Refresh token obtained from authParams

result

VIRefreshTokenResult completion handler that is triggered when the operation is completed

–  requestOneTimeKeyWithUser:result:

Generates one time login key to be used for automated login process.

- (void)requestOneTimeKeyWithUser:(NSString *)user result:(VIOneTimeKeyResult)result
Parameters
user

Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com

result

VIOneTimeKeyResult completion handler that is triggered when the operation is completed

Push Methods
–  registerPushNotificationsToken:imToken:

Register Apple Push Notifications token. After calling this function application will receive push notifications from Voximplant Server.

- (void)registerPushNotificationsToken:(NSData *)voipToken imToken:(NSData *)imToken
Parameters
voipToken

The APNS token for VoIP push notifications which comes from:

 - (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(PKPushType)type;
imToken

The APNS token for IM push notifications

–  unregisterPushNotificationsToken:imToken:

Unregister Apple Push Notifications token. After calling this function application stops receive push notifications from Voximplant Server

- (void)unregisterPushNotificationsToken:(NSData *)voipToken imToken:(NSData *)imToken
Parameters
voipToken

The APNS token for VoIP push notifications which comes from:

 - (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(PKPushType)type;
imToken

The APNS token for IM push notification

–  handlePushNotification:

Handle incoming push notification

- (void)handlePushNotification:(NSDictionary *)notification
Parameters
notification

The incomming notification which comes from:

 - (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type
CallManager Methods
callManagerDelegate

CallManager delegate that handles incoming calls.

@property (nonatomic, weak) id<VIClientCallManagerDelegate> callManagerDelegate
calls

Dictionary of actual calls with their ids.

@property (nonatomic, strong, readonly) NSDictionary<NSString*VICall*> *calls
–  callToUser:withSendVideo:receiveVideo:customData:

Create new call instance. Call must be then started using startCall

- (VICall *)callToUser:(NSString *)user withSendVideo:(BOOL)sendVideo receiveVideo:(BOOL)receiveVideo customData:(NSString *)customData
Parameters
user

SIP URI, username or phone number to make call to. Actual routing is then performed by VoxEngine scenario

sendVideo

Specify if video send is enabled for a call

receiveVideo

Specify if video receive is enabled for a call

customData

Custom data passed with call. Will be available in VoxEngine scenario

Return

Pointer to VICall instance

Session Methods
sessionDelegate

Session delegate that handles events for connection with VoxImplant Cloud.

@property (nonatomic, weak) id<VIClientSessionDelegate> sessionDelegate
–  connect

Connect to VoxImplant cloud

- (void)connect
–  connectWithConnectivityCheck:gateways:

Connect to VoxImplant cloud.

- (void)connectWithConnectivityCheck:(BOOL)connectivityCheck gateways:(NSArray *)gateways
Parameters
connectivityCheck

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

gateways

Array of server names of particular media gateways for connection

–  disconnect

Disconnect from VoxImplant cloud

- (void)disconnect