[Asterisk-Users] AGI questions..

Steven Critchfield critch at basesys.com
Fri Oct 24 08:04:33 MST 2003


On Fri, 2003-10-24 at 06:54, WipeOut wrote:
> Hi,
> 
> First off, can AGI scripts be created using PHP??.. This is where our 
> skills are and since PHP can be run from a command line it would be 
> easier to create and maintain..

You can use php, but php is just perl lite. if you do anything more than
a trivial app, you will want to be in something more than php. Take for
instance all the modules you have in CPAN that can deal with audio,
databases and any number of odd things you need to have.

> 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?

Echo or print, just make sure you understand that you need to flush the
input/output after each command.  

> Are any call variables passed to the AGI script on execution? Where can 
> I get a list of these?

All of them are passed via the stdin at the beginning, some will vary
depending on what is available on your channel. Write your script and
check it out. 

> Finally, If I execute a call from within an AGI script, will the script 
> continue processing when the call is hung up or terminated or would I 
> have to use another AGI on the "h" extension to process post call 
> operations?

If you are running agi commands instead of asterisk commands, you will
receive a result code back from AGI that will indicate a hangup. At this
point AGI will no longer accept commands, but your app is still running
and can do post processing. In the apps my company has running, we use
this time to clean up our session and send off files to be processed.

-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-users mailing list