Search code examples
iosvoipcallkit

VOIP outgoing call from native call UI


Whenever I receive incoming call in my VOIP application I can see the logs on my native iPhone call UI.

I wanted to make outgoing call from native iPhone callog of UI by clicking last incoming call. Like it works for WhatsApp , Skype , hangout etc.

How is it possible for outgoing call ?

Below are the methods I wrote for incoming call :

-(void)reportIncomingCall:(NSUUID*)UDID handle:(NSString*)handle;
-(CXCallController*)startCall:(NSUUID*)UDID handle:(NSString*)handle
-(void)connectCallWithCallController:(CXCallController*)controller

I know there is one more method for outgoing call.But I don't know when to call this:

- (NSUUID *)reportOutgoingCallContactIdentifier:(NSString *)identifier destination:(NSString *)name telNumber:(NSString *)telnum 

Solution

  • When tapping on an item in the native iOS Call log, the application delegate's continueUserActivity function is called. My implementation looks something like this in Swift:

    func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
    
        self.startCallHandle = userActivity.startCallHandle
        // Cache call handle here, and make call using cached call handle 
        // when applicationDidBecomeActive is called
    
        return true
    
    }
    

    startCallHandle is defined in file NSUserActivity+StartCallConvertible.swift, as seen in the SpeakerBox sample project.

    In your app's Info.plist, you must have INStartAudioCallIntent and/or INStartVideoCallIntent. Once again, see the SpeakerBox example app for details.