diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index ce3334db7..a8d97a7b8 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -603,16 +603,13 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) { if (call && (linphone_core_get_calls_nb(LC) < 2)) { #if !TARGET_IPHONE_SIMULATOR - NSString *callId = - [NSString stringWithUTF8String:linphone_call_log_get_call_id(linphone_call_get_call_log(call))]; - + NSString *callId = [NSString stringWithUTF8String:linphone_call_log_get_call_id(linphone_call_get_call_log(call))]; NSUUID *uuid = [NSUUID UUID]; [LinphoneManager.instance.providerDelegate.calls setObject:callId forKey:uuid]; [LinphoneManager.instance.providerDelegate.uuids setObject:uuid forKey:callId]; - BOOL video = FALSE; - video = ([UIApplication sharedApplication].applicationState == UIApplicationStateActive && - linphone_core_get_video_policy(LC)->automatically_accept && - linphone_call_params_video_enabled(linphone_call_get_remote_params(call))); + BOOL video = ([UIApplication sharedApplication].applicationState == UIApplicationStateActive && + linphone_video_activation_policy_get_automatically_accept(linphone_core_get_video_activation_policy(LC)) && + linphone_call_params_video_enabled(linphone_call_get_remote_params(call))); [LinphoneManager.instance.providerDelegate reportIncomingCall:call withUUID:uuid handle:address video:video]; #else [PhoneMainView.instance displayIncomingCall:call]; diff --git a/Classes/ProviderDelegate.m b/Classes/ProviderDelegate.m index 5f182c710..9bb012525 100644 --- a/Classes/ProviderDelegate.m +++ b/Classes/ProviderDelegate.m @@ -79,7 +79,8 @@ update.supportsHolding = TRUE; update.supportsGrouping = TRUE; update.supportsUngrouping = TRUE; - update.hasVideo = video; + update.hasVideo = _pendingCallVideo = video; + linphone_call_ref(call); // Report incoming call to system LOGD(@"CallKit: report new incoming call"); @@ -88,7 +89,7 @@ update:update completion:^(NSError *error) { if (error) { - LOGE(@"CallKit: cannot complete incoming call from [%@] caused by [%@]",handle,[error localizedDescription]); + LOGE(@"CallKit: cannot complete incoming call from [%@] caused by [%@]", handle, [error localizedDescription]); if ([error code] == CXErrorCodeIncomingCallErrorFilteredByDoNotDisturb || [error code] == CXErrorCodeIncomingCallErrorFilteredByBlockList) linphone_call_decline(call,LinphoneReasonBusy); /*to give a chance for other devices to answer*/ @@ -96,7 +97,7 @@ linphone_call_decline(call,LinphoneReasonUnknown); } linphone_call_unref(call); - }]; + }]; } - (void)setPendingCall:(LinphoneCall *)pendingCall { @@ -114,21 +115,16 @@ - (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAction *)action { LOGD(@"CallKit : Answering Call"); - self.callKitCalls++; [self configAudioSession:[AVAudioSession sharedInstance]]; [action fulfill]; NSUUID *uuid = action.callUUID; - NSString *callID = [self.calls objectForKey:uuid]; // first, make sure this callid is not already involved in a call LinphoneCall *call = [LinphoneManager.instance callByCallId:callID]; - if (call != NULL) { - BOOL video = ([UIApplication sharedApplication].applicationState == UIApplicationStateActive && - linphone_core_get_video_policy(LC)->automatically_accept && - linphone_call_params_video_enabled(linphone_call_get_remote_params((LinphoneCall *)call))); - self.pendingCall = call; - self.pendingCallVideo = video; + if (!call) return; - }; + + self.callKitCalls++; + _pendingCall = call; } - (void)provider:(CXProvider *)provider performStartCallAction:(CXStartCallAction *)action {