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

noreply at bugs.digium.com noreply at bugs.digium.com
Fri Aug 31 11:32:30 CDT 2007


The following issue has been ASSIGNED. 
====================================================================== 
http://bugs.digium.com/view.php?id=10613 
====================================================================== 
Reported By:                Karl Anderson
Assigned To:                Corydon76
====================================================================== 
Project:                    Asterisk
Issue ID:                   10613
Category:                   Functions/func_logic
Reproducibility:            always
Severity:                   tweak
Priority:                   normal
Status:                     assigned
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-31-2007 11:32 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 ':' 
====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
08-31-07 11:32  Corydon76      Status                   new => assigned     
08-31-07 11:32  Corydon76      Assigned To               => Corydon76       
======================================================================




More information about the asterisk-bugs mailing list