[asterisk-addons-commits] tilghman: branch 1.6.0 r1089 - in /branches/1.6.0: cdr/ configs/

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Mon Jan 11 15:07:29 CST 2010


Author: tilghman
Date: Mon Jan 11 15:07:24 2010
New Revision: 1089

URL: http://svnview.digium.com/svn/asterisk-addons?view=rev&rev=1089
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.0/cdr/cdr_addon_mysql.c
    branches/1.6.0/configs/cdr_mysql.conf.sample

Modified: branches/1.6.0/cdr/cdr_addon_mysql.c
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.0/cdr/cdr_addon_mysql.c?view=diff&rev=1089&r1=1088&r2=1089
==============================================================================
--- branches/1.6.0/cdr/cdr_addon_mysql.c (original)
+++ branches/1.6.0/cdr/cdr_addon_mysql.c Mon Jan 11 15:07:24 2010
@@ -70,6 +70,7 @@
 static int totalrecords = 0;
 static int timeout = 0;
 static int calldate_compat = 0;
+static int usegmtime = 0;
 
 AST_MUTEX_DEFINE_STATIC(mysql_lock);
 
@@ -244,6 +245,13 @@
 					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";
 				}
@@ -420,6 +428,7 @@
 	struct column *entry;
 	char *temp;
 	struct ast_str *compat;
+	struct ast_str *gmtime;
 	MYSQL_ROW row;
 	MYSQL_RES *result;
 	char sqldesc[128];
@@ -456,6 +465,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, "");
 
@@ -470,6 +480,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.0/configs/cdr_mysql.conf.sample
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.0/configs/cdr_mysql.conf.sample?view=diff&rev=1089&r1=1088&r2=1089
==============================================================================
--- branches/1.6.0/configs/cdr_mysql.conf.sample (original)
+++ branches/1.6.0/configs/cdr_mysql.conf.sample Mon Jan 11 15:07:24 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