[asterisk-users] AEL and swap from macros to contexts

Steve Murphy murf at digium.com
Mon Oct 6 17:05:08 CDT 2008


On Mon, 2008-10-06 at 18:25 +0200, Pavel Jezek wrote:
> 
> Atis Lezdins wrote:
> > On Mon, Oct 6, 2008 at 5:21 PM, Pavel Jezek <pavel.jezek at i.cz> wrote:
> >   
> >> Hi, according to discussion on asterisk IRC, where people said, that
> >> macros will be depracated, I tried to migrate from macros to contexts
> >> and Gosub
> >> but if I try to use gosub in extensions.ael, ael compiler complains,
> >> that I shouln't use Gosub app,
> >> but I can't find ael keyword, that will be Gosub equivalent, or can I
> >> ignore this ael warnings? thanks
> >> PJ
> >>
> >>
> >> LOG: lev:3 file:pval.c  line:2521 func: check_pval_item  Warning: file
> >> /etc/asterisk/extensions.ael, line 36-36: application call to Gosub
> >> affects flow of control, and needs to be re-written using AEL if, while,
> >> goto, etc. keywords instead!
> >>     
> >
> > Hi,
> >
> > In definition use:
> >
> > macro set_record(A,B) {
> >   // do something
> > }
> >
> > And for calling:
> >
> > &set_record(${CALLERID(NUM)},${EXTEN});
> >
> > It will automatically be translated to GoSub in 1.6, but will remain
> > as Macro in 1.4.
> >   
> 
> yes, I know, but I hear on IRC, that macros will be deprecated and 
> suggestion was to move to contexts,
> personaly I would like also move away from macros, because macros have 
> some limitations, eg. variable number of arguments isn't possible with 
> classic macros,
> macros also require variable to be defined in macro definition (that is 
> needless, because I'm referecing to ARG1, ARG2 etc. inside macros)
> so I definitively agree with moving from macros to contexts, only one 
> bad thing is compiler warning, when I try to Gosub to context (as macro 
> replacement)
> PJ
> 
> 

Pavel--

Yes, you can ignore the warnings and go ahead and hardcoded gosub calls
into your source. I didn't upgrade 1.4 to use gosub-instead-of-macro
because
the key element ended up being "calling gosub with arguments", which
didn't
make it into 1.4.

Someday, when you upgrade from 1.4 to 1.6, you will have to change
all your gosub's to use the argument passing feature, if you hardcode
gosubs now. Or, you can backport the gosub-with-arguments feature to
1.4,
and use 1.6 AEL to compile... which will give you some future
portability
when you do move to 1.6...

Sorry to make simple things sound so complicated!

murf


> 
> > Regards,
> > Atis
> >
> >
> >
> >   
> 
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> 
> AstriCon 2008 - September 22 - 25 Phoenix, Arizona
> Register Now: http://www.astricon.net
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
-- 
Steve Murphy
Software Developer
Digium
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3227 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20081006/156ebfc2/attachment.bin 


More information about the asterisk-users mailing list