From 9e4e6b976680b9cc38776688680c27a511f96c93 Mon Sep 17 00:00:00 2001 From: tilghman Date: Tue, 20 Jul 2010 22:26:23 +0000 Subject: Merged revisions 278167 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r278167 | tilghman | 2010-07-20 15:59:06 -0500 (Tue, 20 Jul 2010) | 4 lines Do not queue up DTMF frames while a call is on hold. (Fixes ABE-2110) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@278272 f38db490-d61c-443f-a65b-d21fe96a405b --- main/autoservice.c | 22 +++++++++++++++++++++- main/features.c | 7 +++++++ 2 files changed, 28 insertions(+), 1 deletion(-) (limited to 'main') diff --git a/main/autoservice.c b/main/autoservice.c index 271902f31..35a66205a 100644 --- a/main/autoservice.c +++ b/main/autoservice.c @@ -56,6 +56,7 @@ struct asent { * it gets stopped for the last time. */ unsigned int use_count; unsigned int orig_end_dtmf_flag:1; + unsigned int ignore_frame_types; /*! Frames go on at the head of deferred_frames, so we have the frames * from newest to oldest. As we put them at the head of the readq, we'll * end up with them in the right order for the channel's readq. */ @@ -286,7 +287,9 @@ int ast_autoservice_stop(struct ast_channel *chan) ast_channel_lock(chan); while ((f = AST_LIST_REMOVE_HEAD(&as->deferred_frames, frame_list))) { - ast_queue_frame_head(chan, f); + if (!((1 << f->frametype) & as->ignore_frame_types)) { + ast_queue_frame_head(chan, f); + } ast_frfree(f); } ast_channel_unlock(chan); @@ -296,6 +299,23 @@ int ast_autoservice_stop(struct ast_channel *chan) return res; } +int ast_autoservice_ignore(struct ast_channel *chan, enum ast_frame_type ftype) +{ + struct asent *as; + int res = -1; + + AST_LIST_LOCK(&aslist); + AST_LIST_TRAVERSE(&aslist, as, list) { + if (as->chan == chan) { + res = 0; + as->ignore_frame_types |= (1 << ftype); + break; + } + } + AST_LIST_UNLOCK(&aslist); + return res; +} + void ast_autoservice_init(void) { ast_cond_init(&as_cond, NULL); diff --git a/main/features.c b/main/features.c index 5b4bc80d6..46eee14d3 100644 --- a/main/features.c +++ b/main/features.c @@ -1321,6 +1321,7 @@ static int play_message_in_bridged_call(struct ast_channel *caller_chan, struct /* First play for caller, put other channel on auto service */ if (ast_autoservice_start(callee_chan)) return -1; + ast_autoservice_ignore(callee_chan, AST_FRAME_DTMF_END); if (ast_stream_and_wait(caller_chan, audiofile, "")) { ast_log(LOG_WARNING, "Failed to play automon message!\n"); ast_autoservice_stop(callee_chan); @@ -1331,6 +1332,7 @@ static int play_message_in_bridged_call(struct ast_channel *caller_chan, struct /* Then play for callee, put other channel on auto service */ if (ast_autoservice_start(caller_chan)) return -1; + ast_autoservice_ignore(caller_chan, AST_FRAME_DTMF_END); if (ast_stream_and_wait(callee_chan, audiofile, "")) { ast_log(LOG_WARNING, "Failed to play automon message !\n"); ast_autoservice_stop(caller_chan); @@ -1475,6 +1477,7 @@ static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel * if (!ast_strlen_zero(courtesytone)) { if (ast_autoservice_start(callee_chan)) return -1; + ast_autoservice_ignore(callee_chan, AST_FRAME_DTMF_END); if (ast_stream_and_wait(caller_chan, courtesytone, "")) { ast_log(LOG_WARNING, "Failed to play courtesy tone!\n"); ast_autoservice_stop(callee_chan); @@ -1624,6 +1627,7 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p transferer_real_context = real_ctx(transferer, transferee); /* Start autoservice on chan while we talk to the originator */ ast_autoservice_start(transferee); + ast_autoservice_ignore(transferee, AST_FRAME_DTMF_END); ast_indicate(transferee, AST_CONTROL_HOLD); memset(xferto, 0, sizeof(xferto)); @@ -1771,6 +1775,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st transferer_real_context = real_ctx(transferer, transferee); /* Start autoservice on chan while we talk to the originator */ ast_autoservice_start(transferee); + ast_autoservice_ignore(transferee, AST_FRAME_DTMF_END); ast_indicate(transferee, AST_CONTROL_HOLD); /* Transfer */ @@ -2048,6 +2053,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st while (!newchan && !atxferdropcall && tries < atxfercallbackretries) { /* Trying to transfer again */ ast_autoservice_start(transferee); + ast_autoservice_ignore(transferee, AST_FRAME_DTMF_END); ast_indicate(transferee, AST_CONTROL_HOLD); newchan = feature_request_and_dial(transferer, transferee, "Local", @@ -2404,6 +2410,7 @@ static int feature_exec_app(struct ast_channel *chan, struct ast_channel *peer, } ast_autoservice_start(idle); + ast_autoservice_ignore(idle, AST_FRAME_DTMF_END); if(work && idle) { pbx_builtin_setvar_helper(work, "DYNAMIC_PEERNAME", idle->name); -- cgit v1.2.3