With CONTUS MirrorFly Call SDK for iOS, you can easily add real-time call features to your client app within 30 minutes.
Through our client SDK, you can initialize and configure chat into your app with minimal efforts.
Note : If you're looking for the fastest way to build your app’s UI with MirrorFly Chat SDKs, you can use our sample apps. To get our sample apps, click here
The below are the requirements for call SDK for iOS,
- Xcode 14.1 or later
- iOS 12.1 or later
- Swift 5.0 or later
Skip this step if you are already having your license key.
To integrate MirrorFly Call SDK into your app, you will need a SDK License Key. The MirrorFly server will use this license key to authenticate the SDK in your application.
Step 1: Register here
Step 2: Login to your Account
Step 3: Get the License key from the
application Info’ section
Step 4: Download the iOS SDK
Step 1: Add the following ChatSDK pod to your Podfile. If pod hasn't been initialised yet means, create a Podfile by executing
pod init command.
Step 2: Add the below given pod hook code block at the end of the pod file and thus, finally install the pods by executing
pod install command.
Step 3 : Now, disable the bitcode for your project
Step 4: Now, enable all the below mentioned capabilities into your project.
Now, go to the background mode and enable the below given modes
|Voice over IP|
Step 5: Enable Audio and Video record permisions.
Provide Microphone and Camera usage description in the plist file of your project.
Now, configure the server details in SDK and access the data globally using the AppDelegate class.
To start using the sdk, there are a few basic pieces of data that must be made available for the SDKs to function perfectly.
Thus, we utilize the usage of the
initializeSDK function to validate the license key and to fetch critical data from server for SDK initialization.
Furthermore, in your project you must use the
AppDelegate class within the
didFinishLaunchingWithOptions method call the initialization method by passing the license key. Let's have a look at the example given below.
|LICENSE_KEY||Used to proceed with Registration|
The below method should be called to register a new user. This method will take care of both
Sandbox mode registration as well as
Live mode registration based on
isTrialLicense provided in the
Unless you logged out of a session, make sure that you have called the
Registration method only once in an application
Note: While registration, the below
registerApiServicemethod will accept the additional params required for notification processing on server and
IS_FORCE_REGISTERas an optional param for maintaining sessions,
USER_TYPEas an optional param to provide type of user and
META_DATAas an optional param to provide MetaData of user.
|USER_IDENTIFIER||Unique Id to Register the User. User identifiers can only contain lowercase alphanumeric characters, hyphens (-), and underscores (_).|
|APNS_DEVICE_TOKEN||Token to register APNS device (optional)|
|VOIP_DEVICE_TOKEN||Token to register VoIP device (optional)|
|USER_TYPE||Type of the user (optional)|
|META_DATA||list of key - value pair of metadata object. |
To know more about
IS_FORCE_REGISTER is false, and it reached the maximum no of multi-sessions then registration will not succeed it will throw a 405 exception, Either
IS_FORCE_REGISTER should be true or one of the existing session need to be logged out to continue registration.
After successful registration, call the below method to initialize the Call SDK.
Also call the above method in the AppDelegate's
didFinishLaunchingWithOptions with a condition of isLoggedin
or isUserId available logic based on your app.
In order to transfer the initial call data payload, we can make use of Chat server.Once Registration was successful, ChatSDK automatically attempts to connect to the Chat Server and ChatSDK also observe the changes in application state, and accordingly it will try to connect and disconnect the Chat Server.
The connection status can be observed and tracked by confirming the
ConnectionEventDelegate. To do that you need to set ‘delegate’ in your
viewDidAppear method like below.
ConnectionEventDelegate has been set, you will be able to receive the connection status in the delegate method as mentioned below.
To know more about
ConnectionEventDelegate visit ConnectionEvent Delegate
The below given are some of the common keyword/terminologies used in the Chat SDK with description
|userID/userBareID||Unique ID assigned for each user Ex: 12345678 (any alphanumeric). The below characters is not allowed in userId: U+0022 (") U+0026 (&) U+0027 (') U+002F (/) U+003A (:) U+003C (<) U+003E (>) U+0040 (@) userID should follow below specification: https://xmpp.org/extensions/xep-0106.html|
|userJid (or) JID||userID+@+domain of the chat server Ex. email@example.com|
|groupID/groupBareID||Unique ID assigned for each group Ex: group123456 (any alphanumeric). GroupJID = groupID +@mix.+domain of the chat server Ex: firstname.lastname@example.org`|
SDK here provides the built-in functions to prepare the JID and Group JID.
To observe Call events create and set a Singleton Class that conforms to the
CallManagerDelegate of FlyCall framework, and pass that object to the below method.
To set the Call UI that has to be presented during an outgoing call, call the below method. An instantiated view controller object has to be passed in the method.
|CALL_VIEW_CONTROLLER||A class that conforms to UIViewController|
Call SDK handles the UI presentation for an outgoing call. Call the below method after declaring the Call SDK and or before making a call.The below method sets the view on top of which the call ui will be presented.
|VIEW_TO_PRESENT||ViewController in which Call UI has to be presented.|
CallManager.setViewToPresentController is optional else the Call SDK will present the UI for an outgoing call in the project's root viewcontroller.
Almost all the sdk methods expect jid as a input parameter, so sdk provides below utility method to prepare the jid.
The method prepares the user's jid from the username which we get in the
Note: The below characters is not allowed in uniqueId: U+0022 (") U+0026 (&) U+0027 (') U+002F (/) U+003A (:) U+003C (<) U+003E (>) U+0040 (@).
|USER_NAME||String||unique username for preparing JID|
To make a one to one voice call, call the below method.
|USER_JID||Jid of another registered user|
To make and receive a voice/video call, Microphone and Camera usage permissions were required. Call SDK also provides method to check those permissions like
CallManager.isVideoCallPermissionsGranted(). We can also make use of these methods too.
If one to one call feature unavailable for your plan then it will throw 403 exception.
Since we are making use of Chat Server to transfer initial call payload from caller to callee. Once the above make call function was processed successfully. The following delegate method of CallManagerDelegate will be triggered. There we can make use of the ChatSDK method to send the initial calling payload to the callee.
Call SDK will take care of receiving and processing the received call payload and triggering the
CallKit if you are connected to the server in foreground state.
Once the CallKit is being presented with Accept/Reject Call buttons, we can either choose to attend or reject the call. If we attend the call the below method of the
CallManagerDelegate will be triggered, and the status wil be of the case
ATTENDED. Inside that method we can present the incoming call UI.
|CALLSTATUS||An enum class defines the current status of the call|
|USER_ID||For this |