[asterisk-users] AGI Script with parameters

Steve Edwards asterisk.org at sedwards.com
Tue Nov 28 10:06:00 MST 2006


I write my AGI's in C and use the standard command line parser 
"getopt_long()" to parse the options passed to the AGI. It looks a little 
"wordy" but there is little doubt as to what is going on:

 	exten = s,n,agi(play-path,--debug,--path=${PROMO-PATH})

"getopt_long" does all of the heavy lifting and handles the options in any 
order and allows abbreviations. Depending on how you handle the AGI 
environment, you can even do some debugging from your shell command line.

5 years from now, which one is more "obvious?"

 	agi,/ruby/ring.rb|192.168.0.10|5010|10|y

or

 	agi(/ruby/ring.rb,--host=192.168.0.10,--port=5010,--timeout=10,--continue-on-fail=yes)

On Tue, 28 Nov 2006, Olivier Saulnier wrote:

> YES!!!!!!!!!!
> It works ;-))
>
> Best regards,
> Olivier S.
>
> Anton Frolov a écrit :
>
>> 
>> 
>> you should use a separator between the arguments as well. try
>> exten => 0470022762,2,agi,/ruby/ring.rb|192.168.0.10|5010
>>
>> 
>
> -- 
> Olivier Saulnier
> STEGANUX
> 1er étage DIAMECANS
> BEL AIR
> 03410 St-Victor
> T: 04.70.02.27.62
> F: 04.70.09.97.41
> http://www.steganux.com
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>  http://lists.digium.com/mailman/listinfo/asterisk-users
>

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