Using iOS SDK

This guide provides you to make the simplest application to make audio calls. You can start by downloading our demo application

Demo application with CallKit integration

iOS SDK has three dependencies, you can check them directly in the cocoapods site.

You can make and receive calls using your device’s data connection to/from any other endpoint that works with Voximplant: other mobile app built using Voximplant Mobile SDK, a web application built using the Web SDK, SIP phones and phone numbers all over the world.

Adding SDK to your application using Cocoapods

  • Install the CocoaPods (see getting starting guide)
  • Follow the instructions to create or modify Podfile
  • Add VoxImplantSDK dependency to your target in Podfile
    platform :ios, '8.0'
    target 'MyApp' do
     // other dependencies and configurations
     pod 'VoxImplantSDK'
  • Run "pod install" command in terminal from your project directory
    pod install
  • Open the *.xcworkspace file that was created. This should be the file you use every day to create your app

You can see the example of Podfile in demo's repository.

You can also use bitcode assemblies in your builds. Despite having this option, usage of bitcode libraries is not recommended for debug/testing builds because of its size. The VoxImplantWebRTC bitcode assembly is unoptimized and around 700 Mb. Due to the size, it allows Apple services to pick only the required components and methods from it.

See the details here.


Initializing SDK

Include the NSMicrophoneUsageDescription and NSCameraUsageDescription keys in your app's Info.plist file and provide reasonable strings for this keys. If your app attempts to access any of the device’s microphones or cameras without corresponding reasonable strings, your app exits. 

You also have to declare four Background Modes:

  • Audio and AirPlay
  • Background fetch
  • Remote notifications
  • Voice over IP

Enabling the Background Modes option adds the UIBackgroundModes key to your app’s Info.plist file. Selecting checkboxes in Xcode adds the corresponding background mode values to that key. 


Then create VIClient instance and initialize it as specified in documentation:


let client = VIClient(delegateQueue: DispatchQueue.main)


VIClient *client = [[VIClient alloc] 


Logging in

Firstly you need to connect to the Voximplant cloud. As a result the clientSessionDidConnect: or client:sessionDidFailConnectWithError: event will be sent to VIClientSessionDelegate. After connection is established, use the loginWithUser:password:success:failure: function to authenticate. For example, when you need to login user myuser to applcation myapp in your Voximplant account named myaccount with password mypass


class SomeClass : NSObject, VIClientSessionDelegate,
       VIClientCallManagerDelegate {
   var client : VIClient?
   var call : VICall?

   override init() {

       self.client = VIClient(delegateQueue: DispatchQueue.main)
       self.client?.sessionDelegate = self

   func clientSessionDidConnect(_ client: VIClient!) {
       NSLog("Connection established")

       // For other login methods please see the article:
           withUser: "",
           password: "mypass",
           success: {
               (displayName, authParams) in NSLog("Login success")
           failure: {
               error in NSLog("Login failed")


@interface SomeClass () <VIClientSessionDelegate,

@property (strong, nonatomic) VIClient *client;
@property (strong, nonatomic) VICall *call;


@implementation SomeClass

- (instancetype)init {
   self = [super init];

   if (self) {
       self.client = [[VIClient alloc] 
       self.client.sessionDelegate = self;
       [self.client connect];

   return self;

- (void)clientSessionDidConnect:(VIClient *)client {
   NSLog(@"Connection established");

   // For other login methods please see the article:
   [client loginWithUser:@""
                 success:^(NSString *displayName,
                           NSDictionary *authParams) {
                     NSLog(@"Login succeeded");
                 failure:^(NSError *error) {
                     NSString *err = error.localizedDescription;
                     NSLog(@"Login failed with error %@", err);


Making calls

To make an outbound audio call you need to run following code sequence:


func makeTestCall() {
   let callSettings = VICallSettings()
   callSettings.videoFlags = VIVideoFlags.videoFlags(receiveVideo: false, sendVideo: false)

   if let call ="to", settings: callSettings) {


- (void)makeTestCall {
   VICallSettings *callSettings = [[VICallSettings alloc] init];
   callSettings.videoFlags = [VIVideoFlags videoFlagsWithReceiveVideo:NO sendVideo:NO];

   VICall *call = [_client call:@"to" settings:callSettings];
   if (call) {
       [call start];

Please note that call is actually initiated only when you call the appropriate method (see the last line in the examples).


Receiving calls

You have to set delegate VIClientCallManagerDelegate to handle an incoming call. When application receives incoming call, the client:didReceiveIncomingCall:withIncomingVideo:headers: event is sent to your delegate. If you need to answer the call, you have to use following code:


func client(_ client: VIClient, didReceiveIncomingCall call: VICall, withIncomingVideo video: Bool, headers: [AnyHashable: Any]?) {
   let callSettings = VICallSettings()
   callSettings.videoFlags = VIVideoFlags.videoFlags(receiveVideo: video, sendVideo: video)

   call.answer(with: callSettings)


- (void)client:(VIClient *)client didReceiveIncomingCall:(VICall *)call withIncomingVideo:(BOOL)video headers:(nullable NSDictionary *)headers {
   VICallSettings *callSettings = [[VICallSettings alloc] init];
   callSettings.videoFlags = [VIVideoFlags videoFlagsWithReceiveVideo:video sendVideo:video];

   [call answerWithSettings:callSettings];


Terminating calls

Using the hangupWithHeaders: method allows to terminate the call properly. Both participants will receive the call:didDisconnectWithHeaders:answeredElsewhere: event after hangup's call will be executed.


func hangUp() { nil)


- (void)hangUp {
   [ hangupWithHeaders:nil];


For more information, please read our reference documentation.