]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix registration overlap timeout snafu
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 2 Nov 2010 22:58:24 +0000 (17:58 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 2 Nov 2010 22:58:24 +0000 (17:58 -0500)
libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/nta/nta.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_reg.c

index ec0a895cdbb8b5a0b8e67b62b781d9475713bd9f..8a93851773250e1981c2ee18c5793aa363cd9b8a 100644 (file)
@@ -1 +1 @@
-Mon May 31 09:47:08 EDT 2010
+Tue Nov  2 17:57:25 CDT 2010
index 40ee1f8f85866218af897c1c750649ef6b1b441d..abe7e68c448495c7d414182bddac622e491cccea 100644 (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.
index 0cd3b388711e0f4cceaae51e5d6c8659f31645ae..6a9e4ce620bdf81b7bf57464d230da49d5b9c81e 100644 (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;
 
index 2f5fb5a35a79362b04cc7a3a5bbc3c405298d8b4..2614bd6e15e6e6e7e2436e41fd577218eae69f40 100644 (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: