Using iOS SDK

VoxImplant iOS SDK lets you embed voice communication into your native iOS applications. Start by downloading one of our demo applications:

New Swift demo application with CallKit integration Legacy Objective-C demo application

After download:

  • Install the CocoaPods (see getting starting guide)
  • Unpack the archive and cd into the unpacked directory
  • Run the pod install shell command
  • Open the VoxImplantSDKDemo.xcworkspace file

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, web application built using the Web SDK, SIP phones and phone numbers all over the world.

Using CocoaPods

  • Install the CocoaPods (see getting starting guide)
  • Open a terminal window, and cd into your project directory
  • Create a Podfile. This can be done by running $ touch Podfile
  • Open your Podfile. The first line should specify the platform and version supported: platform :ios, '8.0'
  • Add a line pod 'VoxImplantSDK'
  • Save your Podfile
  • Run pod install
  • Open the *.xcworkspace that was created. This should be the file you use everyday to create your app

Initializing SDK

Create an interface that conforms to the VoxImplantDelegate and invoke the following sequence:

[[VoxImplant getInstance] setVoxDelegate:yourDelegate];

This delegate will later receive all events from SDK, for example ones related to the connection itself, login status, calls and audio status.

Logging in

It's the same as using WebSDK: you need to connect to cloud

[[VoxImplant getInstance] connect];

As a result message onConnectionSuccessful or onConnectionFailedWithError will be sent to your delegate.

After connection is established, use login function to authenticate. For example, when you need to login user myuser to applcation myapp in your VoxImplant account named myaccount with password mypass

[[VoxImplant getInstance] loginWithUsername:@"myuser@myapp.myaccount.voximplant.com" andPassword:@"mypass"];

As a result onLoginSuccessfulWithDisplayName: or onLoginFailedWithErrorCode: message will be sent to your delegate

Making calls

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

  1. VoxImplant * sdk = [VoxImplant getInstance];
  2. activeCallId = [sdk createCall:_toLabel.text withVideo:FALSE andCustomData:@"App custom data (mobile)"];
  3. [sdk attachAudioTo:activeCallId];
  4. [sdk startCall:activeCallId withHeaders:nil];

Please note that call is actually initiated only when you call

[sdk startCall: withHeaders:]

Receiving calls

When application receives incoming call, onIncomingCall:From:Named:withHeaders: message is sent to your delegate. If you need to answer call, you need to use following code:

  1. VoxImplant * sdk = [VoxImplant getInstance];
  2. [sdk attachAudioTo:activeCallId];
  3. [sdk answerCall:activeCallId withHeaders:nil];

Handling audio interruptions

Audio interruption happens when an incoming call to iPhone arrives. If user answers call, application will be suspended and most likely will be disconnected from server because of timeout.

When audio interruption begins and ends, onAudioInterruptionBegan and onAudioInterruptionEnded messages are sent to delegate. Please note that after interruption ends, speakerphone and mute are disabled, so you need to reflect that in your interface or re-enable them manually.

For more information, please read our reference documentation.