[asterisk-commits] murf: branch 1.4 r144420 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 25 11:12:14 CDT 2008


Author: murf
Date: Thu Sep 25 11:12:14 2008
New Revision: 144420

URL: http://svn.digium.com/view/asterisk?view=rev&rev=144420
Log:
(closes issue #12101)
Reported by: MVF
Tested by: neutrino88, urzedo, murf, thiagofernandes

Many thanks to neutrino88 for this patch, which
solves a problem whereby channels get a CANCEL
request, respond to it properly, but end up 
in a hung state, infinitely being rescheduled.
This fix is a bit crude, in that catches the
problem at a rather late phase, but it may
prevent infinite rescheduling problems that
might still arise.

It might have been better to find out why,
in the course of protocol handling, the channel
was not destroyed, but we leave that to 
future generations.

Many thanks to urzedo and thiagofernandes for
their work in verifying that the patch code
indeed is being executing, and averting the
problem.



Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=144420&r1=144419&r2=144420
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Thu Sep 25 11:12:14 2008
@@ -2092,10 +2092,17 @@
 	}
 
 	/* If there are packets still waiting for delivery, delay the destruction */
-	if (p->packets) {
+	/* via bug 12101, the two usages of SIP_NEEDDESTROY in the following block
+	* of code make a sort of "safety relief valve", that allows sip channels
+	* that were created via INVITE, then thru some sequence were CANCELED,
+	* to die, rather than infinitely be rescheduled */
+	if (p->packets && !ast_test_flag(&p->flags[0], SIP_NEEDDESTROY)) {
 		if (option_debug > 2)
 			ast_log(LOG_DEBUG, "Re-scheduled destruction of SIP call %s\n", p->callid ? p->callid : "<unknown>");
 		append_history(p, "ReliableXmit", "timeout");
+		if (p->method == SIP_CANCEL || p->method == SIP_BYE) {
+			ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
+		}
 		return 10000;
 	}
 




More information about the asterisk-commits mailing list