<div dir="ltr">Hi list,<div>I am using Asterisk1.6.2 form a long time and upgarding to Asterisk-1.8.23.1.</div><div>I am using mysql backend for cdr.</div><div>in asterisk-1.6.2 i have usegmtime=yes and it works as expected insert cdr date in GMT0.</div>
<div>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.</div><div><br></div><div>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.</div>
<div><br></div><div>in further investigation i have seen there is no timezone conversation.</div><div>from asterisk1.8.231 mysql_cdr.c</div><div><br></div><div> if (!strcmp(entry->name, "calldate")) {</div><div>
/*!\note</div><div> * For some dumb reason, "calldate" used to be formulated using</div><div> * the datetime the record was posted, rather than the start</div>
<div> * time of the call. If someone really wants the old compatible</div><div> * behavior, it's provided here.</div><div> */</div>
<div> if (calldate_compat) {</div><div> struct timeval tv = ast_tvnow();</div><div> struct ast_tm tm;</div><div>
char timestr[128];</div><div> ast_localtime(&tv, &tm, ast_str_strlen(cdrzone) ? ast_str_buffer(cdrzone) : NULL);</div><div> ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %T", &tm);</div>
<div> ast_cdr_setvar(cdr, "calldate", timestr, 0);</div><div> cdrname = "calldate";</div><div> } else {</div>
<div> cdrname = "start";</div><div> }</div><div> } else {</div><div> cdrname = entry->cdrname;</div>
<div> }</div><div><br></div><div><br></div><div>from addons 1.6.2.4 mysql_cdr.c</div><div><br></div><div><div> if (calldate_compat) {</div><div> struct timeval tv = ast_tvnow();</div>
<div> struct ast_tm tm;</div><div> char timestr[128];</div><div> ast_localtime(&tv, &tm, NULL);</div>
<div> ast_strftime(timestr, sizeof(timestr), "%Y-%m-%d %T", &tm);</div><div> ast_cdr_setvar(cdr, "calldate", timestr, 0);</div>
<div> cdrname = "calldate";</div><div> } else if (usegmtime) {</div><div> struct ast_tm tm;</div><div>
char timestr[128];</div><div> ast_localtime(&cdr->start, &tm, "GMT");</div><div> ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, &tm);</div>
<div> ast_cdr_setvar(cdr, "calldate", timestr, 0);</div><div> cdrname = "calldate";</div><div> } else {</div>
<div> cdrname = "start";</div><div> }</div><div> } else {</div><div> cdrname = entry->cdrname;</div>
</div><div><br></div><div>please note else if(usegmtime)</div><div>the codes are removed from latest asterisk versions.</div><div>i am not c programmer anybody can help me solve this issue?</div><div><br></div><div>Thanks in advance.</div>
</div>