[asterisk-bugs] [Asterisk 0013901]: switch statement: Empty patterns don't fallback to Default label

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Nov 14 13:00:21 CST 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13901 
====================================================================== 
Reported By:                smurfix
Assigned To:                murf
====================================================================== 
Project:                    Asterisk
Issue ID:                   13901
Category:                   PBX/pbx_ael
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.1 
SVN Revision (number only!): 150817 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-11-14 07:48 CST
Last Modified:              2008-11-14 13:00 CST
====================================================================== 
Summary:                    switch statement: Empty patterns don't fallback to
Default label
Description: 
The following code:

switch(${empty}) {

... some patterns ...

default: break;

}

results in an "unknown label" error, the call is aborted.

This bug caused us to lose two days' worth of calls which happened not to
send any caller ID ...
====================================================================== 

---------------------------------------------------------------------- 
 (0094912) murf (administrator) - 2008-11-14 13:00
 http://bugs.digium.com/view.php?id=13901#c94912 
---------------------------------------------------------------------- 
Sorry about that! As an immediate sort of work-around, you could
prepend or append something, say another digit, to the variable, so it
is guaranteed never to be null...

Like:

   switch(0${maybe_empty_var} {
      case 0123:
      case 0954: 
         ..
      case 0:  /* the equiv of default */
      default:
        /* whatever */
   } 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-11-14 13:00 murf           Note Added: 0094912                          
======================================================================




More information about the asterisk-bugs mailing list