From 01bb34843d3e443ebf38ce3ecc471f91e8a02a38 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Mon, 29 Mar 2021 10:26:30 +0200 Subject: [PATCH] update callid for callkit --- Classes/CallManager.swift | 13 +++++++++++++ Classes/LinphoneManager.m | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/Classes/CallManager.swift b/Classes/CallManager.swift index e7835dfd1..bc898bb90 100644 --- a/Classes/CallManager.swift +++ b/Classes/CallManager.swift @@ -164,6 +164,19 @@ import AVFoundation } } } + + @objc func updateCallId(previous: String, current: String) { + let uuid = CallManager.instance().providerDelegate.uuids["\(previous)"] + if (uuid != nil) { + CallManager.instance().providerDelegate.uuids.removeValue(forKey: previous) + CallManager.instance().providerDelegate.uuids.updateValue(uuid!, forKey: current) + let callInfo = providerDelegate.callInfos[uuid!] + if (callInfo != nil) { + callInfo!.callId = current + providerDelegate.callInfos.updateValue(callInfo!, forKey: uuid!) + } + } + } // From ios13, display the callkit view when the notification is received. @objc func displayIncomingCall(callId: String) { diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 118eca70f..364caee4a 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1038,6 +1038,9 @@ static void linphone_iphone_call_log_updated(LinphoneCore *lc, LinphoneCallLog * } } +static void linphone_iphone_call_id_updated(LinphoneCore *lc, const char *previous_call_id, const char *current_call_id) { + [CallManager.instance updateCallIdWithPrevious:[NSString stringWithUTF8String:previous_call_id] current:[NSString stringWithUTF8String:current_call_id]]; +} #pragma mark - Message composition start - (void)onMessageComposeReceived:(LinphoneCore *)core forRoom:(LinphoneChatRoom *)room { [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneTextComposeEvent @@ -1320,6 +1323,7 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat linphone_core_cbs_set_version_update_check_result_received(cbs, linphone_iphone_version_update_check_result_received); linphone_core_cbs_set_qrcode_found(cbs, linphone_iphone_qr_code_found); linphone_core_cbs_set_call_log_updated(cbs, linphone_iphone_call_log_updated); + linphone_core_cbs_set_call_id_updated(cbs, linphone_iphone_call_id_updated); linphone_core_cbs_set_user_data(cbs, (__bridge void *)(self)); theLinphoneCore = linphone_factory_create_shared_core_with_config(factory, _configDb, NULL, [kLinphoneMsgNotificationAppGroupId UTF8String], true);