How to detect the month?

Silly questions I know, but, how do I branch depending on the month? I tried the GotoIfTime command and failed.

All I want to do is see if it is December and set the musiconhold context to “Christmas” and “default” for the rest of the year.

Is there a built in variable like ${month} or something I can use in the GotoIf command?

Where is there a list of these built in variables?

there’s a ${DATETIME} channel variable. you could check whether the month element ${DATETIME:2:2} was “12” and work from there.

The docs say that is obsolete and to use SayUnixTime() instead. Either way, the commands will speak the time. Will using it in variable format ${SayUnixTime:2:2} keep it from speeking? All I want is the month number.

the DateTime command might be obsolete, but the channel variable ??

Ah, sorry. Did a voip-info search for DATETIME and that is what came up. Guess maybe that is why they changed the speaking one to “SayUnixTime” so it wouldn’t be so confusing. Grr…

Thanks, works like a charm.

It could be a very pretty thing if asterisk is able to read a calendar in order to check if the current day is a working day or a festival day.
Not only the set the appropriate music on hold, but even to use the appropriate IVR.
I guess you set your IVR to do something if a call arrives from Lun-to-Ven and something else if a call arrives on Saturday or Sunday.
What will happen the 26 of December? It’s not a working day.
C.

it wouldn’t be particularly difficult to implement an agi script that checked a database table to see if today is a holiday.

i use something similar for a manufacturing system i wrote for one of my clients, they have shutdowns at various times of the year, all the usual holidays, and then some … my script just makes sure that work doesn’t get scheduled for that day.

i’m sure there are publically available “lookups” on a per-country basis, but i would want something more flexible than that.