0

I'm creating a flutter plugin to make WebRTC calls using the Twilio API. On the iOS side I use CXProvider and CallKit to make/receive calls. My problem is, the native call screen UI is always launched in the background and my Flutter app stay on the front.

Here a demo video :

I really don't understand this behavior.

This is how I display the incoming notification

    func reportIncomingCall(from: String, uuid: UUID) {
        let callHandle = CXHandle(type: .generic, value: from)

        let callUpdate = CXCallUpdate()
        callUpdate.remoteHandle = callHandle
        callUpdate.localizedCallerName = from
        callUpdate.supportsDTMF = true
        callUpdate.supportsHolding = true
        callUpdate.supportsGrouping = false
        callUpdate.supportsUngrouping = false
        callUpdate.hasVideo = false

        // this display the callInvite UI
        self.callKitProvider.reportNewIncomingCall(with: uuid, update: callUpdate) { error in
            if let error = error {
                print("error", error as Any)
            }
        }
    }

This is how I answer a call from the native side

    func performAnswerVoiceCall(uuid: UUID, completionHandler: @escaping (Bool) -> Swift.Void) {
        if let ci = self.twilioVoiceDelegate!.callInvite {
            let acceptOptions: AcceptOptions = AcceptOptions(callInvite: ci) { (builder) in
                builder.uuid = ci.uuid
            }
            
                let theCall = ci.accept(options: acceptOptions, delegate: self.twilioVoiceDelegate!)
                self.twilioVoiceDelegate!.call = theCall
                self.twilioVoiceDelegate!.callCompletionCallback = completionHandler
                self.twilioVoiceDelegate!.callInvite = nil
        }
    }

If anyone has a suggestion, It will be a pleasure

Pierre Monier
  • 599
  • 2
  • 9

1 Answers1

-2

That's is how CallKIt works. Try to receive a call using WhatsApp on iOS. You get the same behavior

FedeX699
  • 7
  • 3
  • If you look at the video, it's clearly not the wanted behavior. It's not what happen when you receive a call on WhatsApp for example. – Pierre Monier Feb 19 '22 at 13:58