[asterisk-dev] AEL and switch breaks ${EXTEN}, bug in AEL compiler?
Steve Murphy
murf at digium.com
Wed Feb 11 11:16:54 CST 2009
On Thu, 2009-02-05 at 13:18 +0100, Klaus Darilion wrote:
> Hi!
>
> I use Asterisk 1.4.23. I have macro which uses ${MACRO_EXTEN} to access
> the original dialed extension. The problem arises when I use this macro
> in an AEL context which uses switch() conditions:
>
> Please see the attached context (as attachment to avoid line wrapping in
> the email).
>
Klaus--
Your attachment is the post-compiled, extensions.conf-format version
of the dialplan. Please include the macro and contexts from your
dialplan,
so I can see better what's going on and why.
murf
> The switch happens in priority 13:
> 13. Goto(sw-445-${X-PROP-CLIPNOSCREEN}|10) [pbx_ael]
>
> it jumps to extension sw-445-2. From there it jumps after the switch()
> construct.
> 'sw-445-2' => 10. Goto(_[+1-9].|14)
>
> Here I wonder why it uses the pattern _[+1-9]. instead of the originally
> dialed number (which is stored in ~~EXTEN~~).
>
> Then it calls my macro in
>
> 20. Macro(blacklistMakro)
>
>
> Here this macro uses ${MACRO_EXTEN} which does not work as
> ${MACRO_EXTEN} contains _[+1-9]. instead of the originally dialed number.
>
>
> Of course I could work around it by calling the macro with a parameter
> to signal the extensions, but IMO the macro should work from an AEL
> context as from a normal context.
>
> Maybe it is a bug in the AEL compiler when jumping out of the switch
> construct.
>
> regards
> klaus
> plain text document attachment (context.txt)
> 'sw-445-' => 10. Goto(sw-445-.|10) [pbx_ael]
> 'sw-445-1' => 10. Set(X-PROP-AN=${X-PROP-KOPFNUMMER}) [pbx_ael]
> 11. Goto(_[+1-9].|14) [pbx_ael]
> 'sw-445-2' => 10. Goto(_[+1-9].|14) [pbx_ael]
> '_sw-445-.' => 10. Set(X-PROP-AN=${X-PROP-KOPFNUMMER}) [pbx_ael]
> 11. GotoIf($[${EXISTS(${X-PROP-AU})}]?12:17) [pbx_ael]
> 12. Set(len=${LEN(${X-PROP-AU})}) [pbx_ael]
> 13. GotoIf($[ "${X-PROP-AU:0:${len}}"!="${X-PROP-KOPFNUMMER}" ]?14:16) [pbx_ael]
> 14. NoOp(Trunk-peer signals wrong CLI ) [pbx_ael]
> 15. Set(X-PROP-AU=) [pbx_ael]
> 16. NoOp(Finish if-if-sw-fromSipTrunking-default-445-446-447) [pbx_ael]
> 17. NoOp(Finish if-sw-fromSipTrunking-default-445-446) [pbx_ael]
> 18. Goto(_[+1-9].|14) [pbx_ael]
> '_[+1-9].' => 1. Set(~~EXTEN~~=${EXTEN}) [pbx_ael]
> 2. Wait(1) [pbx_ael]
> 3. Macro(checkE164OrDeleteMakro|X-PROP-AN) [pbx_ael]
> 4. Macro(checkE164OrDeleteMakro|X-PROP-AU) [pbx_ael]
> 5. Macro(checkE164OrDeleteMakro|X-PROP-C) [pbx_ael]
> 6. GotoIf($[${ISNULL(${X-PROP-AN})}]?7:9) [pbx_ael]
> 7. Set(X-PROP-AN=${X-PROP-KOPFNUMMER}) [pbx_ael]
> 8. Set(X-PROP-CLIR=1) [pbx_ael]
> 9. NoOp(Finish if-fromSipTrunking-443) [pbx_ael]
> 10. GotoIf($[${ISNULL(${X-PROP-CLIPNOSCREEN})}]?11:12) [pbx_ael]
> 11. Set(X-PROP-CLIPNOSCREEN=0) [pbx_ael]
> 12. NoOp(Finish if-fromSipTrunking-444) [pbx_ael]
> 13. Goto(sw-445-${X-PROP-CLIPNOSCREEN}|10) [pbx_ael]
> 14. NoOp(Finish switch-fromSipTrunking-445) [pbx_ael]
> 15. Set(CALLERID(num)=${X-PROP-AN}) [pbx_ael]
> 16. Set(CALLERID(name)=${X-PROP-AU}) [pbx_ael]
> 17. Set(X-PROP-USERFIELD=TRUNKINGID=${SIPCHANINFO(peername)}) [pbx_ael]
> 18. Gosub(toNotrufe|${~~EXTEN~~}|1) [pbx_ael]
> 19. Macro(checkBlockingOutgoingMakro) [pbx_ael]
> 20. Macro(blacklistMakro) [pbx_ael]
> 21. Gosub(toKurzrufe|${~~EXTEN~~}|1) [pbx_ael]
> 22. Macro(setOfisSipHeaderMakro) [pbx_ael]
> 23. Set(TIMEOUT(absolute)=${GLOBAL(X-PROP-TRUNKING-MAXCALLDURATION)}) [pbx_ael]
> 24. Macro(dialToGwAsteriskMakro|${~~EXTEN~~}|${GLOBAL(X-PROP-MAXRINGDURATION)}) [pbx_ael]
> 25. Hangup() [pbx_ael]
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
--
Steve Murphy
Digium, Inc. | Software Developer
57 Lane 17, Cody, WY 82414 USA
direct: +1 256-428-6002
mobile: +1 307-899-5535
fax/home: +1 307-754-5675
irc: codefreeze | jabber: murf at digium.com
Check us out at: www.digium.com & www.asterisk.org
-------------- 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-dev/attachments/20090211/ab4dbffe/attachment.bin
More information about the asterisk-dev
mailing list