]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
--resolve FS-5426
authorKen Rice <krice@freeswitch.org>
Wed, 3 Jul 2013 16:21:47 +0000 (11:21 -0500)
committerKen Rice <krice@freeswitch.org>
Wed, 3 Jul 2013 19:13:05 +0000 (14:13 -0500)
conf/vanilla/sip_profiles/internal.xml
src/mod/endpoints/mod_sofia/conf/sofia.conf.xml
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index 423ec2a60a56d0ff3350148d27e6f160e52b3617..4ef9bde0d28f7f66f329ea9a8aca3fcedb362184 100644 (file)
     <!-- if you want to send any special bind params of your own -->
     <!--<param name="bind-params" value="transport=udp"/>-->
     <!--<param name="unregister-on-options-fail" value="true"/>-->
+    <!-- Send an OPTIONS packet to all registered endpoints -->
+    <!--<param name="all-reg-options-ping" value="true"/>-->
+    <!-- Send an OPTIONS packet to NATed registered endpoints. Can be 'true' or 'udp-only'. --!>
+    <!--<param name="nat-options-ping" value="true"/>-->
 
     <!-- TLS: disabled by default, set to "true" to enable -->
     <param name="tls" value="$${internal_ssl_enable}"/>
index 5bd3a6dc1237f963a80b1de89c3cb483a9cbd6f6..411ea3e44e9dd6faff2d95a18c7ce64b01edef4b 100644 (file)
         <!-- if you want to send any special bind params of your own -->
         <!-- <param name="bind-params" value="transport=udp"/> -->
         <!-- <param name="unregister-on-options-fail" value="true"/> -->
+        <!-- Send an OPTIONS packet to all registered endpoints -->
+        <!--<param name="all-reg-options-ping" value="true"/>-->
+        <!-- Send an OPTIONS packet to NATed registered endpoints. Can be 'true' or 'udp-only
+        <!--<param name="nat-options-ping" value="true"/>-->
 
         <!-- TLS: disabled by default, set to "true" to enable -->
         <param name="tls" value="$${internal_ssl_enable}"/>
index 365f5857877014fd58157258bc046719faae2329..ac8b4366f797ec1a7a866c94724127a55ef02d19 100644 (file)
@@ -230,6 +230,7 @@ typedef enum {
        PFLAG_DISABLE_SRV503,
        PFLAG_DISABLE_NAPTR,
        PFLAG_NAT_OPTIONS_PING,
+       PFLAG_UDP_NAT_OPTIONS_PING,
        PFLAG_ALL_REG_OPTIONS_PING,
        PFLAG_MESSAGE_QUERY_ON_REGISTER,
        PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER,
index d226b928f4943853015b8f82c9ba08cb66e85343..04d17cfd1d19dd9309ce20d086e17a92e8153f34 100644 (file)
@@ -4309,10 +4309,13 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                        } else if (!strcasecmp(var, "contact-user")) {
                                                profile->contact_user = switch_core_strdup(profile->pool, val);
                                        } else if (!strcasecmp(var, "nat-options-ping")) {
-                                               if (switch_true(val)) {
+                                               if (!strcasecmp(val, "udp-only")) {
+                                                       sofia_set_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING);
+                                               } else if (switch_true(val)) {
                                                        sofia_set_pflag(profile, PFLAG_NAT_OPTIONS_PING);
                                                } else {
                                                        sofia_clear_pflag(profile, PFLAG_NAT_OPTIONS_PING);
+                                                       sofia_clear_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING);
                                                }
                                        } else if (!strcasecmp(var, "all-reg-options-ping")) { 
                                                if (switch_true(val)) {
index 2bdf11e2d12fbc00452c338c45375677a1669393..aba34a321d5a7898db4e9f48958fa9b3f617a0e4 100644 (file)
@@ -822,6 +822,14 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot)
  " from sip_registrations where hostname='%s' and " 
  "profile_name='%s'", mod_sofia_globals.hostname, profile->name); 
                        
+                       sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile);
+                       switch_safe_free(sql);
+               } else if (sofia_test_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING)) {
+                       sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid,"
+                                                       "expires,user_agent,server_user,server_host,profile_name"
+                                                       " from sip_registrations where status like '%%UDP-NAT%%' "
+ "and hostname='%s' and profile_name='%s'", mod_sofia_globals.hostname, profile->name); 
+                       
                        sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile);
                        switch_safe_free(sql);
                } else if (sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) {