From 1075515bb9eae2cec3f535cdaee84b551745be9c Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Fri, 25 Jan 2019 17:37:26 +0100 Subject: [PATCH] fix crash of call --- Classes/PhoneMainView.m | 9 ++++----- Classes/ProviderDelegate.m | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index c5bc9847b..f712e52f0 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -422,11 +422,10 @@ static RootViewManager *rootViewManagerInstance = nil; } else { linphone_call_resume((LinphoneCall *)calls->data); while (calls) { - if (linphone_call_get_state((LinphoneCall *)calls->data) == LinphoneCallIncomingReceived || - linphone_call_get_state((LinphoneCall *)calls->data) == LinphoneCallIncomingEarlyMedia) { - [self displayIncomingCall:(LinphoneCall *)calls->data]; - break; - } + if (calls->next) { + [self changeCurrentView:CallView.compositeViewDescription]; + break; + } calls = calls->next; } if (calls == NULL) { diff --git a/Classes/ProviderDelegate.m b/Classes/ProviderDelegate.m index f3ea9e319..ed8bc0227 100644 --- a/Classes/ProviderDelegate.m +++ b/Classes/ProviderDelegate.m @@ -112,7 +112,7 @@ return; self.callKitCalls++; - [self setPendingCall:call]; + self.pendingCall = call; } - (void)provider:(CXProvider *)provider performStartCallAction:(CXStartCallAction *)action { @@ -129,6 +129,7 @@ call = [LinphoneManager.instance callByCallId:callID]; } if (call != NULL) { + self.callKitCalls++; self.pendingCall = call; } } @@ -243,7 +244,7 @@ } } - self.pendingCall = NULL; + [self setPendingCall:NULL]; if (_pendingAddr) linphone_address_unref(_pendingAddr); _pendingAddr = NULL; @@ -251,9 +252,8 @@ } - (void)provider:(CXProvider *)provider didDeactivateAudioSession:(nonnull AVAudioSession *)audioSession { - LOGD(@"CallKit: Audio session deactivated"); - - self.pendingCall = NULL; + LOGD(@"CallKit : Audio session deactivated"); + [self setPendingCall:NULL]; if (_pendingAddr) linphone_address_unref(_pendingAddr); _pendingAddr = NULL;