end call when registration failed

This commit is contained in:
Danmei Chen 2021-06-29 20:12:08 +02:00
parent ed0fe3bb69
commit 7936214997

View file

@ -92,9 +92,10 @@ class ProviderDelegate: NSObject {
provider.reportNewIncomingCall(with: uuid, update: update) { error in
if error == nil {
if CallManager.instance().endCallkit {
CallManager.instance().providerDelegate.endCall(uuid: uuid)
} else {
CallManager.instance().providerDelegate.endCallNotExist(uuid: uuid, timeout: .now() + 20)
let call = CallManager.instance().lc?.getCallByCallid(callId: callId!)
if (call?.state == .PushIncomingReceived) {
try? call?.terminate()
}
}
} else {
Log.directLog(BCTBX_LOG_ERROR, text: "CallKit: cannot complete incoming call with call-id: [\(String(describing: callId))] and UUID: [\(uuid.description)] from [\(handle)] caused by [\(error!.localizedDescription)]")