_____  

From: [email protected]
[mailto:[email protected]] 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 [7...@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 [7...@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).

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to