Timezones

Hi,

i would like to configure an Asterisk server that should manage extensions that are physically located on different timezones.
In this case i need to check the time of the call in order to manage the call in different way if the office is opened or closed but the command GotoIfTime use the host time.

How can i do it? Can Asterisk manage different timezone time?

Thanks and regards,
Davide

All times have to be expressed in the same timezone, which will cuase a problem if different zones have different daylight saving rules.

Dear David,

if i have 2 extensions: 100 and 101.
100 is in timezone Rome and 101 in timezone London. Is it possibile to configure all the Asterisk application like CDR to use the correct timezone of the extension? Or Asterisk uses only the timezone of the server?

Thanks and best regards,
Davide

You can’t do that. However, for CDRs, the only really sensible thing to do is to log them in UTC, by using usegmttime=yes, although that isn’t the default.

CDRs are logged against channels. Channels don’t have timzones. Even if they did, the timezone of one leg of the call might not be what you consider to be the timezone for the call.

Dear David,

thank you very much for your answer!
And regarding the voicemail? If i receive a call at 08:56AM the variable ${VM_DATE} is set to 08:56AM.
It is possibile to manipulate this time for different timezones?

In this case ext 100 should receive an email that the call time is 08:56AM while 101 shoudl receive an email taht call time is 07:56AM.

Thanks and best regards,
Davide

As david wrote, asterisk has no built-in support for different timezones, it just uses the host time (and it’s timezone).

For CDRs that means: Log Your CDRs in gmttime and implement a method giving You the difference between gmttime and local time at extension in any timeinterval You’d like. To achieve this, Your extensions “need to know their location/timezone” as variable.
The difference can be estimated either in dialplan or in an agi-script.

Just a short snippet for this (AEL - At the end timediff is the difference between local time of extension and GMT in minutes (+/-) - in the example 120 for today (CEST)):

Set(LTZ=Europe/Rome);
Set(datenotz=${STRFTIME(${EPOCH},GMT,%Y-%m-%d %H:%M:%S)});
Set(datewithtz=${STRFTIME(${EPOCH},${LTZ},%Y-%m-%d %H:%M:%S)});
Set(i=${MATH(${STRPTIME(${datewithtz},GMT,%Y-%m-%d %H:%M:%S)}-${STRPTIME(${datenotz},GMT,%Y-%m-%d %H:%M:%S)},int)});
Set(timediff=${MATH(${i}/60,int)});

The other problem are time-conditions based on different timezones for different extensions. Asterisk has no support in it’s functions/applications (like IfTime aso) for doing so. The only way to acieve it is to manually code it (Your extensions “need to know their location/timezone” as variable again, probably You also will have different offic-times in local time and differnt (public) holidays).

Another problem You may face in this constellation are different “native” dialing-rules for Your extensions (eg. a UK-extension would like to dial 020XXXX to reach a London based number while Your Rome-based one would dial 004420XXXX to reach the same person a.s.o.): This problem could be used if You have variables for the location of Your extensions and than code a “number-format-detection and interpretation” dependend on the extension.

For voicemail, there is a built-in support for timezones in asterisk, see voicemail.conf

We’ve already implemented such solutions so if You need further detailed assistance just contact me.