mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
update exosip and use long running task for registering while in background.
This commit is contained in:
parent
b652b2bd53
commit
8ce4c7d15c
3 changed files with 24 additions and 6 deletions
|
|
@ -78,7 +78,7 @@ typedef struct _LinphoneManagerSounds {
|
|||
NSTimer* mIterateTimer;
|
||||
time_t lastRemoteNotificationTime;
|
||||
Connectivity connectivity;
|
||||
|
||||
BOOL stopWaitingRegisters;
|
||||
NSMutableArray *inhibitedEvent;
|
||||
|
||||
@public
|
||||
|
|
@ -104,6 +104,7 @@ typedef struct _LinphoneManagerSounds {
|
|||
- (void)didReceiveRemoteNotification;
|
||||
- (void)addPushTokenToProxyConfig: (LinphoneProxyConfig*)cfg;
|
||||
- (BOOL)shouldAutoAcceptCall;
|
||||
- (void)waitForRegisterToArrive;
|
||||
|
||||
+ (void)kickOffNetworkConnection;
|
||||
- (void)setupNetworkReachabilityCallback;
|
||||
|
|
|
|||
|
|
@ -389,6 +389,8 @@ static void linphone_iphone_transfer_state_changed(LinphoneCore* lc, LinphoneCal
|
|||
|
||||
-(void) onRegister:(LinphoneCore *)lc cfg:(LinphoneProxyConfig*) cfg state:(LinphoneRegistrationState) state message:(const char*) message {
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"NEW REGISTRATION STATE: '%s' (message: '%s')", linphone_registration_state_to_string(state), message];
|
||||
if (state==LinphoneRegistrationOk)
|
||||
[LinphoneManager instance]->stopWaitingRegisters=TRUE;
|
||||
|
||||
// Post event
|
||||
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
|
|
@ -507,10 +509,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
linphone_proxy_config_expires(proxy, lLinphoneMgr.defaultExpires); //might be better to save the previous value
|
||||
}
|
||||
|
||||
if (lLinphoneMgr.connectivity == none) {
|
||||
linphone_core_set_network_reachable([LinphoneManager getLc],true);
|
||||
|
||||
} else if (lLinphoneMgr.connectivity != newConnectivity) {
|
||||
if (lLinphoneMgr.connectivity != newConnectivity) {
|
||||
// connectivity has changed
|
||||
linphone_core_set_network_reachable([LinphoneManager getLc],false);
|
||||
if (newConnectivity == wwan && proxy && isWifiOnly) {
|
||||
|
|
@ -518,6 +517,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
}
|
||||
linphone_core_set_network_reachable([LinphoneManager getLc],true);
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"Network connectivity changed to type [%s]",(newConnectivity==wifi?"wifi":"wwan")];
|
||||
[lLinphoneMgr waitForRegisterToArrive];
|
||||
}
|
||||
lLinphoneMgr.connectivity=newConnectivity;
|
||||
}
|
||||
|
|
@ -749,6 +749,23 @@ static LinphoneCoreVTable linphonec_vtable = {
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void)waitForRegisterToArrive{
|
||||
int i;
|
||||
UIBackgroundTaskIdentifier bgid;
|
||||
stopWaitingRegisters=FALSE;
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"Starting long running task for registering"];
|
||||
bgid=[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler: ^{
|
||||
[LinphoneManager instance]->stopWaitingRegisters=TRUE;
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"Expiration handler called"];
|
||||
}];
|
||||
for(i=0;i<100 && (!stopWaitingRegisters);i++){
|
||||
linphone_core_iterate(theLinphoneCore);
|
||||
usleep(20000);
|
||||
}
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"Ending long running task for registering"];
|
||||
[[UIApplication sharedApplication] endBackgroundTask:bgid];
|
||||
}
|
||||
|
||||
- (BOOL)enterBackgroundMode {
|
||||
LinphoneProxyConfig* proxyCfg;
|
||||
linphone_core_get_default_proxy(theLinphoneCore, &proxyCfg);
|
||||
|
|
|
|||
2
submodules/externals/exosip
vendored
2
submodules/externals/exosip
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 6ba04c22ccc8b140a9de84124d0e4ee7a406705b
|
||||
Subproject commit b62c4167702f5333686754f55a2da81705e170ba
|
||||
Loading…
Add table
Reference in a new issue