系统提供的呼叫屏幕上扬声器按钮的异常行为

Abnormal behavior of speaker button on system provided call screen

我们使用 CallKit 和 PortSIP 编写 VoIP 应用程序,这里的问题仅在 iOS 11.2.x 上重现。 当用户点击 CallKit 上的扬声器按钮时,屏幕系统会启用扬声器,但图标仍处于禁用状态。如果用户再次点击,系统也会打开扬声器并忘记按钮。要禁用扬声器用户应点击按钮两次。有人遇到过这个错误吗?你的解决方案是什么? (:

谢谢。

同样的问题在以前的版本中也遇到过。所以这不是呼叫套件上发生的新问题。

此问题必须从 iOS 解决。我们对此没有任何控制权。

    RTCDispatcher.dispatchAsync(on: RTCDispatcherQueueType.typeAudioSession) {
        let audioSession = RTCAudioSession.sharedInstance()
        audioSession.lockForConfiguration()
        let configuration = RTCAudioSessionConfiguration.webRTC()
        configuration.categoryOptions = [AVAudioSessionCategoryOptions.allowBluetoothA2DP,AVAudioSessionCategoryOptions.duckOthers,
                                         AVAudioSessionCategoryOptions.allowBluetooth]
        try? audioSession.setConfiguration(configuration)
        audioSession.unlockForConfiguration()
    }

它对我的 CallKit 有帮助。扬声器按钮按预期工作。