Revision
15829
Author
mikej
Date
2009-12-07 10:29:52 -0600 (Mon, 07 Dec 2009)

Log Message

don't set auto-nat on ipv6 profiles

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (15828 => 15829)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	2009-12-07 16:25:46 UTC (rev 15828)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	2009-12-07 16:29:52 UTC (rev 15829)
@@ -2435,17 +2435,6 @@
 
 				profile->local_network = "localnet.auto";
 
-				if (switch_core_get_variable("nat_type")) {
-					const char *ip = switch_core_get_variable("nat_public_addr");
-					if (ip) {
-						profile->extrtpip = switch_core_strdup(profile->pool, ip);
-						profile->extsipip = switch_core_strdup(profile->pool, ip);
-						sofia_set_pflag(profile, PFLAG_AUTO_NAT);
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "NAT detected setting external ip to %s\n", ip);
-					}
-				}
-
-
 				for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 					char *var = (char *) switch_xml_attr_soft(param, "name");
 					char *val = (char *) switch_xml_attr_soft(param, "value");
@@ -2996,6 +2985,20 @@
 					profile->rtpip = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
 				}
 
+				if (switch_core_get_variable("nat_type")) {
+					const char *ip = switch_core_get_variable("nat_public_addr");
+					if (ip && !strchr(profile->sipip, ':')) {
+						if (!profile->extrtpip) {
+							profile->extrtpip = switch_core_strdup(profile->pool, ip);
+						}
+						if (!profile->extsipip) {
+							profile->extsipip = switch_core_strdup(profile->pool, ip);
+						}
+						sofia_set_pflag(profile, PFLAG_AUTO_NAT);
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "NAT detected setting external ip to %s\n", ip);
+					}
+				}
+
 				if (profile->nonce_ttl < 60) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting nonce TTL to 60 seconds\n");
 					profile->nonce_ttl = 60;