diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 86bd9814a..f776bc624 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -155,6 +155,9 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); } { [self setString: linphone_core_get_stun_server(lc) forKey:@"stun_preference"]; + [self + setInteger:lp_config_get_int(linphone_core_get_config(lc),"app","ice_preference" + , 0) forKey:@"ice_preference"]; } { @@ -429,7 +432,12 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); NSString* stun_server = [self stringForKey:@"stun_preference"]; if ([stun_server length] > 0){ linphone_core_set_stun_server(lc,[stun_server cStringUsingEncoding:[NSString defaultCStringEncoding]]); - linphone_core_set_firewall_policy(lc, LinphonePolicyUseStun); + BOOL ice_preference = [self boolForKey:@"ice_preference"]; + if(ice_preference) { + linphone_core_set_firewall_policy(lc, LinphonePolicyUseIce); + } else { + linphone_core_set_firewall_policy(lc, LinphonePolicyUseStun); + } } else { linphone_core_set_stun_server(lc, NULL); linphone_core_set_firewall_policy(lc, LinphonePolicyNoFirewall); diff --git a/Classes/SettingsViewController.m b/Classes/SettingsViewController.m index b0c555e68..25936e47f 100644 --- a/Classes/SettingsViewController.m +++ b/Classes/SettingsViewController.m @@ -442,6 +442,15 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys removeObject:@"start_at_boot_preference"]; } [settingsController setHiddenKeys:hiddenKeys animated:TRUE]; + } else if ([@"stun_preference" compare: notif.object] == NSOrderedSame) { + NSMutableSet *hiddenKeys = [NSMutableSet setWithSet:[settingsController hiddenKeys]]; + NSString *stun_server = [notif.userInfo objectForKey:@"stun_preference"]; + if (stun_server && ([stun_server length] > 0)) { + [hiddenKeys removeObject:@"ice_preference"]; + } else { + [hiddenKeys addObject:@"ice_preference"]; + } + [settingsController setHiddenKeys:hiddenKeys animated:TRUE]; } } @@ -490,6 +499,10 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"port_preference"]; } + if([[[[[LinphoneManager instance] settingsStore] objectForKey:@"stun_preference"] stringValue] length] == 0) { + [hiddenKeys addObject:@"ice_preference"]; + } + return hiddenKeys; } diff --git a/Settings/InAppSettings.bundle/Network.plist b/Settings/InAppSettings.bundle/Network.plist index 0f067d74f..c8a4ac946 100644 --- a/Settings/InAppSettings.bundle/Network.plist +++ b/Settings/InAppSettings.bundle/Network.plist @@ -28,6 +28,16 @@ DefaultValue + + Title + ICE + Key + ice_preference + Type + PSToggleSwitchSpecifier + DefaultValue + + Type PSToggleSwitchSpecifier diff --git a/submodules/linphone b/submodules/linphone index c97efee37..05601300f 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit c97efee37aea1ccae3c476a108e988e47f38faa4 +Subproject commit 05601300f64c0f095ba0faeb9e2dd1c1e9483238