Subscribe

Time Zone Processing with Asterisk

Calling people across time zones might prove to be inconveniencing to the receiving party, especially if it’s late at night or very early in the morning. Before, this wasn’t such a big issue, since you would know the time zone in the country of the person you’re calling. But with the advent of global roaming, you might be calling your neighbor’s mobile number, but he might be at the other side of the globe (and most likely asleep).

This is also an issue with VoIP, especially since VoIP clients/terminals do not really “reside” in a single country or time zone, and are most likely to be portable. So that same neighbor might be subscribed to a VoIP service, and he plugged in his phone onto his company’s regional office at the other side of the globe. Since the identity of that VoIP terminal is the same, then people calling in would still reach that particular terminal, regardless of location.

Linuxjournal has an article on how to make Asterisk redirect inbound callers to a message informing them that they are calling at inconvenient hours (and redirect to voicemail).

The system I built on top of Asterisk to handle this feature has two major parts. The key to the system is maintaining a time-zone offset from the time in London. (My code implements offsets only of whole hours, though it could be extended to use either half or quarter hours.) When a device first connects to Asterisk, its IP address is used to guess the location and, therefore, the time offset. After the offset is programmed into the system, incoming calls are then checked against the time at the remote location. Before the phone is allowed to ring, the time at the remote location is checked, and callers can be warned if they are trying to complete a call at an inconvenient time.

The system, built on top of Asterisk, has two steps. First is the time zone estimation. Second is confirming the estimated time (with user input). Third is alerting callers that they’re calling at an inconvenient time.

The first step involves estimating the time zone of a terminal once it connects to the Asterisk gateway. This can be done by approximation from the IP address used by the terminal. While Asterisk cannot estimate the time zone directly from the IP address, the system uses the Asterisk Gateway Interface to allow Asterisk to pass on data to an external program, execute computations on that external program, and then get results back as Asterisk channel variables.

The second step is asking the user to confirm the time zone of his current location by dialling in the current time and how long he expects to stay at that location.

Once the procedure is complete, calls will then first be screened to check if the terminal is still connected in a location where it’s night time. Asterisk will then silence the ringing, but this can be overridden either manually or by caller ID.

Do check out the linuxjournal article for a more detailed explanation of the procedures involved.

Don't miss a post! Subscribe to the RSS feed or by email today!

AddThis Social Bookmark Button
Related posts:

Leave a Reply



© 2007 Asterisk VOIP Tips | Powered by WordPress | Theme originally by Bob, heavily tweaked.