[Asterisk-Users] new2agi -php

Florian Overkamp florian at obsimref.com
Sun Mar 7 00:53:03 MST 2004


Hi, 

> -----Original Message-----
> I am trying to write an agi script using php. Nothing fancy 
> just simple script first.
>  
> I call the php script from the extensions.conf
>  
> exten => 91234/1001,1,Wait,1
> exten => 91234/1001,2,AGI,test.agi
> exten => 91234/1001,3,Hangup

Hmm, sure you don't need to Answer somewhere ?

> #!/usr/bin/php -q
> <?php
> ob_implicit_flush(true);
> set_time_limit(6);
> $stdout = fopen('php://stdout', 'w');
> fwrite($stdout,"STREAM FILE demo-congrats" ); fflush($stdout); ?>
>  
> * telles me "Error in Argument 1, char 3, option not found. ". 
>  
> script can be run from command line.

STREAM FILE takes one more argument: The keys that will interrupt playback.
In my scripts, if not using any keys, I simply use 'X'. So STREAM FILE
demo-congrats becomes STREAM FILE demo-congrats X. Maybe (not sure) you also
need a \n at the endo of your fwrite...

I'm not sure if that will do the trick, but if the file permissions
(execution bit) and all is set properly, I think it should do.

Florian




More information about the asterisk-users mailing list