summaryrefslogtreecommitdiff
path: root/main/manager_channels.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-06-17 14:40:23 +0000
committerMatthew Jordan <mjordan@digium.com>2013-06-17 14:40:23 +0000
commit50d81a58e8b7dee83bb0726e03a4e50edfce536f (patch)
tree6c7b92070f49f41262600c6e0f5bd1e7469dcc50 /main/manager_channels.c
parent0afb1949c907db4d1d212f962435d65d080ec6df (diff)
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
Diffstat (limited to 'main/manager_channels.c')
-rw-r--r--main/manager_channels.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/main/manager_channels.c b/main/manager_channels.c
index 5ae35b21d..c9e38dfbd 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;