[asterisk-users] deadagi on 11 and 1.4

Steve Edwards asterisk.org at sedwards.com
Mon Dec 10 15:44:01 CST 2012


On Mon, 10 Dec 2012, Jerry Geis wrote:

> How can extensions.conf be changed to work with both Asterisk 11 and 
> 1.4.X such that 1.4.X calls deadagi and 11 just calls agi as deadagi is 
> no more.

On Mon, 10 Dec 2012, Danny Nicholas wrote:

> Put a GLOBAL in extensions.conf with the version and use GOTOIF to run 
> AGI/DEADAGI dependent on it.

When do you know what version of Asterisk is executing your dialplan?

If you know at installation time, pass your dialplan through a 
preprocessor (even something as simple as sed -e 's/@DEADAGI@/deadagi/g').

If you truly don't know until execution time (and I can't imagine this is 
true), you could define a channel variable ('DEADAGI') to either 'deadagi' 
or 'agi' once and then reference it in your dialplan as:

         exten = *,n, execif(1,${MY-AGI},null-agi,--null)

At least you aren't evaluating your version condition throughout your 
dialplan.

Curiously (and unfortunately) (at least in 1.2), you can't just define a 
variable and then execute it as:

         exten = *,n, ${MY-AGI}(null-agi,--null)

I'd advise the full preprocessor approach. The additional functionality it 
provides will result in a easier to maintain system. I do it with all of 
my Asterisk 'conf' files.

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