[asterisk-users] AEL in 1.6 and Gosub

Elliot Murdock murdocke at gmail.com
Wed Mar 17 09:19:19 CDT 2010


Hello Klaus,

Just for your quick reference, here are some other changes in the AEL
from versions 1.4 to 1.6 (source:
http://asteriskuptospeed.linuxinnovations.com/core1.4-1.6.2.html and
CHANGES file) :

Macros are now implemented underneath with the Gosub() application.
Heaven Help You if you wrote code depending on any aspect of this!
Previous to 1.6, macros were implemented with the Macro() app, which
provided a nice feature of auto-returning. The compiler will do its
best to insert a Return() app call at the end of your macro if you did
not include it, but really, you should make sure that all execution
paths within your macros end in "return;".

The conf2ael program is 'introduced' in this release; it is in a
rather crude state, but deemed useful for making a first pass at
converting extensions.conf code into AEL. More intelligence will come
with time.

AEL upgraded to use the Gosub with Arguments instead of Macro
application, to hopefully reduce the problems seen with the
artificially low stack ceiling that Macro bumps into. Macros can only
call other Macros to a depth of 7. Tests run using gosub, show depths
limited only by virtual memory. A small test demonstrated recursive
call depths of 100,000 without problems. -- in addition to this, all
apps that allowed a macro to be called, as in Dial, queues, etc, are
now allowing a gosub call in similar fashion.

AEL now generates LOCAL(argname) declarations when it Set()'s the each
arg name to the value of ${ARG1}, ${ARG2), etc. That makes the
arguments local in scope. The user can define their own local
variables in macros, now, by saying "local myvar=someval;" or using
Set() in this fashion: Set(LOCAL(myvar)=someval); ("local" is now an
AEL keyword).
utils/conf2ael introduced. Will convert an extensions.conf file into
extensions.ael. Very crude and unfinished, but will be improved as
time goes by. Should be useful for a first pass at conversion.

aelparse will now read extensions.conf to see if a referenced macro or
context is there before issueing a warning.

AEL parser sets a local channel variable ~~EXTEN~~, to preserve the
value of ${EXTEN} thru switch statements.

New operator in $[...] expressions: the ~~ operator serves as a
concatenation operator. AT THE MOMENT, it is really only necessary and
useful in AEL, especially in if() expressions. Operation: ${a} ~~ ${b|
with force both a and b to strings, strip any enclosing double-quotes,
and evaluate to the value of a concatenated with the value of b. For
example if a is set to "xyz" and b has the value "abc", then ${a} ~~
${b| would evaluate to xyzabc

Good luck with your upgrade!
Elliot

On Wed, Mar 17, 2010 at 12:48 PM, Klaus Darilion
<klaus.mailinglists at pernau.at> wrote:
>
>
> Am 17.03.2010 00:40, schrieb Steve Murphy:
> >
> >
>
> > How about:
> >
> >        ....
> > &blacklist(${exten});
> >        ....
> >
> > macro blacklist(the_exten)
> > {
> >      switch(the_exten)
> >      {
> >      pattern +4390[01]: Hangup();
> >      default: return;
> >      }
> > }
>
> Yes, that would work. I didn't knew the "pattern" statement.
>
> > Basically, you are using the pattern matching capability to
> > end the call for certain extensions... so the above should
> > come close. If you really, really want to keep your gosub call,
> > then you can, you'll just have to ignore the warnings, iirc.
>
> I think I will just ignore it :-)
>
> thanks
> klaus
>
>
> --
> _____________________________________________________________________
> -- 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



More information about the asterisk-users mailing list