diff options
author | Richard Mudgett <rmudgett@digium.com> | 2011-04-13 17:21:50 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2011-04-13 17:21:50 +0000 |
commit | 9b559e5984092190d7dca9657fba4a4841173b73 (patch) | |
tree | bf0cd3f4e887f8e2ee04407652199ea7a250c1ab /res | |
parent | c16d39ea8359a212998e494627853fb4b5da9932 (diff) |
Merged revisions 313615 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r313615 | rmudgett | 2011-04-13 12:18:49 -0500 (Wed, 13 Apr 2011) | 5 lines
* Add missing channel lock to handle_cli_agi_add_cmd().
* Flush any Async AGI commands left over from earlier Async AGI control of
the call.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@313629 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r-- | res/res_agi.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/res/res_agi.c b/res/res_agi.c index 5a95d1c6e..1fc0daaac 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1115,6 +1115,8 @@ static char *handle_cli_agi_add_cmd(struct ast_cli_entry *e, int cmd, struct ast return CLI_FAILURE; } + ast_channel_lock(chan); + if (add_agi_cmd(chan, a->argv[3], (a->argc > 4 ? a->argv[4] : ""))) { ast_log(LOG_WARNING, "failed to add AGI command to queue of channel %s\n", chan->name); ast_channel_unlock(chan); @@ -1221,6 +1223,11 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i return AGI_RESULT_FAILURE; } + /* Flush any stale commands. */ + while ((cmd = get_agi_cmd(chan))) { + free_agi_cmd(cmd); + } + /* this pipe allows us to create a "fake" AGI struct to use the AGI commands */ res = pipe(fds); |