Summary:ASTERISK-09587: Switch construct breaks the dialplan flow if it doesn't have a default case
Reporter:Marcel Barbulescu (marcelbarbulescu)Labels:
Date Opened:2007-06-04 22:35:36Date Closed:2007-06-05 13:30:40
Versions:Frequency of
Description:The AEL parser doesn't generate dialplan extensions necessary to continue the dialplan logic in the case of a switch without a default case. Adding an empty default branch solves the problem.


In the following example, if the NUMBER is not a toll-free one, the dialplan will throw an error and it will not execute the second NoOp. Adding an empty default branch solves the problem.

switch (${NUMBER})
       pattern 1800.:
       pattern 1866.:
       pattern 1877.:
       pattern 1888.:
               NoOp(toll-free number);
NoOp(continue execution);
Comments:By: Steve Murphy (murf) 2007-06-05 09:53:58

I see your point. Not covering a case should not result in the equivalent of a core dump. I'm on it.

By: Steve Murphy (murf) 2007-06-05 13:28:37

Added code to insert an empty default at the end of the switch, with a warning.
If this warning gets to be distasteful, I can remove it later.

By: Steve Murphy (murf) 2007-06-05 13:30:39

New code added to solve this problem, with warning emitted. I can remove this warning if folks find it irritating enough.

fix made to 1.4,  r.67420, and to trunk, r.67423