VIClient
Interface that may be used to connect and login to Voximplant Cloud, make and receive audio/video calls.
Methods
call:settings:
- (nullable VICall *)call:(NSString *)number
settings:(VICallSettings *)settings
Create a new call instance. Call must be then started using [VICall start].
Parameters
number:
NSString *SIP URI, username or phone number to make call to. Actual routing is then performed by VoxEngine scenario.
settings:
VICallSettings *Call settings with additional call parameters, such as preferred video codec, custom data, extra headers etc.
Returns
Return:
nullable VICall *Call instance
callConference:settings:
- (nullable VICall *)callConference:(NSString *)conference
settings:(VICallSettings *)settings
Create call to a dedicated conference without proxy session. Call must be then started using [VICall start]. For details see the video conferencing guide.
Parameters
conference:
NSString *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.
settings:
VICallSettings *Call settings with additional call parameters, such as preferred video codec, custom data, extra headers etc.
Returns
Return:
nullable VICall *Call instance
callToUser:withSendVideo:receiveVideo:customData:
Deprecated- (nullable VICall *)callToUser:(NSString *)user
withSendVideo:(BOOL)sendVideo
receiveVideo:(BOOL)receiveVideo
customData:(nullable NSString *)customData
Create a new call instance. Call must be then started using [VICall startWithHeaders:].
Parameters
user:
NSString *SIP URI, username or phone number to make call to. Actual routing is then performed by VoxEngine scenario.
sendVideo:
BOOLSpecify if video send is enabled for a call.
receiveVideo:
BOOLSpecify if video receive is enabled for a call.
customData:
nullable NSString *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 [VICall sendMessage:] method to pass a string over the limit; in order to pass a large data use media_session_access_url on your backend.
Returns
Return:
nullable VICall *Call instance
clientVersion
+ (NSString *)clientVersion
Get client version.
Returns
Return:
NSString *Voximplant Client version.
connect
- (BOOL)connect
Connect to Voximplant Cloud.
Returns
Return:
BOOLYES if the attempt to connect can be performed, NO otherwise. Return value "NO" means that the connection to Voximplant Cloud is currently establishing or already established. In this case please check the current client state via [VIClient clientState] property and proceed according to the current state.
connectWithConnectivityCheck:gateways:
- (BOOL)connectWithConnectivityCheck:(BOOL)connectivityCheck
gateways:(nullable NSArray *)gateways
Connect to Voximplant Cloud.
Parameters
connectivityCheck:
BOOLChecks whether UDP traffic will flow correctly between device and Voximplant Cloud. This check reduces connection speed.
gateways:
nullable NSArray *Array of server names of particular media gateways for connection.
Returns
Return:
BOOLYES if the attempt to connect can be performed, NO otherwise. Return value NO means that the connection to Voximplant Cloud is currently establishing or already established. In this case please check the current client state via [VIClient clientState] property and proceed according to the current state.
disconnect
- (void)disconnect
Disconnect from Voximplant Cloud.
handlePushNotification:
- (void)handlePushNotification:(NSDictionary *)notification
Handle incoming push notification.
Parameters
notification:
NSDictionary *The incoming notification which comes from [PKPushRegistryDelegate pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:].
initWithDelegateQueue:
- (instancetype)initWithDelegateQueue:(dispatch_queue_t)queue
Initialize client instance.
Parameters
queue:
dispatch_queue_tAll delegates methods will be called in this queue. Queue should be serial, but not concurrent (main queue is applicable).
Returns
Return:
instancetypeClient instance.
initWithDelegateQueue:bundleId:
- (instancetype)initWithDelegateQueue:(dispatch_queue_t)queue
bundleId:(nullable NSString *)bundleId
Initialize client instance.
You need to use this only if you are going to send push notifications across several iOS apps using a single Voximplant application.
Parameters
queue:
dispatch_queue_tAll delegates methods will be called in this queue. Queue should be serial, but not concurrent (main queue is applicable).
bundleId:
nullable NSString *Application bundle id
Returns
Return:
instancetypeClient instance.
loginWithUser:oneTimeKey:success:failure:
- (void)loginWithUser:(NSString *)user
oneTimeKey:(NSString *)oneTimeKey
success:(nullable VILoginSuccess)success
failure:(nullable VILoginFailure)failure
Login to Voximplant Cloud using one time key.
Parameters
user:
NSString *Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com.
oneTimeKey:
NSString *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:
nullable VILoginSuccessCompletion handler triggered if operation is completed successfully.
typedef void (^VILoginSuccess)(NSString *displayName, NSDictionary *authParams);
- displayName: Display name of logged in user.
- authParams: Auth parameters that can be used to login using access token.
failure:
nullable VILoginFailureCompletion handler failure triggered if operation is failed.
typedef void (^VILoginFailure)(NSError *error);
- error: Occurred error. See VILoginErrorCode for possible variants.
loginWithUser:password:success:failure:
- (void)loginWithUser:(NSString *)user
password:(NSString *)password
success:(nullable VILoginSuccess)success
failure:(nullable VILoginFailure)failure
Login to Voximplant Cloud using password.
Parameters
user:
NSString *Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com.
password:
NSString *User password.
success:
nullable VILoginSuccessCompletion handler triggered if operation is completed successfully.
typedef void (^VILoginSuccess)(NSString *displayName, NSDictionary *authParams);
- displayName: Display name of logged in user.
- authParams: Auth parameters that can be used to login using access token.
failure:
nullable VILoginFailureCompletion handler failure triggered if operation is failed.
typedef void (^VILoginFailure)(NSError *error);
- error: Occurred error. See VILoginErrorCode for possible variants.
loginWithUser:token:success:failure:
- (void)loginWithUser:(NSString *)user
token:(NSString *)token
success:(nullable VILoginSuccess)success
failure:(nullable VILoginFailure)failure
Login to Voximplant Cloud using access token.
Parameters
user:
NSString *Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com.
token:
NSString *Access token obtained from authParams.
success:
nullable VILoginSuccessCompletion handler triggered if operation is completed successfully.
typedef void (^VILoginSuccess)(NSString *displayName, NSDictionary *authParams);
- displayName: Display name of logged in user.
- authParams: Auth parameters that can be used to login using access token.
failure:
nullable VILoginFailureCompletion handler failure triggered if operation is failed.
typedef void (^VILoginFailure)(NSError *error);
- error: Occurred error. See VILoginErrorCode for possible variants.
refreshTokenWithUser:token:result:
- (void)refreshTokenWithUser:(NSString *)user
token:(NSString *)token
result:(nullable VIRefreshTokenResult)result
Perform refresh of login tokens required for login using access token.
Parameters
user:
NSString *Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com.
token:
NSString *Refresh token obtained from authParams.
result:
nullable VIRefreshTokenResultCompletion handler that is triggered when the operation is completed.
typedef void (^VIRefreshTokenResult)(NSDictionary *authParams, NSError *error);
- authParams: Auth parameters that can be used to login using access token.
- error: Occurred error. See VILoginErrorCode for possible variants.
registerPushNotificationsToken:imToken:
- (void)registerPushNotificationsToken:(nullable NSData *)voipToken
imToken:(nullable NSData *)imToken
Register Apple Push Notifications token.
After calling this function application will receive push notifications from Voximplant Server.
Parameters
voipToken:
nullable NSData *The APNS token for VoIP push notifications which comes from [PKPushRegistryDelegate pushRegistry:didUpdatePushCredentials:forType:].
imToken:
nullable NSData *The APNS token for IM push notifications.
requestOneTimeKeyWithUser:result:
- (void)requestOneTimeKeyWithUser:(NSString *)user
result:(VIOneTimeKeyResult)result
Generates one time login key to be used for automated login process.
For additional information please see:
Parameters
user:
NSString *Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com.
result:
VIOneTimeKeyResultCompletion handler that is triggered when the operation is completed.
typedef void (^VIOneTimeKeyResult)(NSString *oneTimeKey, NSError *error);
- oneTimeKey: Resulting One Time Key.
- error: Occurred error. See VILoginErrorCode for possible variants.
saveLogToFileEnable
+ (void)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.
setLogLevel:
+ (void)setLogLevel:(VILogLevel)logLevel
Set a verbosity level for log messages. This method must be called before creating SDK object instance.
Parameters
logLevel:
VILogLevelLog verbosity level.
unregisterPushNotificationsToken:imToken:
- (void)unregisterPushNotificationsToken:(nullable NSData *)voipToken
imToken:(nullable NSData *)imToken
Unregister Apple Push Notifications token.
After calling this function application stops receive push notifications from Voximplant Server.
Parameters
voipToken:
nullable NSData *The APNS token for VoIP push notifications which comes from [PKPushRegistryDelegate pushRegistry:didUpdatePushCredentials:forType:].
imToken:
nullable NSData *The APNS token for IM push notification.
webrtcVersion
+ (NSString *)webrtcVersion
Get underlying WebRTC version.
Returns
Return:
NSString *WebRTC version.
Properties
callManagerDelegate
Call manager delegate that handles incoming calls.
calls
Dictionary of actual calls with their ids.
messenger
Get instance of messaging subsystem.
Messenger instance, or nil if user is not logged in.
sessionDelegate
Session delegate that handles events for connection with Voximplant Cloud.