I want to develop an SOS application. When I am trying to use URL schema openURL(), it will display an alert but my requirement is to connect the call without any alert or popup while trying to call. So I found a solution using CallKit. When I implemented CallKit in my application it does not ask for any permission, the outgoing call is placed but the callee doesn't get any call. Is there any solution for this?
I have tried the following code for connecting the call.
@IBAction func buttonCallTapped(_ sender: Any) {
let provider = CXProvider(configuration: CXProviderConfiguration(localizedName: "My App"))
provider.setDelegate(self, queue: nil)
let controller = CXCallController()
let transaction = CXTransaction(action: CXStartCallAction(call: UUID(), handle: CXHandle(type: .phoneNumber, value: "\(number)")))
controller.request(transaction, completion: { error in })
DispatchQueue.main.asyncAfter(wallDeadline: DispatchWallTime.now() + 5) {
provider.reportOutgoingCall(with: controller.callObserver.calls[0].uuid, connectedAt: nil)
}
}
You just can't make standard native calls through CallKit. The CallKit framework, as clearly stated in the documentation, is meant to be used to develop custom VoIP applications and integrate them with the native phone interface.
Any iOS application can't make native call without user action.
An alert will be shown with phone number and two buttons will be available "Call" and "Cancel" which is presented from the OS level.
Just like we are showing popup to delete photos from Photos app.
If you want to implement SOS Application (Yes its possible using VoIP service), But you can place calls when app is active (Can be done without user action given internet connection is there.)
Note: The receiving side also should support VoIP.
We need permission of Voice over IP services to make calls in between iPhone devices.
VoIP app must have background mode enabled in the Xcode Project > Capabilities pane. Select the checkbox for Voice over IP
Also CallKit is indented only for VoIP Apps, If you really want to implement the VoIP follow CallKit Tutorial
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With