[asterisk-users] STRFTIME function declared in globals context

Danny Nicholas danny at debsinc.com
Tue Jul 13 11:47:22 CDT 2010


 

 

  _____  

From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Warren Selby
Sent: Tuesday, July 13, 2010 11:31 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [asterisk-users] STRFTIME function declared in globals context

 

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

Is what I'm trying to do possible?  It seems like it's at least recognizing
that I'm trying to grab a date, but it's not taking the date format
parameters that I want.


-- 
Thanks,
--Warren Selby
http://www.selbytech.com

--

You don't state which version you are on (These things change from 1.2 to
1.4 to 1.6/8), but that being said, you would probably more likely to
succeed doing Set(GLOBAL) in an isolated context instead of using the
[global] context for this bit of voodoo.  Looking forward to a better answer
(folks like to correct my shots across the bow).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100713/07283db7/attachment.htm 


More information about the asterisk-users mailing list