[Asterisk-Users] Important note for AGI with PHP newbies
usedcanon
usedcanon at yahoo.co.uk
Thu Jul 15 15:10:27 MST 2004
Original Message-----
From: asterisk-users-admin at lists.digium.com
[mailto:asterisk-users-admin at lists.digium.com]On Behalf Of Nathan Alpert
Sent: 15 July 2004 22:36
To: asterisk-users at lists.digium.com
Subject: [Asterisk-Users] Important note for AGI with PHP newbies
I say this note is important only because I (a AGI PHP newbie) was
tormented by this problem for many an hour, even though I'm sure it's
documented somewhere or obvious to more experienced users.
So as I was experimenting with AGI in PHP scripting I was baffled by why
Asterisk was properly receiving AGI commands written to stdout but
always returning "510 invalid command" to the stdin. For example, doing
a verbose command would properly show the message in the asterisk CLI
but it would return "510 invalid." Also, commands like GET DATA and GET
DIGIT would not work at all, even though the CLI would report "Playing
file my-file."
After spending literally hours fumbling around with different buffer
flushing schemes in PHP to no avail (I already knew I was doing the
flushing properly anyway) and sending an email to this email list, I
finally wrote a script that actually returned the proper values in
stdin.
The thing that fixed it was putting the "-q" argument in the
"#!/usr/local/php -q" thing that you put on the first line of your
script file. Apparently this argument tells PHP to supress HTML headers
or something according to the documentation. I'm still not %100 sure why
this would make a difference, but it does!
Everybody is probably already aware of this, but I wasn't, so I hope
this helps any other newbie who had the same problem.
-nate alpert
I wish more people did the same. I mean share there positive experience,
ideally it would be good if you can add your experience to the wiki (that's
where I try to do the same).
Most people (IMHO) ask questions and don't bother sharing their resolutions
with others.
Umar
More information about the asterisk-users
mailing list