diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-07-19 17:55:49 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-07-19 17:55:49 +0000 |
commit | 345f033a193d564d3caa998c9482f0e76bab80e9 (patch) | |
tree | 05eda0b515c89a64339db9af44fd9b2e2b46da04 /main | |
parent | e5d3deb2992ec3df948f188ac9f77f0e0c5ebee8 (diff) |
Made audiohooks, framehooks, and monitor prevent local channel optimization.
Audiohooks, framehooks, and monitor represent state on a local channel
that will go away if it is optimized out.
(closes issue ASTERISK-21954)
Reported by: rmudgett
Review: https://reviewboard.asterisk.org/r/2685/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394791 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/bridging.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/main/bridging.c b/main/bridging.c index 6febf61b0..4304dfb36 100644 --- a/main/bridging.c +++ b/main/bridging.c @@ -63,6 +63,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/core_local.h" #include "asterisk/core_unreal.h" #include "asterisk/features_config.h" +#include "asterisk/audiohook.h" /*! All bridges container. */ static struct ao2_container *bridges; @@ -4721,6 +4722,13 @@ static struct ast_bridge *optimize_lock_chan_stack(struct ast_channel *chan) if (!AST_LIST_EMPTY(ast_channel_readq(chan))) { return NULL; } + if (ast_channel_monitor(chan) + || (ast_channel_audiohooks(chan) + && !ast_audiohook_write_list_empty(ast_channel_audiohooks(chan))) + || !ast_framehook_list_contains_no_active(ast_channel_framehooks(chan))) { + /* Channel has an active monitor, audiohook, or framehook. */ + return NULL; + } bridge_channel = ast_channel_internal_bridge_channel(chan); if (!bridge_channel || ast_bridge_channel_trylock(bridge_channel)) { return NULL; @@ -4763,6 +4771,14 @@ static struct ast_bridge *optimize_lock_peer_stack(struct ast_channel *peer) ast_channel_unlock(peer); return NULL; } + if (ast_channel_monitor(peer) + || (ast_channel_audiohooks(peer) + && !ast_audiohook_write_list_empty(ast_channel_audiohooks(peer))) + || !ast_framehook_list_contains_no_active(ast_channel_framehooks(peer))) { + /* Peer has an active monitor, audiohook, or framehook. */ + ast_channel_unlock(peer); + return NULL; + } bridge_channel = ast_channel_internal_bridge_channel(peer); if (!bridge_channel || ast_bridge_channel_trylock(bridge_channel)) { ast_channel_unlock(peer); |