[asterisk-dev] Retransmission timers, an old bug coming back

Benny Amorsen benny+usenet at amorsen.dk
Wed Oct 24 02:37:05 CDT 2007


Back in 1.2.13 I discovered a bug,
http://bugs.digium.com/view.php?id=9020. Unfortunately the fix that
was backported from 1.4 to 1.2 was incomplete, and the problem still
persists in some cases in 1.2.24.

The problem is that sometimes asterisk will decide that a phone or
other asterisk is so close, that all retransmissions happen within
less than 100ms. That gives the other device no time to react to the
retransmissions, which ends up with this:

Oct 23 19:06:12 WARNING[3313] chan_sip.c: Maximum retries exceeded on transmission 41408bb666d27912687d2bba4b897c40 at 10.0.1.100 for seqno 102 (Critical Response)


The fix is easy:

--- asterisk-1.2.24.old/channels/chan_sip.c	2007-07-23 16:32:07.000000000 +0200
+++ asterisk-1.2.24/channels/chan_sip.c	2007-10-24 09:10:08.000000000 +0200
@@ -7412,7 +7412,7 @@
 			if (peer->callingpres)
 				p->callingpres = peer->callingpres;
 			if (peer->maxms && peer->lastms)
-				p->timer_t1 = peer->lastms;
+				p->timer_t1 = peer->lastms < DEFAULT_T1MIN ? DEFAULT_T1MIN : peer->lastms;
 			if (ast_test_flag(peer, SIP_INSECURE_INVITE)) {
 				/* Pretend there is no required authentication */
 				p->peersecret[0] = '\0';


You can check that the fix works with this patch:

--- asterisk-1.2.24.old/channels/chan_sip.c	2007-07-23 16:32:07.000000000 +0200
+++ asterisk-1.2.24/channels/chan_sip.c	2007-10-24 09:10:08.000000000 +0200
@@ -1225,7 +1225,7 @@
 	/* Too many retries */
 	if (pkt->owner && pkt->method != SIP_OPTIONS) {
 		if (ast_test_flag(pkt, FLAG_FATAL) || sipdebug)	/* Tell us if it's critical or if we're debugging */
-			ast_log(LOG_WARNING, "Maximum retries exceeded on transmission %s for seqno %d (%s %s)\n", pkt->owner->callid, pkt->seqno, (ast_test_flag(pkt, FLAG_FATAL)) ? "Critical" : "Non-critical", (ast_test_flag(pkt, FLAG_RESPONSE)) ? "Response" : "Request");
 +			ast_log(LOG_WARNING, "Maximum retries exceeded on transmission %s for seqno %d (%s %s) -- timer_t1 is %d\n", pkt->owner->callid, pkt->seqno, (ast_test_flag(pkt, FLAG_FATAL)) ? "Critical" : "Non-critical", (ast_test_flag(pkt, FLAG_RESPONSE)) ? "Response" : "Request", pkt->timer_t1);
 	} else {
 		if (pkt->method == SIP_OPTIONS && sipdebug)
 			ast_log(LOG_WARNING, "Cancelling retransmit of OPTIONs (call id %s) \n", pkt->owner->callid);

Then the warning messages will tell you what timer_t1 was set to, and
if it is lower than DEFAULT_T1MIN, the bugfix didn't help.

Anyway, I know this will not be applied to the 1.2.x series, since
that is security fix only, but now it is at least out there for those
who for some reason decide to not upgrade yet.


/Benny





More information about the asterisk-dev mailing list