[asterisk-users] AEL and swap from macros to contexts
Atis Lezdins
atis at iq-labs.net
Tue Oct 7 05:09:54 CDT 2008
On Tue, Oct 7, 2008 at 8:45 AM, Pavel Jezek <pavel.jezek at i.cz> wrote:
>
>
> Steve Murphy wrote:
>> 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
>>
>>
> murf, thank you for clear answer,
> currently, I'm using asterisk trunk (and 1.6 also),
> do you plan to remove quite confusing AEL warnings, that appears, when I
> try to hardcode Gosub with arguments into ael dialplan?
Why would you still want to hardcode them?
Please see above sample, you can use prefixing with "and" (&).
Regards,
Atis.
> PJ
>
>
>>>> 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
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> -- 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
>
> _______________________________________________
> -- 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
>
--
Atis Lezdins,
VoIP Project Manager / Developer,
atis at iq-labs.net
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835
More information about the asterisk-users
mailing list