Work on a copy with app_agi

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3039 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-05-22 04:52:50 +00:00
parent a0486afb83
commit 47133fda31

View File

@@ -1466,7 +1466,8 @@ static int agi_exec_full(struct ast_channel *chan, void *data, int enhanced, int
int res=0; int res=0;
struct localuser *u; struct localuser *u;
char *argv[MAX_ARGS]; char *argv[MAX_ARGS];
char *tmp = (char *)data; char buf[2048]="";
char *tmp = (char *)buf;
int argc = 0; int argc = 0;
int fds[2]; int fds[2];
int efd = -1; int efd = -1;
@@ -1477,7 +1478,7 @@ static int agi_exec_full(struct ast_channel *chan, void *data, int enhanced, int
ast_log(LOG_WARNING, "AGI requires an argument (script)\n"); ast_log(LOG_WARNING, "AGI requires an argument (script)\n");
return -1; return -1;
} }
strncpy(buf, data, sizeof(buf) - 1);
memset(&agi, 0, sizeof(agi)); memset(&agi, 0, sizeof(agi));
while ((stringp = strsep(&tmp, "|"))) { while ((stringp = strsep(&tmp, "|"))) {
@@ -1500,7 +1501,7 @@ static int agi_exec_full(struct ast_channel *chan, void *data, int enhanced, int
agi.fd = fds[1]; agi.fd = fds[1];
agi.ctrl = fds[0]; agi.ctrl = fds[0];
agi.audio = efd; agi.audio = efd;
res = run_agi(chan, tmp, &agi, pid, dead); res = run_agi(chan, argv[0], &agi, pid, dead);
close(fds[1]); close(fds[1]);
if (efd > -1) if (efd > -1)
close(efd); close(efd);