[asterisk-users] AGI

Steve Edwards asterisk.org at sedwards.com
Fri Mar 15 18:54:38 CDT 2013


Please don't top post.

On Fri, 15 Mar 2013, Gustavo Salvador wrote:

> The reason I have not to use an AGI library and also use bash shells is 
> because the asterisk box I'm working on, have not AGI library, there is 
> installed on a basic first version of Centos, and it is not an asterisk 
> pure box. It's from a vendor, and also have some annoyances specially 
> with the settings and configuration files. And I can not upgrade it, 
> because it is running production.

> By the way, I have just get what I need. The bash shell if anyone is 
> interested is:
>
> #!/usr/bin/bash
> echo "EXEC \"Dial\" \"DAHDI/g2/$1\""
> read line

Can we at least pretend to follow the protocol? :)

#!/bin/bash

# discard the AGI variables
         while   [ -s "$(read)" ]
                 do
                 :
                 done

# dial the number from the command line
         echo "exec dial dahdi/g2/$1"

# ignore the response
         read

# (end of agiFile.agi)

At least this way, the 'next guy' won't pull out his hair wondering why 
the response to 'dial' is 'agi_request: agiFile.agi'

BTW, you do not have to name an AGI 'example.agi'. 'example.sh' or just 
'example' will do just fine.

If you don't have PHP or Perl, how about C? You could always compile on a 
VM on another box.

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