Search code examples
iosswiftvoipurl-schemecallkit

iOS - Trigger outgoing VOIP Call on clicking the caller in the native iOS Recent call table view


I have implemented the CallKit for my App to trigger/receive both Audio and Video Call within our App by using WebRTC. Which is working seamlessly without any problem.

As I see there are 3 ways to trigger a call from Call Kit.

  1. Performing an interaction within the app
  2. Opening a link with a supported custom URL scheme
  3. Initiating a VoIP call using Siri

As of now, I don't have any requirement to initiate the call using Siri but we need to initiate the call when the user clicks on any cell in the native iOS Recent calls screen which then routes to our application and triggers the out going call.

And also our app contains few metadata when user calls the other user such as receiverID etc.. So when the user misses the call from the other user, I need to store this meta data and I need to trigger a call when user clicks on missed call list of iOS Recent call screen using all those metadata.

I was going through the Sample App for CallKit "Speakerbox" provided by Apple. And I found that they are using custom URL scheme just like what we use for DeepLinking of iOS apps.

So I need few suggestion whether this can be achieved using URL scheme and If so, How can I store the metadata ( custom object ) in CXHandle object.


Solution

  • Pasting the same answer here from me: Refer

    Verify the remoteHandle and supportedHandleTypes, both should be similar as per your requirement.

    callUpdate.remoteHandle = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:[NSString stringWithFormat:@"%@", phoneno]];
    configuration.supportedHandleTypes = [NSSet setWithObjects:[NSNumber numberWithInteger:CXHandleTypeGeneric],[NSNumber numberWithInteger:CXHandleTypePhoneNumber], nil];
    

    If the handles mismatches, you can't able to process the NSUserActivity.

    Implement this method to get callback,

    - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray * _Nullable))restorationHandler {}