]> 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:14:33 +0000 (14:14 -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 375eecbbc317751b4e92439146a304d6b4addfb6..9eb66259af05280f8384b27620f3d3c6ecd4bc88 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 263ca80f0b896cdcd2314f1cf0665b33bed36d04..f1fadd2475dac50e6d3567127cdc435867a0197c 100644 (file)
@@ -240,6 +240,7 @@ typedef enum {
        PFLAG_DISABLE_NAPTR,
        PFLAG_AUTOFLUSH,
        PFLAG_NAT_OPTIONS_PING,
+       PFLAG_UDP_NAT_OPTIONS_PING,
        PFLAG_ALL_REG_OPTIONS_PING,
        PFLAG_AUTOFIX_TIMING,
        PFLAG_MESSAGE_QUERY_ON_REGISTER,
index 813e2a0f360656a8450b10cb6a3551452433e5a4..f2aa652f82b121c5378e550ad7d087011e1dcdfd 100644 (file)
@@ -4282,10 +4282,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 fc4a44810032e64864e1290aa4f905d333512c54..3487b4f0fce3e100a10b0f988694c901b18a1e4c 100644 (file)
@@ -802,6 +802,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)) {