*context = profile->context,
*expire_seconds = "3600",
*retry_seconds = "30",
+ *timeout_seconds = "60",
*from_user = "", *from_domain = NULL, *outbound_proxy = NULL, *register_proxy = NULL, *contact_host = NULL,
*contact_params = NULL, *params = NULL, *register_transport = NULL;
expire_seconds = val;
} else if (!strcmp(var, "retry-seconds")) {
retry_seconds = val;
+ } else if (!strcmp(var, "timeout-seconds")) {
+ timeout_seconds = val;
} else if (!strcmp(var, "retry_seconds")) { // support typo for back compat
retry_seconds = val;
} else if (!strcmp(var, "from-user")) {
}
gateway->retry_seconds = atoi(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);
gateway->retry_seconds = 30;
}
+ gateway->reg_timeout_seconds = atoi(timeout_seconds);
+
+ if (gateway->retry_seconds < 5) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid timeout-seconds of %d on gateway %s, using the value of 60 instead.\n",
+ gateway->reg_timeout_seconds, name);
+ gateway->reg_timeout_seconds = 30;
+ }
+
+
gateway->register_scheme = switch_core_strdup(gateway->pool, scheme);
gateway->register_context = switch_core_strdup(gateway->pool, context);
gateway->register_realm = switch_core_strdup(gateway->pool, realm);
NUTAG_REGISTRAR(gateway_ptr->register_proxy),
NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
}
- gateway_ptr->retry = now + gateway_ptr->retry_seconds;
+ gateway_ptr->reg_timeout = now + gateway_ptr->reg_timeout_seconds;
gateway_ptr->state = REG_STATE_TRYING;
switch_safe_free(user_via);
user_via = NULL;
}
break;
case REG_STATE_TRYING:
- if (!gateway_ptr->retry || now >= gateway_ptr->retry) {
+ if (now >= gateway_ptr->reg_timeout) {
gateway_ptr->state = REG_STATE_TIMEOUT;
}
break;