提交 855cc4b4 authored 作者: Michael Jerris's avatar Michael Jerris

add 908-retry-seconds gateway param to set reg retry time when getting a 908 for…

add 908-retry-seconds gateway param to set reg retry time when getting a 908 for backup interfaces to connect quickly
上级 b578aa7c
...@@ -505,6 +505,7 @@ struct sofia_gateway { ...@@ -505,6 +505,7 @@ struct sofia_gateway {
switch_bool_t ping_monitoring; switch_bool_t ping_monitoring;
uint8_t flags[REG_FLAG_MAX]; uint8_t flags[REG_FLAG_MAX];
int32_t retry_seconds; int32_t retry_seconds;
int32_t fail_908_retry_seconds;
int32_t reg_timeout_seconds; int32_t reg_timeout_seconds;
int32_t failure_status; int32_t failure_status;
reg_state_t state; reg_state_t state;
......
...@@ -3320,6 +3320,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) ...@@ -3320,6 +3320,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
*context = profile->context, *context = profile->context,
*expire_seconds = "3600", *expire_seconds = "3600",
*retry_seconds = "30", *retry_seconds = "30",
*fail_908_retry_seconds = NULL,
*timeout_seconds = "60", *timeout_seconds = "60",
*from_user = "", *from_domain = NULL, *outbound_proxy = NULL, *register_proxy = NULL, *contact_host = NULL, *from_user = "", *from_domain = NULL, *outbound_proxy = NULL, *register_proxy = NULL, *contact_host = NULL,
*contact_params = "", *params = NULL, *register_transport = 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) ...@@ -3434,6 +3435,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
context = val; context = val;
} else if (!strcmp(var, "expire-seconds")) { } else if (!strcmp(var, "expire-seconds")) {
expire_seconds = val; expire_seconds = val;
} else if (!strcmp(var, "908-retry-seconds")) {
fail_908_retry_seconds = val;
} else if (!strcmp(var, "retry-seconds")) { } else if (!strcmp(var, "retry-seconds")) {
retry_seconds = val; retry_seconds = val;
} else if (!strcmp(var, "timeout-seconds")) { } else if (!strcmp(var, "timeout-seconds")) {
...@@ -3547,6 +3550,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) ...@@ -3547,6 +3550,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
gateway->retry_seconds = atoi(retry_seconds); 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) { 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", 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); gateway->retry_seconds, name);
......
...@@ -493,7 +493,9 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) ...@@ -493,7 +493,9 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
{ {
int sec; 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; sec = gateway_ptr->retry_seconds;
} else { } else {
sec = gateway_ptr->retry_seconds * gateway_ptr->failures; sec = gateway_ptr->retry_seconds * gateway_ptr->failures;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论