]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
more nat cleanup
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 2 Dec 2009 18:46:17 +0000 (18:46 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 2 Dec 2009 18:46:17 +0000 (18:46 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15759 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_sla.c

index de2fc9941ee4284ee84f74f4faf5bd71f92e3f4d..60c7a56338afc386d909a0efd77821e2d44c9397 100644 (file)
@@ -1943,7 +1943,8 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
                                        if (strcasecmp(argv[1], profile->name)) {
                                        stream->write_function(stream, "Alias Of         \t%s\n", switch_str_nil(profile->name));
                                        }
-                                       stream->write_function(stream, "DBName           \t%s\n", switch_str_nil(profile->dbname));
+                                       stream->write_function(stream, "Auto-NAT         \t%s\n", sofia_test_pflag(profile, PFLAG_AUTO_NAT) ? "true" : "false");
+                                       stream->write_function(stream, "DBName           \t%s\n", profile->dbname ? profile->dbname : switch_str_nil(profile->odbc_dsn));
                                        stream->write_function(stream, "Pres Hosts       \t%s\n", switch_str_nil(profile->presence_hosts));
                                        stream->write_function(stream, "Dialplan         \t%s\n", switch_str_nil(profile->dialplan));
                                        stream->write_function(stream, "Context          \t%s\n", switch_str_nil(profile->context));
@@ -2172,7 +2173,8 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
                                        if (strcasecmp(argv[1], profile->name)) {
                                                stream->write_function(stream, "    <alias-of>%s</alias-of>\n", switch_str_nil(profile->name));
                                        }
-                                       stream->write_function(stream, "    <db-name>%s</db-name>\n", switch_str_nil(profile->dbname));
+                                       stream->write_function(stream, "    <auto-nat>%s</auto-nat>\n", sofia_test_pflag(profile, PFLAG_AUTO_NAT) ? "true" : "false");
+                                       stream->write_function(stream, "    <db-name>%s</db-name>\n", profile->dbname ? profile->dbname : switch_str_nil(profile->odbc_dsn));
                                        stream->write_function(stream, "    <pres-hosts>%s</pres-hosts>\n", switch_str_nil(profile->presence_hosts));
                                        stream->write_function(stream, "    <dialplan>%s</dialplan>\n", switch_str_nil(profile->dialplan));
                                        stream->write_function(stream, "    <context>%s</context>\n", switch_str_nil(profile->context));
index 75ca4249adbf694e35ba9f14461222efb569f314..41203ffc54ddaef6531ad4f956128e9912beb355 100644 (file)
@@ -3025,7 +3025,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                if (!profile->sipdomain) {
                                        profile->sipdomain = switch_core_strdup(profile->pool, profile->sipip);
                                }
-                               if (profile->extsipip && sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+                               if (profile->extsipip) {
                                        char *ipv6 = strchr(profile->extsipip, ':');
                                        profile->public_url = switch_core_sprintf(profile->pool,
                                                                                                                          "sip:%s@%s%s%s:%d",
@@ -3036,7 +3036,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                                                                                          profile->sip_port);
                                }
 
-                               if (profile->extsipip && !sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+                               if (profile->extsipip) {
                                        char *ipv6 = strchr(profile->extsipip, ':');
                                        profile->url = switch_core_sprintf(profile->pool,
                                                                                                                "sip:%s@%s%s%s:%d",
@@ -3060,7 +3060,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
 
                                profile->tcp_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->url);
 
-                               if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+                               if (profile->public_url) {
                                        profile->tcp_public_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->public_url);
                                }
 
@@ -3077,7 +3077,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                profile->tls_sip_port = (switch_port_t)atoi(SOFIA_DEFAULT_TLS_PORT);
                                        }
 
-                                       if (profile->extsipip && sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+                                       if (profile->extsipip) {
                                                char *ipv6 = strchr(profile->extsipip, ':');
                                                profile->tls_public_url = switch_core_sprintf(profile->pool,
                                                                                                                                  "sip:%s@%s%s%s:%d",
@@ -3088,7 +3088,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                                                                                                  profile->tls_sip_port);
                                        }
                                        
-                                       if (profile->extsipip && !sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+                                       if (profile->extsipip) {
                                                char *ipv6 = strchr(profile->extsipip, ':');
                                                profile->tls_url = 
                                                        switch_core_sprintf(profile->pool,
@@ -3135,7 +3135,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                profile->tls_cert_dir = switch_core_sprintf(profile->pool, "%s/ssl", SWITCH_GLOBAL_dirs.conf_dir);
                                        }
                                        profile->tls_contact = switch_core_sprintf(profile->pool, "%s;transport=tls", profile->tls_url);
-                                       if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+                                       if (profile->tls_public_url) {
                                                profile->tls_public_contact = switch_core_sprintf(profile->pool, "%s;transport=tls", profile->tls_public_url);
                                        }
                                }
index 1146367382c26fc857b7d9341ce1dc58b16764ab..0ae8ca6a6528e891d8c41b7e23432b24485fed6b 100644 (file)
@@ -933,10 +933,7 @@ char *sofia_glue_strip_uri(const char *str)
 
 int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip)
 {
-       return (network_ip && 
-                       profile->local_network && 
-                       sofia_test_pflag(profile, PFLAG_AUTO_NAT) && 
-                       !switch_check_network_list_ip(network_ip, profile->local_network));
+       return (profile->extsipip && !switch_check_network_list_ip(network_ip, profile->local_network));
 }
 
 int sofia_glue_transport_has_tls(const sofia_transport_t tp)
index bbd7e8543954fdbd3b53234e3f749a8dbf68a164..5f2494335ae777d9da253275057859d4d406370c 100644 (file)
@@ -383,7 +383,7 @@ static int sofia_sla_sub_callback(void *pArg, int argc, char **argv, char **colu
                        }
                }
 
-               if (sofia_test_pflag(helper->profile, PFLAG_AUTO_NAT)) {
+               if (helper->profile->extsipip) {
                        if (sofia_glue_check_nat(helper->profile, network_ip)) { 
                                fixup = switch_string_replace(helper->payload, helper->profile->sipip, helper->profile->extsipip);
                        } else  {