Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when make call or receive call, the proximity is enabled #159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ios/RTCPjSip/PjSipEndpoint.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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];
}

Expand All @@ -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];
}
Expand Down