diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 2aab666248..f4e361318c 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -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; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index af7d4b9857..94adf806ec 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -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); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 8b3373ce9a..d4177195d1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -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;