From: Kinsey Moore Date: Mon, 10 Jun 2013 16:03:51 +0000 (+0000) Subject: Add AGI command arguments to AsyncAGI event X-Git-Tag: 13.0.0-beta1~1689 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8cb0c33e48312039ca8ea7e77212795c49de8303;p=thirdparty%2Fasterisk.git Add AGI command arguments to AsyncAGI event This makes the AGI AsyncAGI event put provided AGI command arguments in the event's environment. (closes issue ASTERISK-21304) Patch-By: Dirk Wendland git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391271 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_agi.c b/res/res_agi.c index 22f8b26a34..486310dd6b 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1371,7 +1371,7 @@ static enum agi_result async_agi_read_frame(struct ast_channel *chan) return AGI_RESULT_SUCCESS; } -static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], int *efd) +static enum agi_result launch_asyncagi(struct ast_channel *chan, int argc, char *argv[], int *efd) { /* This buffer sizes might cause truncation if the AGI command writes more data than AGI_BUF_SIZE as result. But let's be serious, is there an AGI command @@ -1438,7 +1438,7 @@ static enum agi_result launch_asyncagi(struct ast_channel *chan, char *argv[], i /* notify possible manager users of a new channel ready to receive commands */ - setup_env(chan, "async", fds[1], 0, 0, NULL); + setup_env(chan, "async", fds[1], 0, argc, argv); /* read the environment */ res = read(fds[0], agi_buffer, AGI_BUF_SIZE); if (res <= 0) { @@ -1794,7 +1794,7 @@ static enum agi_result launch_ha_netscript(char *agiurl, char *argv[], int *fds) return AGI_RESULT_FAILURE; } -static enum agi_result launch_script(struct ast_channel *chan, char *script, char *argv[], int *fds, int *efd, int *opid) +static enum agi_result launch_script(struct ast_channel *chan, char *script, int argc, char *argv[], int *fds, int *efd, int *opid) { char tmp[256]; int pid, toast[2], fromast[2], audio[2], res; @@ -1807,7 +1807,7 @@ static enum agi_result launch_script(struct ast_channel *chan, char *script, cha return (efd == NULL) ? launch_ha_netscript(script, argv, fds) : AGI_RESULT_FAILURE; } if (!strncasecmp(script, "agi:async", sizeof("agi:async") - 1)) { - return launch_asyncagi(chan, argv, efd); + return launch_asyncagi(chan, argc, argv, efd); } if (script[0] != '/') { @@ -4110,7 +4110,7 @@ static int agi_exec_full(struct ast_channel *chan, const char *data, int enhance return -1; } #endif - res = launch_script(chan, args.argv[0], args.argv, fds, enhanced ? &efd : NULL, &pid); + res = launch_script(chan, args.argv[0], args.argc, args.argv, fds, enhanced ? &efd : NULL, &pid); /* Async AGI do not require run_agi(), so just proceed if normal AGI or Fast AGI are setup with success. */ if (res == AGI_RESULT_SUCCESS || res == AGI_RESULT_SUCCESS_FAST) {