Twilio语音通话不会转到IOS中的自定义页面

问题描述

我将Twilio用于IOS应用程序中的语音呼叫功能。如果应用程序处于活动状态或在后台运行,则可以完美地转到我的自定义调用页面,我可以从自定义页面采取适当的操作,例如断开连接或其他操作。但是,在处于非活动状态或不在后台运行的情况下,它不会进入自定义呼叫页面,或者无法执行从此处断开的操作。请在这里建议我所缺少的内容

func pushRegistry(_ registry: PKPushRegistry,didReceiveIncomingPushWith payload: PKPushPayload,for type: PKPushType,completion: @escaping () -> Void) {
        NSLog("pushRegistry:didReceiveIncomingPushWithPayload:forType:completion:")
        
        // The Voice SDK will use main queue to invoke `cancelledCallInviteReceived:error:` when delegate queue is not passed
        
        if let rootViewController = UIApplication.topViewController() {

            let nextViewController = UIStoryboard(name: “Voice”,bundle: nil).instantiateViewController(withIdentifier: “VoiceCallViewController”)
            audioDevice = DefaultAudioDevice()
            callKitCallController = CXCallController()
            audioDevice.isEnabled = false
            audioDevice.block()
            nextViewController.audioDevice = audioDevice
            TwilioVoice.audioDevice = audioDevice
            nextViewController.fromAppDelegate = true
            nextViewController.callKitProvider = callKitProvider
            nextViewController.callKitCallController = callKitCallController
            callKitProvider!.setDelegate(nextViewController,queue: nil)
            self.pushKitEventDelegate = nextViewController
            
            if let delegate = self.pushKitEventDelegate {
                delegate.incomingPushReceived(payload: payload,completion: completion)
                rootViewController.navigationController?.pushViewController(nextViewController,animated: true)
            }
            
            if let version = Float(UIDevice.current.systemVersion),version >= 13.0 {
                /**
                 * The Voice SDK processes the call notification and returns the call invite synchronously. Report the incoming call to
                 * CallKit and fulfill the completion before exiting this callback method.
                 */
                completion()
            }
        }
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)