[Asterisk-Users] AGI questions..

Brancaleoni Matteo mbrancaleoni at espia.it
Fri Oct 24 17:00:50 MST 2003


> I understand that AGI works using STDIN and STDOUT, so does that mean 
> that I would simply "echo" the standard Asterisk commands that I wanted 
> Asterisk to execute and it would process them?

be aware of that! don't use echo ... it's buffered and some
commands don't get sent or sent too later. also
using flush() to empty the buffer doesn't work ;)
I had bad times on a php script that didn't got
my commands via echo()....

use file descriptors for it (stderr & stdin).

but...
at least on php 4.3.3 (but think there's from 4.3)
php , cli version only, as a nice feature ... as you fire
up a script from cli, php is kind enough to provide
you with 2 special, alreay open file descriptors:
STDIN & STDOUT ... you can do things like
fputs(STDOUT,$str,$strlen) without doing annoying fopens & fcloses ;)
a sort of streams always open during the script execution,
and works great here ;)

matteo.


-- 
Brancaleoni Matteo <mbrancaleoni at espia.it>
Espia - Emmegi Srl




More information about the asterisk-users mailing list