From 219bb56d5d89639544704da8ec0ad08cd5b06d22 Mon Sep 17 00:00:00 2001 From: LongNN Date: Thu, 20 Dec 2018 10:12:59 +0700 Subject: [PATCH] when make call or receive call, the proximity is enabled --- ios/RTCPjSip/PjSipEndpoint.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ios/RTCPjSip/PjSipEndpoint.m b/ios/RTCPjSip/PjSipEndpoint.m index 3470b693..fb8af604 100755 --- a/ios/RTCPjSip/PjSipEndpoint.m +++ b/ios/RTCPjSip/PjSipEndpoint.m @@ -242,7 +242,10 @@ -(PjSipCall *) makeCall:(PjSipAccount *) account destination:(NSString *)destina PjSipCall *call = [PjSipCall itemConfig:callId]; self.calls[@(callId)] = call; - + + UIDevice *device = [UIDevice currentDevice]; + if(device.proximityMonitoringEnabled == NO) [[UIDevice currentDevice] setProximityMonitoringEnabled:YES]; + return call; } @@ -382,6 +385,9 @@ static void onCallReceived(pjsua_acc_id accId, pjsua_call_id callId, pjsip_rx_da PjSipCall *call = [PjSipCall itemConfig:callId]; endpoint.calls[@(callId)] = call; + UIDevice *device = [UIDevice currentDevice]; + if(device.proximityMonitoringEnabled == NO) [[UIDevice currentDevice] setProximityMonitoringEnabled:YES]; + [endpoint emmitCallReceived:call]; } @@ -402,6 +408,9 @@ static void onCallStateChanged(pjsua_call_id callId, pjsip_event *event) { if (callInfo.state == PJSIP_INV_STATE_DISCONNECTED) { [endpoint.calls removeObjectForKey:@(callId)]; [endpoint emmitCallTerminated:call]; + + UIDevice *device = [UIDevice currentDevice]; + if(device.proximityMonitoringEnabled == YES) [[UIDevice currentDevice] setProximityMonitoringEnabled:NO]; } else { [endpoint emmitCallChanged:call]; }