aboutsummaryrefslogtreecommitdiffstats
path: root/main/autoservice.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-12 13:55:30 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-12 13:55:30 +0000
commitee91d064cd6d2c0226894a3e1ea602c16e182ed0 (patch)
tree143f7c7d4409292fc6d174119b3557cfc70875ef /main/autoservice.c
parent1839eec395053f29102edcb8c887debb463dfe15 (diff)
Merged revisions 163448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r163448 | russell | 2008-12-12 07:44:08 -0600 (Fri, 12 Dec 2008) | 26 lines Resolve issues that could cause DTMF to be processed out of order. These changes come from team/russell/issue_12658 1) Change autoservice to put digits on the head of the channel's frame readq instead of the tail. If there were frames on the readq that autoservice had not yet read, the previous code would have resulted in out of order processing. This required a new API call to queue a frame to the head of the queue instead of the tail. 2) Change up the processing of DTMF in ast_read(). Some of the problems were the result of having two sources of pending DTMF frames. There was the dtmfq and the more generic readq. Both were used for pending DTMF in various scenarios. Simplifying things to only use the frame readq avoids some of the problems. 3) Fix a bug where a DTMF END frame could get passed through when it shouldn't have. If code set END_DTMF_ONLY in the middle of digit emulation, and a digit arrived before emulation was complete, digits would get processed out of order. (closes issue #12658) Reported by: dimas Tested by: russell, file Review: http://reviewboard.digium.com/r/85/ ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@163449 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/autoservice.c')
-rw-r--r--main/autoservice.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/main/autoservice.c b/main/autoservice.c
index d3d0333d1..26cb08582 100644
--- a/main/autoservice.c
+++ b/main/autoservice.c
@@ -56,6 +56,9 @@ struct asent {
* it gets stopped for the last time. */
unsigned int use_count;
unsigned int orig_end_dtmf_flag:1;
+ /*! 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. */
AST_LIST_HEAD_NOLOCK(, ast_frame) deferred_frames;
AST_LIST_ENTRY(asent) list;
};
@@ -161,7 +164,7 @@ static void *autoservice_run(void *ign)
}
if ((dup_f = ast_frdup(defer_frame))) {
- AST_LIST_INSERT_TAIL(&ents[i]->deferred_frames, dup_f, frame_list);
+ AST_LIST_INSERT_HEAD(&ents[i]->deferred_frames, dup_f, frame_list);
}
break;
@@ -292,10 +295,12 @@ int ast_autoservice_stop(struct ast_channel *chan)
ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
}
+ ast_channel_lock(chan);
while ((f = AST_LIST_REMOVE_HEAD(&as->deferred_frames, frame_list))) {
- ast_queue_frame(chan, f);
+ ast_queue_frame_head(chan, f);
ast_frfree(f);
}
+ ast_channel_unlock(chan);
free(as);