CallKit Integration (Beta)

iOS SDK works well with Apple CallKit framework. With Apple's CallKit framework, your VoIP apps can be integrated into iOS native calling experience.

Minimum Requirements

  • No minimum requirements

What is Apple CallKit framework?

CallKit is generally used when you want to support making and receiving VoIP calls in your audio/video app using iOS system-calling UI.

When one person calls another person, your backend can push a silent VoIP notification to the 'callee' on their iOS device using APNS (Apple Push Notification Service). You iOS VoIP app registers to listen for this notification using Apple's Pushkit framework. Upon receiving this notification, iOS calls your registered Pushkit delegate to handle the notification. You handle the VoIP notification by reporting an incoming call to the CallKit. CallKit shows the native incoming caller id screen for your app. Once user accepts the call, your CallKit delegate is called. At that point you join the meeting with the information in the notification payload.

func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) { if type == .voIP { let callId = extract from payload let room = extract from payload // Report the call to CallKit, and let it display the call UI. let handle = CXHandle(type: .generic, value: roomName) let update = CXCallUpdate() update.remoteHandle = handle provider.reportNewIncomingCall(with: callId, update: update, completion: { error in if let error = error { assertionFailure("Error reporting new incoming call: \(error.localizedDescription)") } }) } }

Similarly, when you make a call, you request a CXStartCallAction transaction on CXCallController. And the system will show the appropriate native UI feedback to the user about the current call. iOS will show a green icon on top when a Callkit call is active.

private let callController = CXCallController() func startCall(id: UUID, roomName: String) { let handle = CXHandle(type: .generic, value: roomName) let startCallAction = CXStartCallAction(call: id, handle: handle) startCallAction.isVideo = true let transaction = CXTransaction(action: startCallAction) callController.request(transaction) { error in if let error = error { assertionFailure("Error requesting CXStartCallAction transaction: \(error)") } } }

Does 100ms SDK provide special API's for CallKit?

There are no APIs specially for CallKit. You can use 100ms SDK with CallKit as usual, while keeping some things in mind about how CallKit's audio session works.

What to keep in mind when using 100ms SDK with CallKit?

CallKit coordinates your app's calling services with other apps and the system. CallKit activates a prioritised audio session specifically for your call. Any audio session activated prior to CallKit's audio session is nullfied. Any audio session activated after CallKit's audio session activation becomes part of the call's audio. You need to make sure that you join the call using 100ms SDK only after CallKit has activated the prioritised audio session. CallKit calls the following delegate to let you know when it has activated the audio session for your call:

func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession)

If you join the meeting before CallKit has activated the CallKit audio session, the audio session configured by 100ms SDK will be nullified, resulting in no audio in the call.


Have a suggestion? Recommend changes ->

Was this helpful?

1234