[Asterisk-Users] Having serious problems with AGI

Nathan Alpert asterisk at demicrosystems.com
Wed Jul 14 06:12:11 MST 2004


Hi All,

I've been working with AGI for the past week or so building a fairly
complex IVR system with database functionality. Most of the work up to
this point has been with basically one-way scripts that look up some
info in the database and say the data back to the user with the "EXEC
Playback my-file" AGI command.

However, now I am working on scripts that need to accept user DTMF tones
with "GET DATA" and "WAIT FOR DIGIT" commands and I noticed a major
problem. When reading the stdin, these commands ALWAYS return "510
invalid command." Just for testing purposes I examined the return values
for the commands that were working (superficially) before like "EXEC
Playback my-file" and they were returning "510 invalid command" also,
even though the sounds play properly. Even using the simplest AGI
command "VERBOSE" the stdin result is "510 invalid"!

I am doing the scripting in PHP and this is getting extremely
frustrating as I am sure I am writing the commands properly to stdout
with a terminating "\n" and then explicitly flushing the stdout buffer
before reading the response on stdin.

Just to lay out some of the specifics of the problems:

1) No AGI command, including EXEC <application> and VERBOSE return a
response other than "510 invalid"

2) AGI commands that explicitly play sound files, like GET DATA, SAY
DIGITS etc. do not play the sound files, even though the CLI console in
highly verbose mode shows that the files are being played, e.g. "Playing
file my-file".

3) All Asterisk application commands run through "EXEC <application>
<options> seem to properly run and play their sound files (if
applicable), but return "510" to stdin.

4) (For people familiar with PHP) I have tried all of the following to
no avail: ob_implicit_flush(true/false); accessing stdout with $out =
fopen("php://stdout", "w"), writing to it with fputs($out, $str . "\n"),
and then flusing it with fflush($out), instead of my original attempt to
do it with echo() followed by flush(). Hopefully this is not misleading
since both methods properly get the commands to Asterisk, they just
still return "510".


Has anyone else had this problem or am I just on crazy pills? Any
suggestions would be greatly appreciated.

Thanks,
-Nate Alpert
asterisk at demicrosystems.com




More information about the asterisk-users mailing list