fix workaround for incoming call

This commit is contained in:
Danmei Chen 2020-10-12 11:31:06 +02:00
parent daf5fba2d0
commit 244d580bf8

View file

@ -174,15 +174,19 @@ extension ProviderDelegate: CXProviderDelegate {
Log.directLog(BCTBX_LOG_MESSAGE, text: "CallKit: answer call with call-id: \(String(describing: callId)) and UUID: \(uuid.description).")
let call = CallManager.instance().callByCallId(callId: callId)
// workaround
CallManager.configAudioSession(audioSession: AVAudioSession.sharedInstance())
if (call == nil || call?.state != Call.State.IncomingReceived) {
// The application is not yet registered or the call is not yet received, mark the call as accepted. The audio session must be configured here.
CallManager.configAudioSession(audioSession: AVAudioSession.sharedInstance())
callInfo?.accepted = true
callInfos.updateValue(callInfo!, forKey: uuid)
CallManager.instance().providerDelegate.endCallNotExist(uuid: uuid, timeout: .now() + 10)
} else {
CallManager.instance().acceptCall(call: call!, hasVideo: call!.params?.videoEnabled ?? false)
}
Log.directLog(BCTBX_LOG_MESSAGE, text: "CallKit: answer call finished.")
action.fulfill()
}