diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 5c4f8efa6..c1b8e7d6d 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -2624,7 +2624,8 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { } if (linphone_core_get_calls_nb(theLinphoneCore) < 1 && - floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) { + floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max && + self.providerDelegate.callKitCalls < 1) { NSUUID *uuid = [NSUUID UUID]; [LinphoneManager.instance.providerDelegate.uuids setObject:uuid forKey:@""]; LinphoneManager.instance.providerDelegate.pendingAddr = linphone_address_clone(iaddr); diff --git a/Classes/ProviderDelegate.h b/Classes/ProviderDelegate.h index d2a66344f..00a96b98c 100644 --- a/Classes/ProviderDelegate.h +++ b/Classes/ProviderDelegate.h @@ -21,6 +21,7 @@ @property LinphoneCall *pendingCall; @property LinphoneAddress *pendingAddr; @property BOOL pendingCallVideo; +@property int callKitCalls; - (void)reportIncomingCallwithUUID:(NSUUID *)uuid handle:(NSString *)handle video:(BOOL)video; - (void)config; diff --git a/Classes/ProviderDelegate.m b/Classes/ProviderDelegate.m index 61f577c69..a182b8f59 100644 --- a/Classes/ProviderDelegate.m +++ b/Classes/ProviderDelegate.m @@ -25,6 +25,7 @@ CXCallController *callController = [[CXCallController alloc] initWithQueue:dispatch_get_main_queue()]; [callController.callObserver setDelegate:self queue:dispatch_get_main_queue()]; self.controller = callController; + self.callKitCalls = 0; if (!self) { LOGD(@"ProviderDelegate not initialized..."); @@ -77,6 +78,7 @@ - (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAction *)action { LOGD(@"CallKit : Answering Call"); + self.callKitCalls++; [self configAudioSession:[AVAudioSession sharedInstance]]; [action fulfill]; NSUUID *uuid = action.callUUID; @@ -95,6 +97,7 @@ - (void)provider:(CXProvider *)provider performStartCallAction:(CXStartCallAction *)action { LOGD(@"CallKit : Starting Call"); + self.callKitCalls++; // To restart Audio Unit [self configAudioSession:[AVAudioSession sharedInstance]]; [action fulfill]; @@ -114,6 +117,7 @@ - (void)provider:(CXProvider *)provider performEndCallAction:(CXEndCallAction *)action { LOGD(@"CallKit : Ending the Call"); + self.callKitCalls--; [action fulfill]; if (linphone_core_is_in_conference(LC)) { LinphoneManager.instance.conf = TRUE;