[Asterisk-Users] AGI questions..

Olle E. Johansson oej at edvina.net
Fri Oct 24 05:32:59 MST 2003


WipeOut wrote:

> 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..
Oh, flame war warning. There's been a lot of discussion on this before,
mostly about the necessity to use PHP instead of <your favorit language here>.
As I read the AGI docs, anything that you can start from a shell command
with a #!/bin/sh or #!/usr/bin/perl construct works. I may be wrong,
but otherwise start a /bin/sh and run PHP in there.

Look at AGI samples in source code and the Asterisk::AGI perl library.
Lots of good pointers to docs, faqs etc here:
http://www.voip-info.org/tiki-index.php?page=Asterisk+agi

> 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?
No, there's a special set of commands you use. One of them lets you
execute standard application commands you use in the dial plan,
not the CLI commands as I understand.

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

See docs pointed to from the Wiki. One of the sample scripts output all of
the environment variables in AGI to stderr, even though I haven't been able
to get the stderr output. Where do I read the STDERR channel?

> 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?
Good question. I can't answer.

/O




More information about the asterisk-users mailing list