[asterisk-commits] russell: trunk r69187 - in /trunk: ./ channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jun 13 13:03:04 MST 2007


Author: russell
Date: Wed Jun 13 15:03:03 2007
New Revision: 69187

URL: http://svn.digium.com/view/asterisk?view=rev&rev=69187
Log:
Merged revisions 69183 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r69183 | russell | 2007-06-13 14:57:38 -0500 (Wed, 13 Jun 2007) | 9 lines

Move the logic for destroying a call when no response is received to a BYE
outside of the block that checks for FLAG_FATAL to be set.  This flag is only
set when the packet is transmitted with the reliability set to XMIT_CRITICAL
when the original packet is transmitted.  A BYE is always sent with it set
to XMIT_RELIABLE, meaning this code could never be encountered.  This resulted
in seeing some SIP channels that would never go away with the last packet
sent being a BYE.
(part of issue #9235, patch from jcmoore)

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=69187&r1=69186&r2=69187
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Jun 13 15:03:03 2007
@@ -2103,16 +2103,11 @@
 			usleep(1);
 			sip_pvt_lock(pkt->owner);
 		}
+
 		if (pkt->owner->owner && !pkt->owner->owner->hangupcause) 
 			pkt->owner->owner->hangupcause = AST_CAUSE_NO_USER_RESPONSE;
-		if (pkt->method == SIP_BYE) {
-			/* Ok, we're not getting answers on SIP BYE's. Who cares?
-		           let's take the call down anyway. */
-			if (pkt->owner->owner) 
-				ast_channel_unlock(pkt->owner->owner);
-			append_history(pkt->owner, "ByeFailure", "Remote peer doesn't respond to bye. Destroying call anyway.");
-			ast_set_flag(&pkt->owner->flags[0], SIP_NEEDDESTROY);	
-		} else if (pkt->owner->owner) {
+		
+		if (pkt->owner->owner) {
 			sip_alreadygone(pkt->owner);
 			ast_log(LOG_WARNING, "Hanging up call %s - no reply to our critical packet.\n", pkt->owner->callid);
 			ast_queue_hangup(pkt->owner->owner);
@@ -2129,6 +2124,15 @@
 			}
 		}
 	}
+
+	if (pkt->method == SIP_BYE) {
+		/* We're not getting answers on SIP BYE's.  Tear down the call anyway. */
+		if (pkt->owner->owner) 
+			ast_channel_unlock(pkt->owner->owner);
+		append_history(pkt->owner, "ByeFailure", "Remote peer doesn't respond to bye. Destroying call anyway.");
+		ast_set_flag(&pkt->owner->flags[0], SIP_NEEDDESTROY);
+	}
+
 	/* Remove the packet */
 	for (prev = NULL, cur = pkt->owner->packets; cur; prev = cur, cur = cur->next) {
 		if (cur == pkt) {



More information about the asterisk-commits mailing list