Rate this page:

iOS: CallKit

Voximplant integration with CallKit allows:

  • Displaying the system screen of an incoming call (also over third-party applications)

  • Displaying system screens of an active call or an unsuccessful call in case the phone is locked

  • Resolving the situation of multiple calls from various applications that also use CallKit API integration (switching between calls on hold, an incoming call when on a call)

  • Including call history

  • Raising the priority of the call session to the maximum, making the session uninterrupted by other applications which use audio

  • Taking into account the user’s blacklist settings, Do Not Disturb mode, Silent Mode, volume

  • Via a special mode when working with the connected audio devices (playing on all devices at the same time) to notify of an incoming call; the mode is inaccessible through the public API

You can try the demo right away.

Outbound call integration with CallKit API

Copy URL

In order to make an outgoing call, you need to initiate a custom action CXStartCallAction with the generated UUID and report this action to the CXCallController instance. You also need to create a similar CXStartCallAction if you are handling call creation through the standard Phone application of the Recent Calls tab or via Siri.

Preparing an outgoing call

Preparing an outgoing call

After that, you have to transfer control to the CXProviderDelegate.provider (_: perform :) method by CXStartCallAction. Now you need to:

  1. Create a VICall instance.
  2. Set the VICall.callKitUUID property from the CXStartCallAction that we process.
  3. Start a call with VICall.start and inform CallKit about the start of the call via the reportOutgoingCall (with: startedConnectingAt :) method.
Making an outgoing call

Making an outgoing call

When the call is established, the VICallDelegate.call (_: didConnectWithHeaders :) method is called. In the handler of this event, it is necessary to inform CallKit about the call status change for the corresponding system UI update.

Informing about the call status change

Informing about the call status change

  1. If you need to update the call information, create a CXCallUpdate object and use the CXProvider.reportCall method.
Updating the call information

Updating the call information

Inbound call integration with CallKit API

Copy URL

In this article, we do not cover the integration of CallKit and VoIP push notifications for incoming calls.

When an incoming call is received, control transfers to the delegate method VIClientCallManagerDelegate.client (_: didReceiveIncomingCall: withIncomingVideo: headers :), and the sequence of actions you should perform is as follows:

  1. Extract callKit UUID of the incoming call from the VICall instance.
  2. Retrieve the information about the caller from the VICall instance.
  3. Create a CXCallUpdate object and report on the new incoming call to the iOS call subsystem via the CallKit API.
Reporting on a new incoming call

Reporting on a new incoming call

The process of receiving a voice call looks like this:

Answering the call

Answering the call

The rest manipulations

Copy URL

All the user actions performed through the iOS call subsystem are presented in the form of descendant classes of CXAction. If the action is successful, you need to confirm it via the action.fulfill API. If an error occurred during the execution, reject it via the action.fail API.

Hold handling

Hold handling

Changing the audio session privileges with CallKit

Copy URL

The privileges of a call audio session escalate and de-escalate automatically when the iOS subsystem is using the CallKit API. It is necessary to forbid some other applications to interrupt the audio session. The call audio session itself crowds out other already active audio sessions (player and Siri, for example).

To ensure that the configuration of the Voximplant iOS SDK audio session does not conflict with the iOS audio privilege enhancement subsystem, it is extremely important to notify the Voximplant iOS SDK about the start and end of the audio session via a special API.

When starting the application, configure the audio session:

Configuring the audio session

Configuring the audio session

Inform the Voximplant iOS SDK about changing the audio session status by means of the callkitstartaudio and callkitstopaudio methods of the VIAudioManager:

Informing about the audio session status change

Informing about the audio session status change

See also

Copy URL