[asterisk-commits] oej: trunk r274866 - in /trunk: cdr/cdr_csv.c configs/cdr.conf.sample

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 9 06:06:23 CDT 2010


Author: oej
Date: Fri Jul  9 06:06:19 2010
New Revision: 274866

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=274866
Log:
Make it possible to disable individual cdr files per accountcode in cdr_csv

Review: https://reviewboard.asterisk.org/r/678/

Modified:
    trunk/cdr/cdr_csv.c
    trunk/configs/cdr.conf.sample

Modified: trunk/cdr/cdr_csv.c
URL: http://svnview.digium.com/svn/asterisk/trunk/cdr/cdr_csv.c?view=diff&rev=274866&r1=274865&r2=274866
==============================================================================
--- trunk/cdr/cdr_csv.c (original)
+++ trunk/cdr/cdr_csv.c Fri Jul  9 06:06:19 2010
@@ -46,6 +46,7 @@
 #define DATE_FORMAT "%Y-%m-%d %T"
 
 static int usegmtime = 0;
+static int accountlogs;
 static int loguniqueid = 0;
 static int loguserfield = 0;
 static int loaded = 0;
@@ -100,6 +101,7 @@
 	} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
 		return 1;
 
+	accountlogs = 1;
 	usegmtime = 0;
 	loguniqueid = 0;
 	loguserfield = 0;
@@ -114,6 +116,14 @@
 		if (usegmtime)
 			ast_debug(1, "logging time in GMT\n");
 	}
+
+	/* Turn on/off separate files per accountcode. Default is on (as before) */
+	if ((tmp = ast_variable_retrieve(cfg, "csv", "accountlogs"))) {
+ 		accountlogs = ast_true(tmp);
+ 		if (accountlogs) {
+			ast_debug(1, "logging in separate files per accountcode\n");
+ 		}
+ 	}
 
 	if ((tmp = ast_variable_retrieve(cfg, "csv", "loguniqueid"))) {
 		loguniqueid = ast_true(tmp);
@@ -304,7 +314,7 @@
 		ast_log(LOG_ERROR, "Unable to re-open master file %s : %s\n", csvmaster, strerror(errno));
 	}
 
-	if (!ast_strlen_zero(cdr->accountcode)) {
+	if (accountlogs && !ast_strlen_zero(cdr->accountcode)) {
 		if (writefile(buf, cdr->accountcode))
 			ast_log(LOG_WARNING, "Unable to write CSV record to account file '%s' : %s\n", cdr->accountcode, strerror(errno));
 	}

Modified: trunk/configs/cdr.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/cdr.conf.sample?view=diff&rev=274866&r1=274865&r2=274866
==============================================================================
--- trunk/configs/cdr.conf.sample (original)
+++ trunk/configs/cdr.conf.sample Fri Jul  9 06:06:19 2010
@@ -153,6 +153,7 @@
 usegmtime=yes    ; log date/time in GMT.  Default is "no"
 loguniqueid=yes  ; log uniqueid.  Default is "no"
 loguserfield=yes ; log user field.  Default is "no"
+accountlogs=yes  ; create separate log file for each account code. Default is "yes"
 
 ;[radius]
 ;usegmtime=yes    ; log date/time in GMT




More information about the asterisk-commits mailing list