[asterisk-users] AGI Script

Steve Edwards asterisk.org at sedwards.com
Wed Mar 6 12:24:44 CST 2013


On Wed, 6 Mar 2013, Gustavo Salvador wrote:

>> I'm writing an AGI Perl Script...

>> =============================
>> #!/usr/bin/perl
>> use strict;
>>
>> my %AGI;
>> :
>> print "EXEC Dial(DAHDI/g2/$AGI{dnid},,W)";
>> =============================

Is this your entire script or just a snippet? If this is all, this is not 
an AGI.

An AGI is an executable that follows the AGI protocol. At a minimum, this 
means:

1) Read the AGI variables from STDIN.

2) Write an AGI request to STDOUT.

3) Read the AGI response from STDIN.

4) Repeat steps 2 & 3 as needed.

Asterisk creates the process executing your AGI and sends a bunch of cruft 
to it via the process's STDIN. If you don't read this, even if you don't 
need to use the variables, your AGI will not execute correctly and 
reliably.

If you do not read the response after every request, your AGI will not 
execute correctly and reliably.

Most people use an established AGI library since nobody understands the 
implications of the protocol correctly the first time.

Can you enable AGI debugging on the Asterisk console and see if that 
yields any clues?

>> When dialplan executes the AGI, asterisk throw the following error: 
>> "Dropping incompatible voice fraile on SIP/INCONCERT-00004796 of formar 
>> ulaw since our native format has changed to 0x8 (alaw)."

(Actual 'cut-n-paste' is better than 'retyping' console output.)

I think if you take another look, this is a warning, not an error. No big 
deal, it means just what it says, just ignore it.

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