[asterisk-users] use dial plan passed arg value in C agi code

Steve Edwards asterisk.org at sedwards.com
Fri Nov 2 17:24:29 CDT 2007


On Fri, 2 Nov 2007, James FitzGibbon wrote:

> I handle this (in Perl) using Getopt::Long, which knows nothing of AGI's 
> stdin/stdout mechanics:

The AGI variables are passed via stdin (similar to an HTTP GET request) 
and can be observed using "agi debug" at the Asterisk prompt. It's a fixed 
list you get whether you want them or not. It's a common mistake for the 
beginning AGI programmer to not read them (thus emptying stdin) and then 
wonder why their AGI's don't work correctly.

Arguments are passed to the AGI as elements of argv[] (for C, my native 
"tongue"). Thus, "Getopt:Long" (for Perl) or "getopt_long()" (for C) work 
as expected. Using a comma to separate the arguments is an "asteriskism."

Passing multiple arguments this way has worked for as long as I've been 
using Asterisk -- several years.

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000



More information about the asterisk-users mailing list