Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hold callkit call when incoming cellular call

Tags:

ios

swift

callkit

I have a problem (but not really) with callkit.

I implemented callkit in my app and it works great. I can get a second call to my app and callkit offeres me options to End&Accept, Decline or Hold&Accept. Same goes if I am in a cellular (gsm) call and I get a call on my app. But when I am in app call (on callkit) and get a cellular(gsm) call I only get 2 options: Decline or End&Accept.

Any idea why? Or how I can get all 3 options?

static var providerConfiguration: CXProviderConfiguration {

    var providerConfiguration: CXProviderConfiguration
    providerConfiguration = CXProviderConfiguration(localizedName: "app name")

    providerConfiguration.supportsVideo = false
    providerConfiguration.maximumCallsPerCallGroup = 1
    providerConfiguration.maximumCallGroups = 3
    providerConfiguration.supportedHandleTypes = [.phoneNumber]
    return providerConfiguration
}

I have implemented:

providerDidReset, 
CXStartCallAction, 
CXAnswerCallAction, 
CXEndCallAction, 
CXSetHeldCallAction, 
CXSetMutedCallAction, 
timedOutPerforming action, 
didActivate audioSession, 
didDeactivate audioSession.

In my app delegate I have function that checks useractivity. I put breakpoints in all of the functions but nothing gets called before the view for incoming cellular (gsm) call is shown.

I googled but couldn't find the solution. As far as I can see, callkit is working perfectly.

like image 612
Redssie Avatar asked Aug 09 '18 10:08

Redssie


People also ask

How CallKit works?

When a PushKit notification indicates an incoming call, you generate an appropriate action. CallKit handles the action by presenting the system interface for answering the call. Receive incoming Voice-over-IP (VoIP) push notifications and use them to display the system call interface to the user.

How do I stop CallKit?

A user can disable CallKit integration on their device by tapping their avatar, selecting Settings, and then toggling Mobile Integration to off (default is on).

What is iOS call integration?

iOS Call Integration shows Telegram calls on the lock screen and in the system's call history. If iCloud sync is enabled, your call history is shared with Apple. 161/161. iOS Call Integration shows Telegram calls on the lock screen and in the system ' s call history.


1 Answers

I struggled with this for outgoing calls. For outgoing calls, make sure you call this method for the call once it is answered by the remote side:

[self.provider reportOutgoingCallWithUUID:currentCall.uuid connectedAtDate:[NSDate date]];

If you do not, the call is stuck "connecting" from CallKit's perspective and I have found that the native incoming call UI for other calls will not provide the "send to voicemail" and "hold and accept" options for incoming calls while another call is "connecting".

I struggled with this for a bit today until I figured that part out. I also am calling:

 [self.provider reportOutgoingCallWithUUID:currentCall.uuid startedConnectingAtDate:[NSDate date]];

from within:

- (void)provider:(CXProvider *)provider performStartCallAction:(CXStartCallAction *)action

Not sure if that part is necessary but I'm doing it because that's what the Speakerbox demo does. Kind of, they do it in a callback... I just do it immediately.

like image 148
Chad Barbe Avatar answered Sep 21 '22 14:09

Chad Barbe