]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add 908-retry-seconds gateway param to set reg retry time when getting a 908 for...
authorMichael Jerris <mike@jerris.com>
Thu, 9 Oct 2014 18:43:16 +0000 (14:43 -0400)
committerMichael Jerris <mike@jerris.com>
Thu, 9 Oct 2014 18:43:23 +0000 (14:43 -0400)
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index 2aab6662488524d0b262236de8f59946505ab9bb..f4e361318c273664279dfe38342b3e2683a7065b 100644 (file)
@@ -505,6 +505,7 @@ struct sofia_gateway {
        switch_bool_t ping_monitoring;
        uint8_t flags[REG_FLAG_MAX];
        int32_t retry_seconds;
+       int32_t fail_908_retry_seconds;
        int32_t reg_timeout_seconds;
        int32_t failure_status;
        reg_state_t state;
index af7d4b9857d99b6171996b1ebab4fd22bd1975fe..94adf806ec86cb2a0cb45de30d19847c29a1f13c 100644 (file)
@@ -3320,6 +3320,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                                *context = profile->context,
                                *expire_seconds = "3600",
                                *retry_seconds = "30",
+                               *fail_908_retry_seconds = NULL,
                                *timeout_seconds = "60",
                                *from_user = "", *from_domain = NULL, *outbound_proxy = NULL, *register_proxy = NULL, *contact_host = NULL,
                                *contact_params = "", *params = NULL, *register_transport = NULL,
@@ -3434,6 +3435,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                                        context = val;
                                } else if (!strcmp(var, "expire-seconds")) {
                                        expire_seconds = val;
+                               } else if (!strcmp(var, "908-retry-seconds")) {
+                                       fail_908_retry_seconds = val;
                                } else if (!strcmp(var, "retry-seconds")) {
                                        retry_seconds = val;
                                } else if (!strcmp(var, "timeout-seconds")) {
@@ -3547,6 +3550,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
 
                        gateway->retry_seconds = atoi(retry_seconds);
 
+                       if (fail_908_retry_seconds) {
+                               gateway->fail_908_retry_seconds = atoi(fail_908_retry_seconds);
+                       }
+
                        if (gateway->retry_seconds < 5) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid retry-seconds of %d on gateway %s, using the value of 30 instead.\n",
                                                                  gateway->retry_seconds, name);
index 8b3373ce9a7a50fc49cc7587c236c1dee9dea73d..d4177195d11f42e622775bd1f29c5840cd538082 100644 (file)
@@ -493,7 +493,9 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
                        {
                                int sec;
 
-                               if (gateway_ptr->failure_status == 503 || gateway_ptr->failure_status == 908 || gateway_ptr->failures < 1) {
+                               if (gateway_ptr->fail_908_retry_seconds && gateway_ptr->failure_status == 908) {
+                                       sec = gateway_ptr->fail_908_retry_seconds;
+                               } else if (gateway_ptr->failure_status == 503 || gateway_ptr->failure_status == 908 || gateway_ptr->failures < 1) {
                                        sec = gateway_ptr->retry_seconds;
                                } else {
                                        sec = gateway_ptr->retry_seconds * gateway_ptr->failures;