From: Matthew Jordan Date: Mon, 17 Jun 2013 14:40:23 +0000 (+0000) Subject: Prevent sending a NewExten event after a Hangup during a stack restore X-Git-Tag: 13.0.0-beta1~1657 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=50d81a58e8b7dee83bb0726e03a4e50edfce536f;p=thirdparty%2Fasterisk.git 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. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392005 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/manager_channels.c b/main/manager_channels.c index 5ae35b21d6..c9e38dfbda 100644 --- a/main/manager_channels.c +++ b/main/manager_channels.c @@ -638,6 +638,11 @@ static struct ast_manager_event_blob *channel_newexten( 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;