From 5f993b9dbc31633101b1141da25232868bbd45d4 Mon Sep 17 00:00:00 2001 From: Christophe Deschamps Date: Thu, 27 Apr 2017 19:03:35 +0200 Subject: [PATCH] Handle reporting Call termination to CallKit for calls that have changed call-id during call --- Classes/LinphoneManager.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 4a251f73a..35dac44fd 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -899,6 +899,16 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char [LinphoneManager.instance.providerDelegate.controller requestTransaction:tr completion:^(NSError *err){ }]; + } else { // Can happen when Call-ID changes (Replaces header) + if (linphone_core_get_calls_nb(LC) == 0) { // Need to clear all CK calls + for(NSUUID *myUuid in self.providerDelegate.calls) { + [self.providerDelegate.provider reportCallWithUUID:myUuid + endedAtDate:NULL + reason:(state == LinphoneCallError ? CXCallEndedReasonFailed : CXCallEndedReasonRemoteEnded)]; + } + [self.providerDelegate.uuids removeAllObjects]; + [self.providerDelegate.calls removeAllObjects]; + } } } else { if (data != nil && data->notification != nil) {