[asterisk-users] AEL switch & case
Antony Stone
Antony.Stone at asterisk.open.source.it
Wed Aug 31 05:32:17 CDT 2022
Hi.
I think I've discovered a bug in either the implementation of the
documentation of the AEL switch command.
https://wiki.asterisk.org/wiki/display/AST/AEL+Conditionals gives an example
of using switch, and states at the bottom:
"Neither the switch nor case values are wrapped in $[ ]; they can be
constants, or ${var} type references only."
However, I've run into a problem, which can be demonstrated by the simple
context:
context SwitchTest {
s => {
Set(FortyTwo=42);
Set(SixByNine=54);
switch(${SixByNine}) {
case 123:
NoOp(123);
break;
case ${FortyTwo}:
NoOp(${FortyTwo});
break;
}
}
}
This gets converted by AEL into:
[ Context 'SwitchTest' created by 'pbx_ael' ]
's' => 1. MSet(~~EXTEN~~=${EXTEN})
2. Set(FortyTwo=42)
3. Set(SixByNine=54)
4. Goto(sw_5410_${SixByNine},10)
5. NoOp(Finish switch_SwitchTest_5410)
'sw_5410_' => 10. Goto(sw_5410_.,10)
11. Goto(s,5)
'sw_5410_123' => 10. NoOp(123)
11. Goto(s,5)
'_sw_5410_.' => 10. Goto(s,5)
So, there was no implementation of the "case ${FortyTwo}" match.
Am I misundertanding "they can be constants, or ${var} type references only."?
Antony.
--
Normal people think "If it ain't broke, don't fix it".
Engineers think "If it ain't broke, it doesn't have enough features yet".
Please reply to the list;
please *don't* CC me.
More information about the asterisk-users
mailing list