[Asterisk-Users] Important note for AGI with PHP newbies
brian
brian at bkw.org
Thu Jul 15 15:31:07 MST 2004
Because php belongs on the web so it defaults to outputting html headers.
bkw
> -----Original Message-----
> From: asterisk-users-admin at lists.digium.com [mailto:asterisk-users-
> admin at lists.digium.com] On Behalf Of Nathan Alpert
> Sent: Thursday, July 15, 2004 4:36 PM
> 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
>
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list