[svn-commits] mjordan: trunk r392005 - /trunk/main/manager_channels.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 17 09:40:27 CDT 2013


Author: mjordan
Date: Mon Jun 17 09:40:23 2013
New Revision: 392005

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392005
Log:
Prevent sending a NewExten event after a Hangup during a stack restore

When a channel is originated, its application is typically set to AppDial2,
indicating that it was a dialed channel through the Dial API. Asterisk during
an originate will perform a stack execute to direct the outgoing channel to
a particular place in the dialplan or application. When the stack returns, the
previous application (AppDial2) is restored.

Unfortunately, in the case of an originated channel, the stack restore happens
after hangup. A stasis message is sent notifying everyone that the application
was restored, and this causes a NewExten event to go out after the Hangup event,
violating the basic contract consumers have of the channel lifetime. While we
could preclude the message from going out, restoring the channel's state before
it executed the next higher frame in the stack has to occur, and other places
in the code depend on this behavior.

Since we know that channel hung up (it's a ZOMBIE!), this patch simply checks
to see if the channel has been zombified before sending a NewExten event.

Note that this will fix a number of bouncing tests in the Test Suite. Go tests.

Modified:
    trunk/main/manager_channels.c

Modified: trunk/main/manager_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/manager_channels.c?view=diff&rev=392005&r1=392004&r2=392005
==============================================================================
--- trunk/main/manager_channels.c (original)
+++ trunk/main/manager_channels.c Mon Jun 17 09:40:23 2013
@@ -638,6 +638,11 @@
 		return NULL;
 	}
 
+	/* Ignore any updates if we're hungup */
+	if (ast_test_flag(&new_snapshot->flags, AST_FLAG_ZOMBIE)) {
+		return NULL;
+	}
+
 	if (old_snapshot && ast_channel_snapshot_cep_equal(old_snapshot, new_snapshot)
 		&& !strcmp(old_snapshot->appl, new_snapshot->appl)) {
 		return NULL;




More information about the svn-commits mailing list