[asterisk-addons-commits] tilghman: branch 1.6.2 r1091 - in /branches/1.6.2: cdr/ configs/
SVN commits to the Asterisk addons project
asterisk-addons-commits at lists.digium.com
Mon Jan 11 15:09:14 CST 2010
Author: tilghman
Date: Mon Jan 11 15:09:10 2010
New Revision: 1091
URL: http://svnview.digium.com/svn/asterisk-addons?view=rev&rev=1091
Log:
Restore usegmtime option.
(closes issue #16401)
Reported by: lordmortis
Patches:
patch uploaded by lordmortis (license 944)
patch2 uploaded by lordmortis (license 944)
Modified:
branches/1.6.2/cdr/cdr_addon_mysql.c
branches/1.6.2/configs/cdr_mysql.conf.sample
Modified: branches/1.6.2/cdr/cdr_addon_mysql.c
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.2/cdr/cdr_addon_mysql.c?view=diff&rev=1091&r1=1090&r2=1091
==============================================================================
--- branches/1.6.2/cdr/cdr_addon_mysql.c (original)
+++ branches/1.6.2/cdr/cdr_addon_mysql.c Mon Jan 11 15:09:10 2010
@@ -76,6 +76,7 @@
static int totalrecords = 0;
static int timeout = 0;
static int calldate_compat = 0;
+static int usegmtime = 0;
AST_MUTEX_DEFINE_STATIC(mysql_lock);
@@ -248,6 +249,13 @@
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 {
@@ -397,6 +405,7 @@
struct column *entry;
char *temp;
struct ast_str *compat;
+ struct ast_str *gmtime;
MYSQL_ROW row;
MYSQL_RES *result;
char sqldesc[128];
@@ -433,6 +442,7 @@
res |= my_load_config_string(cfg, "global", "sock", &dbsock, "");
res |= my_load_config_string(cfg, "global", "table", &dbtable, "cdr");
res |= my_load_config_string(cfg, "global", "password", &password, "");
+ res |= my_load_config_string(cfg, "global", "usegmtime", &gmtime, "no");
res |= my_load_config_string(cfg, "global", "charset", &dbcharset, "");
@@ -447,6 +457,12 @@
calldate_compat = 1;
} else {
calldate_compat = 0;
+ }
+
+ if (ast_true(gmtime->str)) {
+ usegmtime = 1;
+ } else {
+ usegmtime = 0;
}
if (res < 0) {
Modified: branches/1.6.2/configs/cdr_mysql.conf.sample
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.2/configs/cdr_mysql.conf.sample?view=diff&rev=1091&r1=1090&r2=1091
==============================================================================
--- branches/1.6.2/configs/cdr_mysql.conf.sample (original)
+++ branches/1.6.2/configs/cdr_mysql.conf.sample Mon Jan 11 15:09:10 2010
@@ -18,6 +18,9 @@
;user=asteriskcdruser
;port=3306
;sock=/tmp/mysql.sock
+;
+; If you need your CDRs recorded in GMT instead of local time
+;usegmtime=yes
;
; If your system's locale differs from mysql database character set,
; cdr_mysql can damage non-latin characters in CDR variables. Use this
More information about the asterisk-addons-commits
mailing list