[Asterisk-Dev] C and AGI - 510 Invalid or Unknown Command
Darren Sessions
dsessions at ionosphere.net
Mon Jan 10 11:21:05 MST 2005
I used the eagi_test.c example with Asterisk as the basis for my eagi
application (i.e. I use all the internals in eagi_test.c to set the
enviroment and run commands, although I have changed some of the function
names - the code is intact).
My problem is that with my code (mostly mysql routines) embedded in-between
the agi stuff - when I run one agi command it works fine, but when I hit the
second AGI command it bombs with a:
'Ooh, got a response from Asterisk: '510 Invalid or unknown command'.
However, if I simply put another blank agi cmd in there (as in the example
below), it has an almost buffer flush effect it seems - in that although the
blank command fails just like cmd it replaced in the logic order of things,
the cmd AFTER the blank one works just fine now.
I have set in main (again, code identical to eagi_test.c):
setlinebuf(stdin);
setlinebuf(stdout);
I'm just wondering if I'm being a dumb ass (probable) or what.
Thanks,
- Darren
Excerpt from a function called from main:
char *ast_rc;
ast_rc = exec_agi_cmd("ANSWER");
if (!ast_rc)
{
fprintf(stderr, "Failed to execute command\n");
return (-1);
}
fprintf(stderr, "'ANSWER' RESULTS - '%s'\n", ast_rc);
exec_agi_cmd("");
ast_rc = exec_agi_cmd("EXEC WAIT 1");
if (!ast_rc)
{
fprintf(stderr, "Failed to execute command\n");
return (-1);
}
fprintf(stderr, "'EXEC WAIT 1' RESULTS - '%s'\n", ast_rc);
More information about the asterisk-dev
mailing list