[asterisk-commits] cdr/cdr csv.c: Add a new option to enable columns added in A... (asterisk[11])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 4 09:25:55 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: cdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8
......................................................................


cdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8

This patch adds a new option to cdr.conf, 'newcdrcolumns', that will handle CDR
columns added in Asterisk 1.8. The columns are:
 * peeraccount
 * linkedid
 * sequence
When enabled, the columns in the database entry will be populated with the data
from the CDR.

ASTERISK-24976 #close

Change-Id: I51a57063f4ae5e194a9d933a8df45dc8a4534f0b
---
M UPGRADE.txt
M cdr/cdr_csv.c
M configs/cdr.conf.sample
3 files changed, 16 insertions(+), 0 deletions(-)

Approvals:
  Matt Jordan: Looks good to me, approved; Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/UPGRADE.txt b/UPGRADE.txt
index 2be7d14..0b99c5d 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -49,6 +49,10 @@
    'sequence'. Support for the new columns can be enabled via the newcdrcolumns
    option in cdr_odbc.conf.
 
+cdr_csv:
+ - Added a new configuration option, "newcdrcolumns", which enables use of the
+   post-1.8 CDR columns 'peeraccount', 'linkedid', and 'sequence'.
+
 from 11.16 to 11.17
 chan_dahdi:
  - For users using the FXO port (FXS signaling) distinctive ring detection
diff --git a/cdr/cdr_csv.c b/cdr/cdr_csv.c
index b629290..df7a5fe 100644
--- a/cdr/cdr_csv.c
+++ b/cdr/cdr_csv.c
@@ -54,6 +54,7 @@
 static int loguniqueid = 0;
 static int loguserfield = 0;
 static int loaded = 0;
+static int newcdrcolumns = 0;
 static const char config[] = "cdr.conf";
 
 /* #define CSV_LOGUNIQUEID 1 */
@@ -109,6 +110,7 @@
 	usegmtime = 0;
 	loguniqueid = 0;
 	loguserfield = 0;
+	newcdrcolumns = 0;
 
 	if (!(v = ast_variable_browse(cfg, "csv"))) {
 		ast_config_destroy(cfg);
@@ -125,7 +127,10 @@
 			loguniqueid = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "loguserfield")) {
 			loguserfield = ast_true(v->value);
+		} else if (!strcasecmp(v->name, "newcdrcolumns")) {
+			newcdrcolumns = ast_true(v->value);
 		}
+
 	}
 	ast_config_destroy(cfg);
 	return 1;
@@ -237,6 +242,11 @@
 	/* append the user field */
 	if(loguserfield)
 		append_string(buf, cdr->userfield,bufsize);
+	if (newcdrcolumns) {
+		append_string(buf, cdr->peeraccount, bufsize);
+		append_string(buf, cdr->linkedid, bufsize);
+		append_int(buf, cdr->sequence, bufsize);
+	}
 	/* If we hit the end of our buffer, log an error */
 	if (strlen(buf) < bufsize - 5) {
 		/* Trim off trailing comma */
diff --git a/configs/cdr.conf.sample b/configs/cdr.conf.sample
index 458e19a..c1c00f7 100644
--- a/configs/cdr.conf.sample
+++ b/configs/cdr.conf.sample
@@ -161,6 +161,8 @@
 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"
+;newcdrcolumns=yes ; Enable logging of post-1.8 CDR columns (peeraccount, linkedid, sequence).
+                   ; Default is "no".
 
 ;[radius]
 ;usegmtime=yes    ; log date/time in GMT

-- 
To view, visit https://gerrit.asterisk.org/345
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I51a57063f4ae5e194a9d933a8df45dc8a4534f0b
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Rodrigo Ramirez Norambuena <decipher.hk at gmail.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list