[asterisk-commits] rmudgett: branch 1.8 r313615 - /branches/1.8/res/res_agi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 13 12:18:55 CDT 2011


Author: rmudgett
Date: Wed Apr 13 12:18:49 2011
New Revision: 313615

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=313615
Log:
* 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.

Modified:
    branches/1.8/res/res_agi.c

Modified: branches/1.8/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/res/res_agi.c?view=diff&rev=313615&r1=313614&r2=313615
==============================================================================
--- branches/1.8/res/res_agi.c (original)
+++ branches/1.8/res/res_agi.c Wed Apr 13 12:18:49 2011
@@ -1115,6 +1115,8 @@
 		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);
@@ -1219,6 +1221,11 @@
 	if (add_to_agi(chan)) {
 		ast_log(LOG_ERROR, "failed to start Async AGI on channel %s\n", chan->name);
 		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




More information about the asterisk-commits mailing list