This demo demonstrates CallKit integration with basic audio call functionality of the Voximplant iOS SDK . The application supports audio calls between this iOS app and other apps that use any Voximplant SDK.
CallKit lets you integrate your calling services with other call-related apps on the system.
CallKit provides the calling interface, and you handle the back-end communication with your VoIP service.
For incoming and outgoing calls, CallKit displays the same interfaces as the Phone app, giving your app a more native look and feel. And CallKit responds appropriately to system-level behaviors such as Do Not Disturb.
In addition to handling calls, you can provide a Call Directory app extension to provide caller ID information and a list of blocked numbers associated with your service.
The application is able to:
- log in to the Voximplant Cloud
- auto login using access tokens
- make an audio call
- receive an incoming call
- put a call on hold / take it off hold
- change an audio device (speaker, receiver, wired headset, bluetooth headset) during a call
- mute audio during a call
- send DTMF
- auto reconnect/relogin
- push notifications
- CallKit integration
-
Clone this repo
-
Open the
Swift.xcodeproj
workspace -
Target AudioCallKit and build the project using Xcode
Use the invite link to get access the latest builds and subscribe for the application updates.
To get started, you'll need to register a free Voximplant developer account.
You'll need the following:
- Voximplant application
- two Voximplant users
- VoxEngine scenario
- routing setup
- VoIP services certificate for push notifications. Follow this tutorial to upload the certificate to the Voximplant Control Panel
We've implemented a special template to enable you to quickly use the demo – just install SDK tutorial from our marketplace:
You can set up it manually using our Getting started guide and tutorials
require(Modules.PushService);
VoxEngine.addEventListener(AppEvents.CallAlerting, (e) => {
const newCall = VoxEngine.callUserDirect(
e.call,
e.destination,
e.callerid,
e.displayName,
null
);
VoxEngine.easyProcess(e.call, newCall, ()=>{}, true);
});
Log in using:
- Voximplant user name in the format
[email protected]
- password
After each successful login the demo app registers the VoIP push token via VIClient.registerVoIPPushNotificationsToken(voipToken:completion:)
See the following classes for code details:
CallManager.swift creates and stores CXProvider
that is responsible for reporting out-of-band call notifications that occur to the system:
- incoming call
- outgoing call connected
- call ended by the far-end
CXCallController
is used to report call events generated by the current user:
- MainViewController.swift uses
CXCallController
to report outgoing calls - CallViewController.swift uses
CXCallController
to requestCXTransactions
to change the call state (mute, hold, DTMFs, call end by the current user)
Enter a Voximplant user name to the input field and press "Call" button to make a call.
To make an outgoing call, MainViewController requests a CXStartCallAction
object from its CXCallController
object.
The action consists of a UUID to uniquely identify the call and a CXHandle
object to specify the recipient.
CallManager implements CXProviderDelegate
methods and processes CXStartCallAction
by creating VICall instance.
To receive an incoming call from the Voximplant Cloud, CallManager implements VIClientCallManagerDelegate and reports it to the CallKit using the reportNewIncomingCall(with:update:completion:)
method
See the following classes for code details:
It is possible to synchronize the call states (such as audio mute, hold, audio device change) between CallKit UI and application call view using CallKit CXCallController
and CXProvider
.
See the following classes for code details: