* Flush any Async AGI commands left over from earlier Async AGI control of
the call.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@313615
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
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);
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);