Askozia Forums
July 30, 2010, 12:34:38 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: Wrong VM_DATE in mail notifications  (Read 704 times)
davide.moro
Newbie
*

Karma: 0
Posts: 23



View Profile WWW
« on: March 10, 2010, 06:15:09 pm »

Hi,

i have this problem in date/time in email notifications: VM_DATE is one hour earlier than email timestamp.
Time zone is set to Europe, Rome, Italy.
The time on logs is correct.
The "date" command in console show correct time.

How to fix it?

Thanks
Davide Moro



Logged
giovanni.v
Global Moderator
Hero Member
*****

Karma: 27
Posts: 449


View Profile
« Reply #1 on: March 10, 2010, 07:24:49 pm »

i have this problem in date/time in email notifications: VM_DATE is one hour earlier than email timestamp.

Probably GMT.

Quote
Time zone is set to Europe, Rome, Italy.

Do you mean the time zone in general settings?
Could you post the headers from the received message?

However the VM_DATE variable is processed by asterisk so may be don't get the right time zone.
Logged
davide.moro
Newbie
*

Karma: 0
Posts: 23



View Profile WWW
« Reply #2 on: March 10, 2010, 07:38:39 pm »

Do you mean the time zone in general settings?

Yes

Quote
Could you post the headers from the received message?

i change some data for privacy:

-- start of mail message --

Return-Path: <voicemail@domain.xxx>
Delivered-To: mailbox@domain.xxx
Received: from localhost (unknown [192.168.7.102])
   by DM00-1 (Postfix) with ESMTPSA id 9ADDBB425B
   for <mailbox@domain.xxx>; Wed, 10 Mar 2010 20:57:33 +0100 (CET)
date: Wed Mar 10 21:00:48 CET 2010
to: mailbox@domain.xxx
subject: Missed Call (hungup)
from: AskoziaPBX Notifications <>
Message-Id: <20100310195733.9ADDBB425B@DM00-1>

2010-03-10 - 20:00 from 101 <102>

-- end of mail message --


The result of date command in console is:

$ date
Wed Mar 10 21:05:34 CET 2010

Logged
giovanni.v
Global Moderator
Hero Member
*****

Karma: 27
Posts: 449


View Profile
« Reply #3 on: March 11, 2010, 07:08:27 am »

Davide, check a missing call notification... this mail is managed completely by askozia scripts, the time on that message is the right one?
Return-Path: <mailer@teebx.mydomain.intra>
Delivered-To: user@main.mydomain.intra
Received: (qmail 16409 invoked by alias); 10 Mar 2010 11:44:10 -0000
Delivered-To: alias-localdelivery-user@mydomain.com
Received: (qmail 16406 invoked by uid 453); 10 Mar 2010 11:44:10 -0000
X-Virus-Checked: Checked by ClamAV on mydomain.intra
Received: from pc-00011.mydomain.intra (HELO localhost) (192.168.1.11)
    by mydomain.intra (qpsmtpd/0.40) with ESMTP; Wed, 10 Mar 2010 12:44:10 +0100
date: Wed Mar 10 12:44:05 CET 2010
to: user@mydomain.com
subject: Missed Call (hungup)
from: AskoziaPBX Notifications <mailer@teebx.mydomain.intra>

2010-03-10 - 12:44 from  <0655557777>


This do not solve the issue but confirm that depends on something between asterisk and the system time.
Logged
davide.moro
Newbie
*

Karma: 0
Posts: 23



View Profile WWW
« Reply #4 on: March 11, 2010, 07:40:43 am »


date: Wed Mar 10 12:44:05 CET 2010

2010-03-10 - 12:44 from  <0655557777>[/tt]


In this example the time on notification is correct.
I think the problem is in asterisk time zone. I will search in asterisk documentation or support for a solution.
Logged
davide.moro
Newbie
*

Karma: 0
Posts: 23



View Profile WWW
« Reply #5 on: March 11, 2010, 12:47:10 pm »

extensions.conf:

; mail missed call notification
exten => mailnotification,1,Set(TMPMAILFILE=/var/asterisk/spool/tmp/email-${MD5(${UNIQUEID})})
exten => mailnotification,n,System(touch ${TMPMAILFILE})
exten => mailnotification,n,System(echo "date: `date`" > ${TMPMAILFILE})
exten => mailnotification,n,System(echo "to: ${SENDNOTIFICATIONS}" >> ${TMPMAILFILE})
exten => mailnotification,n,System(echo "subject: Missed Call (${MISSEDCAUSE})" >> ${TMPMAILFILE})
exten => mailnotification,n,System(echo "from: AskoziaPBX Notifications <>" >> ${TMPMAILFILE})
exten => mailnotification,n,System(echo >> ${TMPMAILFILE})
exten => mailnotification,n,System(echo "${STRFTIME(${EPOCH},,%Y-%m-%d - %H:%M)} from ${CALLERID(all)}" >> ${TMPMAILFILE})
exten => mailnotification,n,System(/usr/bin/msmtp -C /etc/msmtp.conf -t < ${TMPMAILFILE})
exten => mailnotification,n,System(rm ${TMPMAILFILE})
exten => mailnotification,n,Return()

I think the problem is here:
exten => mailnotification,n,System(echo "${STRFTIME(${EPOCH},,%Y-%m-%d - %H:%M)} from ${CALLERID(all)}" >> ${TMPMAILFILE})

Probably STRFTIME don't get the correct system time zone (/etc/TZ is correct). For now i fix it with little modification:
STRFTIME(${EPOCH},GMT-1,%Y-%m-%d - %H:%M)
But how to resolve this issue definitively?
Logged
Mats Karlsson
Full Member
***

Karma: 4
Posts: 59



View Profile WWW
« Reply #6 on: March 11, 2010, 02:00:57 pm »

The voicemail.conf is missing "tz=".

This is my voicemail.conf, stripped of unnecessary info:

[zonemessages]
eastern=America/New_York|'vm-received' Q 'digits/at' IMp
central=America/Chicago|'vm-received' Q 'digits/at' IMp
central24=America/Chicago|'vm-received' q 'digits/at' H N 'hours'
military=Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p'
european=Europe/Copenhagen|'vm-received' a d b 'digits/at' HM

[default]
101 => 0000,0123456789,my.email@somewhere.com,,delete=yes


The row :
101 => 0000,0123456789,my.email@somewhere.com,,tz=european|delete=yes

should have tz=european

If you wish could I compile a more extensive "timezone list", ref. http://en.wikipedia.org/wiki/List_of_time_zone_abbreviations.

/Mats
Logged
Mats Karlsson
Full Member
***

Karma: 4
Posts: 59



View Profile WWW
« Reply #7 on: March 11, 2010, 02:11:19 pm »

Maybe it should be a dropdown setting timezone in "Phone | Call Notifications & Voicemail" that defaults to the timezone setting under "General"?

Something for next release ?
Logged
davide.moro
Newbie
*

Karma: 0
Posts: 23



View Profile WWW
« Reply #8 on: March 11, 2010, 02:13:44 pm »

The row :
101 => 0000,0123456789,my.email@somewhere.com,,tz=european|delete=yes
should have tz=european

This change the date/time format (y-m-d to d-m-y) but not display the correct time.



Logged
Mats Karlsson
Full Member
***

Karma: 4
Posts: 59



View Profile WWW
« Reply #9 on: March 11, 2010, 02:53:51 pm »

You are absolutely right, its Asterisk.

i SSH'ed into my box and executed the following commands.

cd /offload/rootfs/usr/sbin
./asterisk -Tr


The -T parameters gives you the CLI with timestamps.
exit out of asterisk CLI.

And at the linux CLI i typed:
date

And the Linux CLI showed an hour difference (+1) from the Asterisk CLI.
« Last Edit: March 11, 2010, 02:57:13 pm by matsk » Logged
davide.moro
Newbie
*

Karma: 0
Posts: 23



View Profile WWW
« Reply #10 on: March 11, 2010, 03:01:16 pm »

You are absolutely right, its Asterisk.

i SSH'ed into my box and executed the following commands.

cd /offload/rootfs/usr/sbin
./asterisk -Tr


The -T parameters gives you the CLI with timestamps.
exit out of asterisk CLI.

And at the linux CLI i typed:
date

And the Linux CLI showed an hour difference (+1) from the Asterisk CLI.

I've do the same test now and i confirm +1 hour on Linux CLI.
Thanks for your test Grin
« Last Edit: March 11, 2010, 03:03:22 pm by davide.moro » Logged
Michael Iedema
Administrator
Hero Member
*****

Karma: 37
Posts: 907



View Profile
« Reply #11 on: March 12, 2010, 01:47:45 pm »

This has to do with AskoziaPBX using uClibc as a base. It handles timezones differently and Asterisk cannot recognize them correctly. Astlinux has solved this problem already but I have not looked into how they did it. I assume they've just used a full timezones definition set from standard glibc.

I will get around to this for RC3 but did not have time to get it in for RC2. If someone wants to take a look into the solution, I'm sure there will be a virtual beer as a reward waiting for you.
Logged
giovanni.v
Global Moderator
Hero Member
*****

Karma: 27
Posts: 449


View Profile
« Reply #12 on: March 17, 2010, 05:44:21 pm »

Digging a bit about got some results to start on:
- http://blackfin.uclinux.org/gf/project/asterisk/forum/?_forum_action=ForumMessageBrowse&thread_id=28114&action=ForumBrowse
- https://forum.openwrt.org/viewtopic.php?pid=47802#p47802
- http://www.mail-archive.com/astlinux-users@lists.sourceforge.net/msg03678.html
- http://www.mail-archive.com/astlinux-users@lists.kriscompanies.com/msg01066.html
Logged
Mats Karlsson
Full Member
***

Karma: 4
Posts: 59



View Profile WWW
« Reply #13 on: March 19, 2010, 11:42:00 am »

Think I found it.

Downloaded trunk and I cant find "UCLIBC_TZ_FILE_PATH="/etc/TZ"" in uclibc.conf
Logged
giovanni.v
Global Moderator
Hero Member
*****

Karma: 27
Posts: 449


View Profile
« Reply #14 on: March 19, 2010, 12:27:49 pm »

Downloaded trunk and I cant find "UCLIBC_TZ_FILE_PATH="/etc/TZ"" in uclibc.conf

I tried some days ago using a tz definition, like:
echo "CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00" > /etc/TZ
Unfortunately does nothing.

I'm not a C guru but looking in the asterisk code i think parses the tzinfo files directly.
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.089 seconds with 19 queries.