diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 11f3a9ba4..903d6f51f 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -167,6 +167,8 @@ [self setInteger:-1 forKey:@"current_proxy_config_preference"]; [self setCString:"" forKey:@"account_prefix_preference"]; [self setBool:NO forKey:@"account_substitute_+_by_00_preference"]; + [self setBool:NO forKey:@"account_ice_preference"]; + [self setCString:"" forKey:@"account_stun_preference"]; } if (proxies) { @@ -235,6 +237,12 @@ int expires = linphone_proxy_config_get_expires(proxy); [self setInteger:expires forKey:@"account_expire_preference"]; + + LinphoneNatPolicy *policy = linphone_proxy_config_get_nat_policy(proxy); + if (policy) { + [self setBool:linphone_nat_policy_ice_enabled(policy) forKey:@"account_ice_preference"]; + [self setCString:linphone_nat_policy_get_stun_server(policy) forKey:@"account_stun_preference"]; + } } // call section @@ -483,6 +491,8 @@ BOOL use_avpf = [self boolForKey:@"account_avpf_preference"]; BOOL is_default = [self boolForKey:@"account_is_default_preference"]; BOOL is_enabled = [self boolForKey:@"account_is_enabled_preference"]; + BOOL use_ise = [self boolForKey:@"account_ice_preference"]; + NSString *stun_preference = [self stringForKey:@"account_stun_preference"]; if (username && [username length] > 0 && domain && [domain length] > 0) { int expire = [self integerForKey:@"account_expire_preference"]; @@ -522,9 +532,9 @@ proxyCfg = bctbx_list_nth_data(linphone_core_get_proxy_config_list(LC), [self integerForKey:@"current_proxy_config_preference"]); // if account was deleted, it is not present anymore - if (proxyCfg == NULL) { + if (proxyCfg == NULL) goto bad_proxy; - } + LinphoneAddress *linphoneAddress = linphone_core_interpret_url(LC, "sip:user@domain.com"); linphone_address_set_username(linphoneAddress, username.UTF8String); @@ -557,6 +567,11 @@ goto bad_proxy; } + LinphoneNatPolicy *policy = linphone_proxy_config_get_nat_policy(proxyCfg) ?: linphone_core_create_nat_policy(LC); + linphone_nat_policy_enable_ice(policy, use_ise); + linphone_nat_policy_set_stun_server(policy, stun_preference.UTF8String); + linphone_proxy_config_set_nat_policy(proxyCfg, policy); + if ([prefix length] > 0) { linphone_proxy_config_set_dial_prefix(proxyCfg, [prefix UTF8String]); } @@ -638,7 +653,7 @@ } } // reload address book to prepend proxy config domain to contacts' phone number - [[LinphoneManager.instance fastAddressBook] fetchContactsInBackGroundThread]; + [[LinphoneManager.instance fastAddressBook] fetchContactsInBackGroundThread]; } - (void)synchronizeCodecs:(const MSList *)codecs { diff --git a/Resources/assistant_linphone_create.rc b/Resources/assistant_linphone_create.rc index d047ce190..4730c9752 100644 --- a/Resources/assistant_linphone_create.rc +++ b/Resources/assistant_linphone_create.rc @@ -14,6 +14,12 @@ 1 push_notification sip.linphone.org + nat_policy_default_values + + +
+ stun.linphone.org + stun,ice
diff --git a/Resources/assistant_linphone_existing.rc b/Resources/assistant_linphone_existing.rc index e02647009..1f093f93b 100644 --- a/Resources/assistant_linphone_existing.rc +++ b/Resources/assistant_linphone_existing.rc @@ -14,6 +14,12 @@ 1 push_notification sip.linphone.org + nat_policy_default_values +
+ +
+ stun.linphone.org + stun,ice
diff --git a/Settings/InAppSettings.bundle/Account.plist b/Settings/InAppSettings.bundle/Account.plist index 1e326ae52..e64bb26a4 100644 --- a/Settings/InAppSettings.bundle/Account.plist +++ b/Settings/InAppSettings.bundle/Account.plist @@ -186,6 +186,32 @@ tls + + Key + account_stun_preference + Title + Stun Server + Type + PSTextFieldSpecifier + AutocapitalizationType + None + AutocorrectionType + No + DefaultValue + + IASKTextAlignment + IASKUITextAlignmentRight + + + Title + ICE + Key + account_ice_preference + Type + PSToggleSwitchSpecifier + DefaultValue + + Title Outbound proxy