Synopsis:
Conditional goto on current timeDescription:
GotoIfTime(<time range>,<days of week>,<days of month>,<months>?[labeliftrue][:labeliffalse])If the current time matches the specified time, then branch to the specified priority label. Each of the elements may be specified either as '*' (for always) or as a range. If the current time does not match the specified time, and no false target is defined, the next priority is executed.
Times before Asterisk 1.6.2 are only accurate down to the 2-minute interval. So 12:01 is treated the same as 12:00.
Starting with 1.6.2, times are accurate down to the minute.
How to specify time
The include syntax is defined in the sample extensions.conf like this:<time range>,<days of week>,<days of month>,<months>
where:
<time range>= <hour>':'<minute>'-'<hour>':'<minute>
| "*"
<days of week> = <dayname>
| <dayname>'-'<dayname>
| "*"
<dayname> = "sun" | "mon" | "tue" | "wed" | "thu" | "fri" | "sat"
<days of month> = <daynum>
| <daynum>'-'<daynum>
| "*"
<daynum> = a number, 1 to 31, inclusive
<hour> = a number, 0 to 23, inclusive
<minute> = a number, 0 to 59, inclusive
<months> = <monthname>
| <monthname>'-'<monthname>
| "*"
<monthname> = "jan" | "feb" | "mar" | "apr" | "may" | "jun" | "jul" | "aug" | "sep" | "oct" | "nov" | "dec"
daynames and monthnames are not case-sensitive.
Examples
If you replace an option with *, it is ignored when matching. For instance:exten => 3000,1,GotoIfTime(9:00-17:00,mon-fri,*,*?open)
would transfer to priority label "open" in the current extension if it's between 9:00 and 17:00, Monday through Friday, not checking the day of month or month.
Another example:
exten => s,n,GotoIfTime(*,*,26-30,May?attendant)
would transfer to priority label "attendant" in the current extension at any time from May 26th though May 30th.
Holidays
If the comment about holidays is true, then here's a list suitable in the United States:
Independence Day: *,*,4,jul
Christmas: *,*,25,dec
NewYear: *,*,1,jan
MartinLutherKing: *,mon,15-21,jan
Valentines: *,*,14,feb
StPatDay *,*,17,mar
Halloween *,*,31,oct
Thanksgiving *,thu,22-28,nov
MemorialDay *,mon,25-31,may
LaborDay *,mon,1-7,sep
Pres/WashBday *,mon,15-21,feb
MothersDay *,sun,8-14,may
FathersDay *,sun,15-21,jun
Easter: Good Luck! Paschal moons, etc). ...