CallKit :- Callkit is working but the callee doesn't get the call
Asked Answered
K

2

6

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)
    }
}
Kandykane answered 6/2, 2020 at 11:33 Comment(0)
B
1

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.

Solution

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.

How to Implement 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

Burger answered 3/3, 2020 at 13:16 Comment(0)
B
2

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.

Banjo answered 6/2, 2020 at 14:32 Comment(0)
B
1

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.

Solution

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.

How to Implement 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

Burger answered 3/3, 2020 at 13:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.