From 9ebc8e70b7eba8eeae3485bab3d50b798c858d0c Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Thu, 27 Sep 2012 10:17:04 +0200 Subject: [PATCH] No lite background mode with active call --- Classes/LinphoneManager.m | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index cb095b600..8644451dd 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -809,15 +809,19 @@ static LinphoneCoreVTable linphonec_vtable = { linphone_core_get_default_proxy(theLinphoneCore, &proxyCfg); - if (proxyCfg && [[NSUserDefaults standardUserDefaults] boolForKey:@"backgroundmode_preference"]) { - //For registration register - [self refreshRegisters]; - //wait for registration answer - int i=0; - while (!linphone_proxy_config_is_registered(proxyCfg) && i++<40 ) { - linphone_core_iterate(theLinphoneCore); - usleep(100000); - } + if ((proxyCfg || linphone_core_get_calls_nb(theLinphoneCore) > 0) && + [[NSUserDefaults standardUserDefaults] boolForKey:@"backgroundmode_preference"]) { + + if(proxyCfg != NULL) { + //For registration register + [self refreshRegisters]; + //wait for registration answer + int i=0; + while (!linphone_proxy_config_is_registered(proxyCfg) && i++<40 ) { + linphone_core_iterate(theLinphoneCore); + usleep(100000); + } + } //register keepalive if ([[UIApplication sharedApplication] setKeepAliveTimeout:600/*(NSTimeInterval)linphone_proxy_config_get_expires(proxyCfg)*/ handler:^{