[asterisk-bugs] [Asterisk 0017637]: [patch] STRFTIME in globals using commas returns incorrect value

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Jul 13 22:15:06 CDT 2010


The following issue has been UPDATED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17637 
====================================================================== 
Reported By:                wcselby
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   17637
Category:                   Core/Configuration
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.33.1 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-07-13 15:36 CDT
Last Modified:              2010-07-13 22:15 CDT
====================================================================== 
Summary:                    [patch] STRFTIME in globals using commas returns
incorrect value
Description: 
I'm trying to declare a few date-related global variables to ease my
dialplan.  When I declare the following in the [globals] context of
extensions.conf, I get unexpected results:

YEAR = ${STRFTIME(${EPOCH},,%Y)}
MONTH = ${STRFTIME(${EPOCH},,%m)}
DAY = ${STRFTIME(${EPOCH},,%d)}
TIMESTAMP = ${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}

If I evaluate these variables in the dialplan later, using

exten => 7777,n,Verbose(${TIMESTAMP} - ${YEAR} - ${MONTH} - ${DAY})

My output is as follows:

    -- Executing [7777 at phones:3] Verbose("SIP/2625-0000d5f0", "Tue Jul 13
11:08:42 2010 - Tue Jul 13 11:08:42 2010 - Tue Jul 13 11:08:42 2010 - Tue
Jul 13 11:08:42 2010") in new stack
Tue Jul 13 11:08:42 2010 - Tue Jul 13 11:08:42 2010 - Tue Jul 13 11:08:42
2010 - Tue Jul 13 11:08:42 2010

However, the following line:

exten => 7777,n,Verbose(${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)} -
${STRFTIME(${EPOCH},,%Y)} - ${STRFTIME(${EPOCH},,%m)} -
${STRFTIME(${EPOCH},,%d)})

evaluates with what I expect:

    -- Executing [7777 at phones:4] Verbose("SIP/2625-0000d5f0",
"20100713-110853 - 2010 - 07 - 13") in new stack
20100713-110853 - 2010 - 07 - 13

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-07-13 22:15 tilghman       Summary                  STRFTIME in globals
using commas returns incorrect value => [patch] STRFTIME in globals using commas
returns incorrect value
======================================================================




More information about the asterisk-bugs mailing list