Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Callkit be used with non-voip call to get the call states in ios?

I have read the question about making a-non-voip-call and it seems, that the open url is the only way to do it. Since CoreTelephony is deprecated, is it possible to use Callkit to get the call states when making a call with open url? If not is there any way to get the call states programmatically? I am developing an in-house-app.

How can CallKit be used to make a non-voip call?

Thanks in advance!!

like image 250
some.ios.developer Avatar asked Mar 02 '17 14:03

some.ios.developer


People also ask

What is CallKit iOS?

Apple's CallKit is a framework introduced with iOS 10. It gives users the ability to handle VoIP calls from third party apps, such as Skype, similar to how they would handle a system phone call.

How to implement CallKit in iOS swift?

The way to implement this is with PushKit. Go to the Apple Developer website, and login. Create an App ID, and make sure to specify the Bundle ID and check Push Notifications . Create a new certificate and select VoIP Services Certificate .

What is CallKit integration?

CallKit integrates VoIP services with other call-related apps on the Apple device, using the same native interface, making it easier for users as they use the same dialer for all calls. However, it's not plain sailing and CallKit does have its limitations.


1 Answers

To get call states in CallKit, you can use CXCallObserver in your app.

import CallKit

final class ProviderDelegate: NSObject, CXCallObserverDelegate { 
var callObserver: CXCallObserver!

func setupCallObserver(){
callObserver = CXCallObserver()
callObserver.setDelegate(self, queue: nil)
}

func callObserver(_ callObserver: CXCallObserver, callChanged call: CXCall) {
        if call.hasEnded == true {
            print("CXCallState :Disconnected")
        }
        if call.isOutgoing == true && call.hasConnected == false {
            print("CXCallState :Dialing")
        }
        if call.isOutgoing == false && call.hasConnected == false && call.hasEnded == false {
            print("CXCallState :Incoming")
        }

        if call.hasConnected == true && call.hasEnded == false {
            print("CXCallState : Connected")
        }
    }
}
like image 130
Krishna Kumar Thakur Avatar answered Oct 04 '22 22:10

Krishna Kumar Thakur