[asterisk-users] Urgent help = RUBY & AGI

Steve Edwards asterisk.org at sedwards.com
Thu Jul 29 09:48:17 CDT 2010


On Thu, 29 Jul 2010, Danny Nicholas wrote:

> I’m a PERL weenie, so I can “shell check” my agi’s by going to 
> /var/lib/asterisk/agi-bin and doing
> 
> ./cityweather.agi 777702107 Birmingham AL 35244 en
> 
> And getting back a STDOUT output that simulates what I should get from 
> the CLI output.

You can go a step further and feed the AGI environment and responses to 
your AGI requests.

Create a file like:

agi_accountcode:
agi_callerid: 1234567890
agi_calleridname: sedwards
.
.
.
agi_request: cityweather.agi
agi_type: SIP
agi_uniqueid: 1195070681.28

200 result=1 (localhost)
200 result=1 (dbuser)
200 result=1 (dbpass)

This would feed the AGI environment* and database credentials (via channel 
variables) to your AGI when executed like:

 	./cityweather.agi 777702107 Birmingham AL 35244 en <agi-env-n-resp

As long as you don't need to directly interact with a "live" Asterisk 
instance (like the OP), you can get a lot of debugging done "offline."

*) At least 1 of the published AGI libraries assumes the environment is 
presented in a specific order. Personally, I prefer to present the 
environment in alphabetic order and coded my library to parse it 
correctly.

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