diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 936bd9427..1badc12ec 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -413,7 +413,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); } lp_config_set_int(conf, LINPHONERC_APPLICATION_KEY, "pushnotification_preference", pushnotification); - if( pushnotification ) [[LinphoneManager instance] addPushTokenToProxyConfig:proxyCfg]; + [[LinphoneManager instance] configurePushTokenForProxyConfig:proxyCfg]; linphone_proxy_config_enable_register(proxyCfg, true); linphone_proxy_config_enable_avpf(proxyCfg, use_avpf); diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index 8eb6faf5d..451591dee 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -138,7 +138,7 @@ typedef struct _LinphoneManagerSounds { - (void)becomeActive; - (BOOL)enterBackgroundMode; - (void)enableAutoAnswerForCallId:(NSString*) callid; -- (void)addPushTokenToProxyConfig: (LinphoneProxyConfig*)cfg; +- (void)configurePushTokenForProxyConfig: (LinphoneProxyConfig*)cfg; - (BOOL)shouldAutoAcceptCallForCallId:(NSString*) callId; - (void)acceptCallForCallId:(NSString*)callid; - (void)cancelLocalNotifTimerForCallId:(NSString*)callid; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index de119f4e6..6d9aabff9 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1946,14 +1946,14 @@ static void audioRouteChangeListenerCallback ( } LinphoneProxyConfig *cfg=nil; linphone_core_get_default_proxy(theLinphoneCore, &cfg); - if (cfg) { + if (cfg ) { linphone_proxy_config_edit(cfg); - [self addPushTokenToProxyConfig: cfg]; + [self configurePushTokenForProxyConfig: cfg]; linphone_proxy_config_done(cfg); } } -- (void)addPushTokenToProxyConfig:(LinphoneProxyConfig*)proxyCfg{ +- (void)configurePushTokenForProxyConfig:(LinphoneProxyConfig*)proxyCfg{ NSData *tokenData = pushNotificationToken; if(tokenData != nil && [self lpConfigBoolForKey:@"pushnotification_preference"]) { const unsigned char *tokenBuffer = [tokenData bytes]; @@ -1972,10 +1972,15 @@ static void audioRouteChangeListenerCallback ( linphone_proxy_config_set_contact_uri_parameters(proxyCfg, [params UTF8String]); linphone_proxy_config_set_contact_parameters(proxyCfg, NULL); - } + } else { + // no push token: + linphone_proxy_config_set_contact_uri_parameters(proxyCfg, NULL); + linphone_proxy_config_set_contact_parameters(proxyCfg, NULL); + } } + #pragma mark - Misc Functions + (NSString*)bundleFile:(NSString*)file { diff --git a/Classes/WizardViewController.m b/Classes/WizardViewController.m index e2c265262..c94c7b0c8 100644 --- a/Classes/WizardViewController.m +++ b/Classes/WizardViewController.m @@ -418,10 +418,8 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)setDefaultSettings:(LinphoneProxyConfig*)proxyCfg { LinphoneManager* lm = [LinphoneManager instance]; - BOOL pushnotification = [lm lpConfigBoolForKey:@"pushnotification_preference"]; - if(pushnotification) { - [lm addPushTokenToProxyConfig:proxyCfg]; - } + [lm configurePushTokenForProxyConfig:proxyCfg]; + } - (void)addProxyConfig:(NSString*)username password:(NSString*)password domain:(NSString*)domain {