Let's integrate our SDK in few minutes

Getting started#
Download SDK Files
Download

Audio/Video Call SDKs for iOS#

Requirements#

  • iOS 12.1 and above

Installation#

The SDK is already compiled into a Framework. To use the SDK, the below frameworks has to be imported into the project.

STEPS:

  1. Create a new iOS project or Open a existing project
  2. Add the following frameworks to the project
  • FlyCall.framework
  • FlyCommon.framework
  • FlyNetwork.framework
  1. Add the following dependencies in podfile.
    target 'FlyCall' do
    use_frameworks!
    pod 'libPhoneNumber-iOS', '~> 0.8'
    pod 'SocketRocket'
    pod 'Socket.IO-Client-Swift', '~> 15.2.0'
    pod 'GoogleWebRTC'
    pod 'Floaty', '~> 4.2.0'
    pod 'AlamofireImage', '~> 4.1'
    end

Initial setup#

SDK requires some initial configurations to be set in your application class. Initialize the below CallSDK builder in your app's AppDelegate's didFinishLaunchingWithOptions method

try! CallSDK.Builder.setUserId("USER_ID")
.setDomainBaseUrl("BASE_URL")
.setSignalSeverUrl("SIGNAL_SERVER_URL")
.setJanusSeverUrl("JANUS_SERVER_URL")
.setAppGroupContainerID("APP_GROUP_ID")
.setICEServersList("ICE_SERVER_LIST")
.setCallDelegate("CALLMANAGER_DELEGATE")
.setCallViewController("CALL_VIEW_CONTROLLER")
.buildAndInitialize()
ArgumentTypeDescription
USER_IDStringUnique Id of the User
BASE_URLStringBase url for API Service
SIGNAL_SERVER_URLStringURL of the Signal Server
JANUS_SERVER_URLStringURL of the Janus Server
APP_GROUP_IDStringId of the app group
ICE_SERVER_LIST[RTCIceServer]Ice servers list( STUN,TURN)
CALLMANAGER_DELEGATECallManagerDelegateDelegate provided by the call sdk
CALL_VIEW_CONTROLLERUIViewControllerViewController which needs to be presented during outgoing call.
var iceServerList = [RTCIceServer]()
let iceServer = RTCIceServer.init(urlStrings: ["SERVER_URL"], username: "SERVER_USERNAME", credential: "SERVER_PASSWORD")
iceServerList.append(iceServer)

Note:

  • RTCIceServer is the class on GoogleWebrtc. Pass an array of RTCIceServers in ICE_SERVERS_LIST(STUN and TURN servers)
info

Call the above builder after the unique user id is available and in the AppDelegate's didFinishLaunchingWithOptions with a condition of isLoggedin or isUserId available logic based on your app.

App Capabilities#

Call SDK also requires the application to enable the below capabilities for voip calls to function seamlessly without any issues.

Capabilities
Audio,Airplay, and Picture in Picture
Voice over IP
Background fetch
Remote notifications

Push and Voip Notifications#

To receive calls in the background and in killed state, kindly register for remote as well for voip notification by conforming to the following delegates in the AppDelegate UNUserNotificationCenterDelegate PKPushRegistryDelegate. Call the below methods when an APNS token or VOIP token gets updated.

// APNS Token Update
VOIPManager.sharedInstance.saveAPNSToken(token: token)
VOIPManager.sharedInstance.updateDeviceToken()
//VOIP Token Update
VOIPManager.sharedInstance.saveVOIPToken(token: deviceTokenString)
VOIPManager.sharedInstance.updateDeviceToken()
ArgumentDescription
TOKENApns or Voip Token

In class that extends the UNNotificationServiceExtension after validating whether the received payload is for call or not, call the below method to process the call further.

NotificationExtensionSupport.shared.didReceiveNotificationRequest("NOTIFICATION_CONTENT", "COMPLETION_BLOCK")
ArgumentTypeDescription
NOTIFICATION_CONTENTUNMutableNotificationContentNotification request content
COMPLETION_BLOCK(UNMutableNotificationContent?) -> VoidCompletion Block

Send the payload received through VOIP from the method didReceiveIncomingPushWith to the method below to process the call further.

VOIPManager.sharedInstance.processPayload("PAYLOAD")
ArgumentDescription
PAYLOADPayload Dictionary

Registration#

To register a new user use the below method,

FlyNetworkController.shared.registerApiService(userIdentifer: USER_IDENTIFIER, deviceToken: APNS_TOKEN, voipDeviceToken: VOIP_TOKEN) { isSuccess, flyError, flyData in
if success {
// success block goes here
}
else {
// error block goes here
}
}
ArgumentTypeDescription
USER_IDENTIFIERStringUnique Id to Register the User
APNS_TOKENStringAPNS device token
VOIP_TOKENStringVOIP Push device token

App Group Id#

In order to access data between app and notification extension, enabling app group is mandatory, and a group container id is necessary for call sdk to function properly.

CallManager.setAppGroupContainerId(id: "APP_GROUP_ID")
ArgumentDescription
APP_GROUP_IDId of the application App group
info

Sets the group container id in AppDelegate's didFinishLaunchingWithOptions method and in the didReceive methods of the class that extends UNNotificationServiceExtension before calling any other Call SDK methods even before the Call SDK Builder method.

Presenting the call UI#

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.

CallManager.setViewToPresentController("VIEW_TO_PRESENT")
ArgumentDescription
VIEW_TO_PRESENTViewController in which Call UI has to be presented.