Hi list,
I am using Asterisk1.6.2 form a long time and upgarding to
Asterisk-1.8.23.1.
I am using mysql backend for cdr.
in asterisk-1.6.2 i have usegmtime=yes and it works as expected insert cdr
date in GMT0.
now i tested Asterisk-1.8.23.1 and asterisk-11.5 with same results no
matter what i configure in cdr_mysql.conf "timezone=UTC usegmtime=yes"
cdr
always inserted in local time.
I dig into code of cdr_mysql.c and find a variable cdrzone when i set
cdrzone in configuration and load module with debug set to 1 it print on
console "Local time zone set to whatever i have in configuration i tried
cdrzone=GMT, cdrzone=UTC, cdrzone=yes and many combinations with
timezone=UTC and without timezone=UTS but cdr is alway in my local timezone
GMT +2.
in further investigation i have seen there is no timezone conversation.
from asterisk1.8.231 mysql_cdr.c
if (!strcmp(entry->name, "calldate")) {
/*!\note
* For some dumb reason, "calldate"
used to
be formulated using
* the datetime the record was posted,
rather than the start
* time of the call. If someone really
wants the old compatible
* behavior, it's provided here.
*/
if (calldate_compat) {
struct timeval tv = ast_tvnow();
struct ast_tm tm;
char timestr[128];
ast_localtime(&tv, &tm,
ast_str_strlen(cdrzone) ? ast_str_buffer(cdrzone) : NULL);
ast_strftime(timestr,
sizeof(timestr), "%Y-%m-%d %T", &tm);
ast_cdr_setvar(cdr,
"calldate",
timestr, 0);
cdrname = "calldate";
} else {
cdrname = "start";
}
} else {
cdrname = entry->cdrname;
}
from addons 1.6.2.4 mysql_cdr.c
if (calldate_compat) {
struct timeval tv = ast_tvnow();
struct ast_tm tm;
char timestr[128];
ast_localtime(&tv, &tm, NULL);
ast_strftime(timestr,
sizeof(timestr), "%Y-%m-%d %T", &tm);
ast_cdr_setvar(cdr,
"calldate",
timestr, 0);
cdrname = "calldate";
} else if (usegmtime) {
struct ast_tm tm;
char timestr[128];
ast_localtime(&cdr->start,
&tm,
"GMT");
ast_strftime(timestr,
sizeof(timestr), DATE_FORMAT, &tm);
ast_cdr_setvar(cdr,
"calldate",
timestr, 0);
cdrname = "calldate";
} else {
cdrname = "start";
}
} else {
cdrname = entry->cdrname;
please note else if(usegmtime)
the codes are removed from latest asterisk versions.
i am not c programmer anybody can help me solve this issue?
Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.digium.com/pipermail/asterisk-users/attachments/20130914/abe22c95/attachment.htm>