Prevent unreal channels from optimizing during DTMF emulation
authorKinsey Moore <kmoore@digium.com>
Thu, 8 Aug 2013 12:38:06 +0000 (12:38 +0000)
committerKinsey Moore <kmoore@digium.com>
Thu, 8 Aug 2013 12:38:06 +0000 (12:38 +0000)
This prevents unreal channel optimization during the prequalification
phase when either channel is involved in DTMF emulation. This prevents
a situation where an emulated digit would be missed because the
emulation was never completed.

Review: https://reviewboard.asterisk.org/r/2747/
(closes issue ASTERISK-22214)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396385 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/bridge.c

index c0e7bd4..9a64b0e 100644 (file)
@@ -2198,6 +2198,9 @@ static struct ast_bridge *optimize_lock_chan_stack(struct ast_channel *chan)
        if (!AST_LIST_EMPTY(ast_channel_readq(chan))) {
                return NULL;
        }
+       if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF)) {
+               return NULL;
+       }
        if (ast_channel_has_audio_frame_or_monitor(chan)) {
                /* Channel has an active monitor, audiohook, or framehook. */
                return NULL;
@@ -2244,6 +2247,10 @@ static struct ast_bridge *optimize_lock_peer_stack(struct ast_channel *peer)
                ast_channel_unlock(peer);
                return NULL;
        }
+       if (ast_test_flag(ast_channel_flags(peer), AST_FLAG_EMULATE_DTMF)) {
+               ast_channel_unlock(peer);
+               return NULL;
+       }
        if (ast_channel_has_audio_frame_or_monitor(peer)) {
                /* Peer has an active monitor, audiohook, or framehook. */
                ast_channel_unlock(peer);