mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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: https://origsvn.digium.com/svn/asterisk/branches/1.4@163448 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -61,6 +61,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;
|
||||
};
|
||||
@@ -166,7 +169,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;
|
||||
@@ -298,10 +301,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);
|
||||
|
||||
|
Reference in New Issue
Block a user