]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't set auto-nat on ipv6 profiles
authorMichael Jerris <mike@jerris.com>
Mon, 7 Dec 2009 16:29:52 +0000 (16:29 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 7 Dec 2009 16:29:52 +0000 (16:29 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15829 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia.c

index a8b61d3e3f2b947f225ab7287364f74d6b088b7c..e6c1f93acac8ac77850c88772f7254c588e82422 100644 (file)
@@ -2435,17 +2435,6 @@ switch_status_t config_sofia(int reload, char *profile_name)
 
                                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 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                        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;