Hi, Thank you. 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 AGI invocation: AGI(agiFile.agi,${CALLERID(num)}) Regards, Gustavo El 14/03/2013, a las 17:24, Steve Edwards <asterisk....@sedwards.com> escribió: > (A more specific subject may yield better answers -- better bait == better > fish.) > > On Thu, 14 Mar 2013, Gustavo Salvador wrote: > >> Does any one knows how to place a call from a shell agi? I guess is >> something like echo Exec Dial(DAHDI/g2/2010,,W). > > While you can write an AGI in any language that has reasonable STDIN/STDOUT > facilities (fortran was a little bit frustrating), a shell language like bash > would not be my first choice. > > Is there any reason you are not open to using a more 'mainstream' scripting > language like Perl or PHP? You'll find more people with that experience > willing to help. > > My personal favorite is to use C because I know it best and because it is a > compiled language so your AGIs execute 'instantaneously.' > > Whatever language you choose, use an established library for the AGI > protocol. Nobody gets it right the first time. > >> Algo how i get the dnid variable? > > This implies that you need to read up a bit on the AGI protocol. The second* > thing an AGI should to is read the AGI variables -- one of which is agi_dnid. > > You can pass command line parameters to your AGI when you execute the agi() > function in your dialplan. For example: > > exten = *,n, agi(my-first-agi,${AGENT-ID}) > > Your AGI can then access the command line arguments as you would > normally expect for a program executed from a shell -- $argv[1], > $argv[2], etc for PHP. > > Personally, I dislike 'positional' parameters. I prefer to use the > getopt_long() function so my dialplan is 'self-documenting' and easier > to maintain so for me, the same command would look like: > > exten = *,n, agi(my-first-agi,--agent-id=${AGENT-ID}) > > The difference is not all that apparent with a single parameter, but if you > have a half-dozen, it is much more obvious and once you've make the change, > you will always use it for consistency. > > *) The first thing an AGI should do is set up a signal handler to catch > 'SIGHUP' if the channel is hung up prematurely. > > -- > Thanks in advance, > ------------------------------------------------------------------------- > Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST > Newline Fax: +1-760-731-3000 > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users