<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 &quot;timezone=UTC usegmtime=yes&quot; 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 &quot;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-&gt;name, &quot;calldate&quot;)) {</div><div>
                                /*!\note</div><div>                                 * For some dumb reason, &quot;calldate&quot; 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&#39;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(&amp;tv, &amp;tm, ast_str_strlen(cdrzone) ? ast_str_buffer(cdrzone) : NULL);</div><div>                                        ast_strftime(timestr, sizeof(timestr), &quot;%Y-%m-%d %T&quot;, &amp;tm);</div>
<div>                                        ast_cdr_setvar(cdr, &quot;calldate&quot;, timestr, 0);</div><div>                                        cdrname = &quot;calldate&quot;;</div><div>                                } else {</div>
<div>                                        cdrname = &quot;start&quot;;</div><div>                                }</div><div>                        } else {</div><div>                                cdrname = entry-&gt;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(&amp;tv, &amp;tm, NULL);</div>
<div>                                        ast_strftime(timestr, sizeof(timestr), &quot;%Y-%m-%d %T&quot;, &amp;tm);</div><div>                                        ast_cdr_setvar(cdr, &quot;calldate&quot;, timestr, 0);</div>
<div>                                        cdrname = &quot;calldate&quot;;</div><div>                                } else if (usegmtime) {</div><div>                                        struct ast_tm tm;</div><div>
                                        char timestr[128];</div><div>                                        ast_localtime(&amp;cdr-&gt;start, &amp;tm, &quot;GMT&quot;);</div><div>                                        ast_strftime(timestr, sizeof(timestr), DATE_FORMAT, &amp;tm);</div>
<div>                                        ast_cdr_setvar(cdr, &quot;calldate&quot;, timestr, 0);</div><div>                                        cdrname = &quot;calldate&quot;;</div><div>                                } else {</div>
<div>                                        cdrname = &quot;start&quot;;</div><div>                                }</div><div>                        } else {</div><div>                                cdrname = entry-&gt;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>