From 13535fa2c4b0fbaed61fb0a7bc47626bcedd9f7e Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Tue, 10 Mar 2020 13:54:59 +0100 Subject: [PATCH] fix call not be ended --- Classes/CallManager.swift | 11 ++++++++++- Classes/LinphoneAppDelegate.m | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Classes/CallManager.swift b/Classes/CallManager.swift index d6162fc5b..a69344666 100644 --- a/Classes/CallManager.swift +++ b/Classes/CallManager.swift @@ -332,6 +332,11 @@ import AVFoundation } } + @objc func removeAllCallInfos() { + providerDelegate.callInfos.removeAll() + providerDelegate.uuids.removeAll() + } + // To be removed. static func configAudioSession(audioSession: AVAudioSession) { do { @@ -462,7 +467,11 @@ class CoreManager: CoreDelegate { if (CallManager.callKitEnabled()) { // end CallKit - let uuid = CallManager.instance().providerDelegate.uuids["\(callId!)"] + var uuid = CallManager.instance().providerDelegate.uuids["\(callId!)"] + if uuid == nil { + // the call not yet connected + uuid = CallManager.instance().providerDelegate.uuids[""] + } if (uuid != nil) { let transaction = CXTransaction(action: CXEndCallAction(call: uuid!)) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 1bcd094f7..d3873c0da 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -311,6 +311,7 @@ LOGI(@"%@", NSStringFromSelector(_cmd)); LinphoneManager.instance.conf = TRUE; linphone_core_terminate_all_calls(LC); + [CallManager.instance removeAllCallInfos]; // !!! Will be removed after push notification job finished // destroyLinphoneCore automatically unregister proxies but if we are using