我正在将 CallKit 与 VOIP 应用集成。我能够拨入和拨出电话。我遵循了以下步骤:
- 配置 Audio Session
- 在(didActivate)中启动音频
- 在(didDeActivate)中停止音频
我已经实现了 DTMF 提供商委托(delegate)的回调,如下所示:
func provider(_ provider: CXProvider, perform action: CXPlayDTMFCallAction) {
print("Provider - CXPlayDTMFCallAction")
let dtmfDigts:String = action.digits
for (index, _) in dtmfDigts.characters.enumerated() {
let dtmfDigit = dtmfDigts.utf8CString[index]
print("Processing dtmfDigit:\(dtmfDigit)" )
self.softphone.dtmf(on:dtmfDigit)
}
self.softphone.dtmfOff()
// Signal to the system that the action has been successfully performed.
action.fulfill()
}
我在通话过程中按 native 通话 UI 上的数字时听不到按键音,即本地 dtmf 声音。
来自 https://developer.apple.com/reference/callkit/cxplaydtmfcallaction :
"CallKit automatically plays the corresponding DTMF frequencies for any digits transmitted over a call. The app is responsible for managing the timing and handling of digits as part of fulfilling the action."
这是已知问题还是 callkit 不播放本地 dtmf 按键音?
最佳答案
当按下 native 通话 UI 的“键盘”按钮中的键时,CallKit 应该在本地播放 DTMF 音调。但是 CallKit 应用程序负责通过其自己的网络接口(interface)将 DTMF 音发送到远程端。
如果您在 native 通话 UI 中听不到本地播放的音调,请 report a bug给苹果。
关于ios10 - CXPlayDTMFCallAction 不播放本地 dtmf 声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41132445/