[Asterisk-code-review] cdr/cdr csv.c: Added to record new columns add on CDR 1.8 As... (asterisk[master])
Rodrigo Ramirez Norambuena
asteriskteam at digium.com
Wed Apr 29 13:14:03 CDT 2015
Rodrigo Ramirez Norambuena has uploaded a new change for review.
https://gerrit.asterisk.org/293
Change subject: cdr/cdr_csv.c: Added to record new columns add on CDR 1.8 Asterisk Version
......................................................................
cdr/cdr_csv.c: Added to record new columns add on CDR 1.8 Asterisk Version
Add new column to INSERT new columns added in cdr 1.8 version. The columns are:
* peeraccount
* linkedid
* sequence
This feature is configurable in cdr.conf using a new configuration
option, 'newcdrcolumns'.
ASTERISK-24976 #Same issue feature
Change-Id: I51a57063f4ae5e194a9d933a8df45dc8a4534f0b
---
M CHANGES
M cdr/cdr_csv.c
M configs/samples/cdr.conf.sample
3 files changed, 18 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/93/293/1
diff --git a/CHANGES b/CHANGES
index c635de5..ec4e834 100644
--- a/CHANGES
+++ b/CHANGES
@@ -40,6 +40,12 @@
* Added a new configuration option, "newcdrcolumns", which enables use of the
post-1.8 CDR columns 'peeraccount', 'linkedid', and 'sequence'.
+------------------
+cdr_csv
+------------------
+ * Added a new configuration option, "newcdrcolumns", which enables use of the
+ post-1.8 CDR columns 'peeraccount', 'linkedid', and 'sequence'.
+
Channel Drivers
------------------
diff --git a/cdr/cdr_csv.c b/cdr/cdr_csv.c
index 944f98a..9c4f41e 100644
--- a/cdr/cdr_csv.c
+++ b/cdr/cdr_csv.c
@@ -58,6 +58,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 */
@@ -113,6 +114,7 @@
usegmtime = 0;
loguniqueid = 0;
loguserfield = 0;
+ newcdrcolumns = 0;
if (!(v = ast_variable_browse(cfg, "csv"))) {
ast_config_destroy(cfg);
@@ -129,7 +131,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;
@@ -241,6 +246,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/samples/cdr.conf.sample b/configs/samples/cdr.conf.sample
index 2c7cdf6..e175a2a 100644
--- a/configs/samples/cdr.conf.sample
+++ b/configs/samples/cdr.conf.sample
@@ -154,6 +154,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/293
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I51a57063f4ae5e194a9d933a8df45dc8a4534f0b
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Rodrigo Ramirez Norambuena <decipher.hk at gmail.com>
More information about the asterisk-code-review
mailing list