Asterisk PBX: Using TimeZones in GotoIfTime

Asterisk VoIP PBX allows you to setup your dialplan to route calls to different places depending on the time of day.

I setup a system in the UK which has British summer time / daylight savings time. (BST). The documentation on Asterisk.org is always missing examples.
The examples on the incredibly helpful voip-info.org didn’t contain any information about timezones. Googling also didn’t reveal much.

Eventually I managed to find the right Google words to dig up a blog.

The correct use of timezones for the UK is:

 same = n,GotoIfTime(8:30-17:00,mon-thu,*,*,/usr/share/zoneinfo/Europe/London?helpdeskopen,1)
 same = n,GotoIfTime(8:30-16:00,fri,*,*,/usr/share/zoneinfo/Europe/London?helpdeskopen,1)
 same = n,Verbose(1, "Helpdesk is in night mode")
 same = n,Playback(duty-manager-details)

exten = helpdeskopen,1,Verbose(1, "Helpdesk is in day mode")
 same = n,Playback(pls-wait-connect-call)

Obviously modify to fit your needs.

Until I found the helpful blog I had assumed that the timezone would be something like “BST” or “GMT” or “UK”.. I wouldn’t have even though of trying a timezone (zoneinfo) file!

Examples in documentation go a long way to reducing the difficulty of learning new things. I get frustrated that voip-info has been left to do a lot of the heavy lifting in terms of Asterisk examples and documentation.

This entry was posted in Uncategorized. Bookmark the permalink.

Comment on this topic

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s