fix registration overlap timeout snafu

This commit is contained in:
Anthony Minessale 2010-11-02 17:58:24 -05:00
parent 97d80d924a
commit df52cc0952
4 changed files with 23 additions and 5 deletions

View File

@ -1 +1 @@
Mon May 31 09:47:08 EDT 2010
Tue Nov 2 17:57:25 CDT 2010

View File

@ -8660,6 +8660,10 @@ void outgoing_destroy(nta_outgoing_t *orq)
orq->orq_destroyed = 1;
orq->orq_callback = outgoing_default_cb;
orq->orq_magic = NULL;
if (orq->orq_method != sip_method_invite &&
orq->orq_method != sip_method_ack)
outgoing_terminate(orq);
}
/** @internal Outgoing transaction timer routine.

View File

@ -343,6 +343,7 @@ typedef enum {
REG_STATE_FAIL_WAIT,
REG_STATE_EXPIRED,
REG_STATE_NOREG,
REG_STATE_TIMEOUT,
REG_STATE_LAST
} reg_state_t;

View File

@ -369,11 +369,24 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
user_via = NULL;
break;
case REG_STATE_TIMEOUT:
{
nua_handle_t *nh = gateway_ptr->nh;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timeout Registering %s\n", gateway_ptr->name);
gateway_ptr->nh = NULL;
nua_handle_destroy(nh);
gateway_ptr->state = REG_STATE_FAILED;
gateway_ptr->failures++;
gateway_ptr->failure_status = 908;
}
break;
case REG_STATE_FAILED:
{
int sec;
if (gateway_ptr->failure_status == 503) {
if (gateway_ptr->failure_status == 503 || gateway_ptr->failure_status == 908) {
sec = gateway_ptr->retry_seconds;
} else {
sec = gateway_ptr->retry_seconds * (gateway_ptr->failures + 1);
@ -384,8 +397,8 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
gateway_ptr->state = REG_STATE_FAIL_WAIT;
gateway_ptr->failure_status = 0;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Failed Registration, setting retry to %d seconds.\n",
gateway_ptr->name, sec);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Failed Registration [%d], setting retry to %d seconds.\n",
gateway_ptr->name, gateway_ptr->failure_status, sec);
}
break;
@ -396,7 +409,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
break;
case REG_STATE_TRYING:
if (!gateway_ptr->retry || now >= gateway_ptr->retry) {
gateway_ptr->state = REG_STATE_FAILED;
gateway_ptr->state = REG_STATE_TIMEOUT;
}
break;
default: