[asterisk-bugs] [Asterisk 0010613]: Unable to use variables containing times

noreply at bugs.digium.com noreply at bugs.digium.com
Thu Aug 30 21:02:12 CDT 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=10613 
====================================================================== 
Reported By:                Karl Anderson
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   10613
Category:                   Functions/func_logic
Reproducibility:            always
Severity:                   tweak
Priority:                   normal
Status:                     new
Asterisk Version:            1.4.10.1  
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             08-30-2007 18:38 CDT
Last Modified:              08-30-2007 21:02 CDT
====================================================================== 
Summary:                    Unable to use variables containing times
Description: 
Due to the syntax of the function IF I am unable to use it (or any other)
logic functions to make decisions on variables holding times.  Example:

Set(REDIRECT_TIME=${ODBC_PREF(${MACRO_CONTEXT}|${MACRO_EXTEN}|REDIRECT_TIME)})
Set(REDIRECT_TIME=${IF($["REDIRECT_TIME" !=
""]?${REDIRECT_TIME}:"*|*|*|*")})
GotoIfTime(${REDIRECT_TIME}}?INSIDE_RANGE)

1. A odbc connection is used to query a MySQL table for this
context/extensions REDIRECT_TIME.
2. If there was no return from the MySQL then use wildcards (works)
otherwise use the time found (broken)
3. Goto based on the time

In this example if the MySQL holds a time then func if incorrectly uses
the first ':' (8:00-17:00|mon-fri) effectively making the if statement:
            ^


IF REDIRECT_TIME ? 8 : 00-17:00|mon-fri

Which fails.  After looking into the source code I (albeit not a
programmer) recommend either not striping quotes first (if present) or
using a regex to find the last occurance of ':' 
====================================================================== 

---------------------------------------------------------------------- 
 qwell - 08-30-07 21:02  
---------------------------------------------------------------------- 
$["REDIRECT_TIME" != ""] is always going to evaluate as true.

Do you perhaps mean $["${REDIRECT_TIME}" != ""] ? 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
08-30-07 21:02  qwell          Note Added: 0069762                          
======================================================================




More information about the asterisk-bugs mailing list