[asterisk-users] STRFTIME function declared in globals context
Barry Miller
asterisk-users at notanet.net
Tue Jul 13 12:07:34 CDT 2010
On Tue, Jul 13, 2010 at 11:30:44AM -0500, Warren Selby wrote:
> 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.
Try adding "preload => func_strings.so" to modules.conf
--
Barry
More information about the asterisk-users
mailing list