The GoToIfTime() application

If you are looking to control the routing of the phone system based on the time, then you will most likely want to use the GotoIfTime() application.

To view detailed information about the application and it’s parameters while on an Asterisk server use the following command in from the Asterisk CLI:
core show application GotoIfTime

If you would rather view details about the application via a web browser, a good resource to look at is located at: https://www.voip-info.org/wiki/view/Asterisk+cmd+GotoIfTime (Links to an external site.)Links to an external site..

The syntax for the application is as follows:
GotoIfTime(<time range>,<days of week>,<days of month>,<months>?[labeliftrue][:labeliffalse])

Time Range

The <time range> parameter can be defined as a range specifying the hour and minute for both starting and ending time. It will use a 24 hour clock. For example, to specify a range between 1:00pm and 5:30pm you would use 13:00-17:30. The range is inclusive. You can also wrap time around the 24-hour clock. If your workplace works a typical 8:00am-5:00pm work schedule and you wanted to select the hours you are not in business you could use a range of 17:00-8:00.

You can combine multiple time ranges using the & between the ranges. For example, 13:00-17:30&20:15-22:45 would include the times between 1:00pm to 5:30pm as well as 8:15pm to 10:45pm.

If you want to include any time of the day the * can be used to define all hours and minutes of the day.

Days of the Week

The days of the week are defined using the three letter abbreviations for each day. Options include: sun, mon, tue, wed, thu, fri, and sat. This parameter can be defined as a single day or multiple days.

When defining multiple days, both ranges and the & can be used. To select a range that starts on Tuesday through Sunday use tue-sun. To select Monday and Wednesday use mon&wed. Lastly to select Monday through Wednesday as well as Saturday you could use mon-wed&sat.

Days of Month

This is numeric value 1 through 31.

Months

The months are defined using the three letter abbreviations for each month.

Labels

We can define the context, extension, and starting procedure that a true and false condition redirect to.