12

I'm developing an iOS voip app using Callkit and Linphone. When I receive a incoming call, system shows the native phone UI to user accept or decline de call, whe the user taps accept button the call starts but de phone UI dissapear.

How can I keep native phone UI after user accept the call, like whatsapp do?

Also, how can I show the native phone UI when start a outgoing call?

Here's my providerDelegate code:

func reportIncomingCall(uuid: UUID, handle: String, hasVideo: Bool = false, completion: ((NSError?) -> Void)? = nil) {
    // Construct a CXCallUpdate describing the incoming call, including     the caller.
    let update = CXCallUpdate()
    update.remoteHandle = CXHandle(type: .generic, value: handle)
    update.hasVideo = hasVideo

    // Report the incoming call to the system
    provider.reportNewIncomingCall(with: uuid, update: update) { error in
        /*
         Only add incoming call to the app's list of calls if the call was allowed (i.e. there was no error)
         since calls may be "denied" for various legitimate reasons. See CXErrorCodeIncomingCallError.
         */
        if error == nil {
            print("calling")

        }
    }
}

func provider(_ provider: CXProvider, perform action: CXStartCallAction) {
    let update = CXCallUpdate()
    update.remoteHandle = action.handle

    provider.reportOutgoingCall(with: action.uuid, startedConnectingAt: Date())
    NotificationCenter.default.post(name: NSNotification.Name(rawValue: "callStart"), object: self, userInfo: ["uuid":action.uuid])
    action.fulfill(withDateStarted: Date())

}

func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
    NotificationCenter.default.post(name: NSNotification.Name(rawValue: "callStart"), object: self, userInfo: ["uuid":action.uuid])

    // ACCEPT CALL ON SIP MANAGER
    if let voiceCallManager = AppDelegate.voiceCallManager {
        voiceCallManager.acceptCall()
    }

    action.fulfill(withDateConnected: Date())

}
Charles Lima
  • 381
  • 4
  • 9

1 Answers1

22

You can't keep native UI after accept the incoming call. And Whatsapp use their own UI, that is similar to native UI.

When you have iPhone locked and you accept an incoming call it won't show you APP UI. But if iPhone is unlocked and you accept an incoming call iPhone will open your app, and you must show your phone UI.

And for outgoing calls you can't show native phone UI, it will show if you receive an call.

Therefor, you need a custom phone UI for outgoing and established calls.

AntonioM
  • 655
  • 9
  • 16