From ca38aaa90ad21f3cf3993c53ca8f966d21591122 Mon Sep 17 00:00:00 2001 From: Paul Cartier Date: Fri, 20 Mar 2020 16:13:44 +0100 Subject: [PATCH] update call terminate --- Classes/CallManager.swift | 4 ++-- Classes/LinphoneManager.m | 1 - Classes/ProviderDelegate.swift | 10 +++------- Classes/Utils/Log.m | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Classes/CallManager.swift b/Classes/CallManager.swift index 1b58a7b86..8586492c7 100644 --- a/Classes/CallManager.swift +++ b/Classes/CallManager.swift @@ -350,7 +350,7 @@ import AVFoundation } } - @objc func terminateCall(call: OpaquePointer?) { // TODO PAUL : needs to be tested with CallKit changes + @objc func terminateCall(call: OpaquePointer?) { if (call == nil) { Log.directLog(BCTBX_LOG_ERROR, text: "Can not terminate null call!") return @@ -360,7 +360,7 @@ import AVFoundation try call.terminate() Log.directLog(BCTBX_LOG_DEBUG, text: "Call terminated") } catch { - Log.directLog(BCTBX_LOG_ERROR, text: "Failed to terminate call") + Log.directLog(BCTBX_LOG_ERROR, text: "Failed to terminate call failed because \(error)") } if (UIApplication.shared.applicationState == .background) { CoreManager.instance().stopIterateTimer() diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 1c21da964..ab172ef6c 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -2135,7 +2135,6 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { return [documentsPath stringByAppendingPathComponent:file]; } -// TODO PAUL : fonctions a enlever + (NSString *)preferenceFile:(NSString *)file { LinphoneFactory *factory = linphone_factory_get(); NSString *fullPath = [NSString stringWithUTF8String:linphone_factory_get_config_dir(factory, kLinphoneMsgNotificationGroupId.UTF8String)]; diff --git a/Classes/ProviderDelegate.swift b/Classes/ProviderDelegate.swift index 867ac0d78..196e77fc7 100644 --- a/Classes/ProviderDelegate.swift +++ b/Classes/ProviderDelegate.swift @@ -143,13 +143,9 @@ extension ProviderDelegate: CXProviderDelegate { callInfos.removeValue(forKey: uuid) let call = CallManager.instance().callByCallId(callId: callId) - if (call != nil) { - do { - try call!.terminate() // TODO PAUL - Log.directLog(BCTBX_LOG_MESSAGE, text: "CallKit: Call ended with call-id: \(String(describing: callId)) an UUID: \(uuid.description).") - } catch { - Log.directLog(BCTBX_LOG_ERROR, text: "CallKit: Call ended \(uuid) failed because \(error)") - } + if let call = call { + CallManager.instance().terminateCall(call: call.getCobject); + Log.directLog(BCTBX_LOG_MESSAGE, text: "CallKit: Call ended with call-id: \(String(describing: callId)) an UUID: \(uuid.description).") } action.fulfill() } diff --git a/Classes/Utils/Log.m b/Classes/Utils/Log.m index de43ec33a..dfbecaab5 100644 --- a/Classes/Utils/Log.m +++ b/Classes/Utils/Log.m @@ -48,7 +48,7 @@ asl_add_log_file(NULL, STDERR_FILENO); stderrInUse = YES; } - linphone_core_set_log_collection_path([LinphoneManager cacheDirectory].UTF8String); // TODO PAUL : code de migration des logs? + linphone_core_set_log_collection_path([LinphoneManager cacheDirectory].UTF8String); linphone_core_set_log_handler(linphone_iphone_log_handler); linphone_core_enable_log_collection(enabled); if (level == 0) {