1

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.

i70ro
  • 111
  • 8

2 Answers2

5

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 {}

Community
  • 1
  • 1
RJV Kumar
  • 2,408
  • 1
  • 19
  • 28
  • does this only work if the remoteHandle is the phone number? What if the remote handle is a string with the person's name? – Rohit Sharma May 20 '19 at 17:09
  • @RohitSharma I have the same question, in my case, a call can come to my app with name(registered user) or phone number(non registered user) as CallerId. So how can i get phone number when they start their call by tapping on name from recent call? – SoftSan Jul 01 '21 at 14:35
0

for Swift 5 you should define continueuserActivity function to SceneDelegate.swift like below

   func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
 
        let interaction = userActivity.interaction
        if let startAudioCallIntent = interaction?.intent as? INStartAudioCallIntent{
    
            let contact = startAudioCallIntent.contacts?.first
        
            let contactHandle = contact?.personHandle

                if let phoneNumber = contactHandle?.value {
                   print(phoneNumber)
                   // Your call logic
                }
     
        }
        return
    }

please refer this answer

Bilal Şimşek
  • 5,453
  • 2
  • 19
  • 33