diff options
author | Matt Jordan <mjordan@digium.com> | 2015-05-04 09:26:01 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2015-05-04 09:26:01 -0500 |
commit | 87fb7fc165f0f8abe8961b245822b8c26e3ff0a4 (patch) | |
tree | ec1a7d207428413a9a167848ad996f89058d396b | |
parent | 81c27127aafdd6547c5fd46f620057c0544e33e7 (diff) | |
parent | 7f611fa0e8fd54d191a4c2104b5d1ed4b1f8da97 (diff) |
Merge "cdr/cdr_csv.c: Add a new option to enable columns added in Asterisk 1.8" into 13
-rw-r--r-- | UPGRADE.txt | 4 | ||||
-rw-r--r-- | cdr/cdr_csv.c | 10 | ||||
-rw-r--r-- | configs/samples/cdr.conf.sample | 2 |
3 files changed, 16 insertions, 0 deletions
diff --git a/UPGRADE.txt b/UPGRADE.txt index 9adf3052c..da225d743 100644 --- a/UPGRADE.txt +++ b/UPGRADE.txt @@ -62,6 +62,10 @@ cdr_odbc: '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 13.2.0 to 13.3.0: chan_dahdi: diff --git a/cdr/cdr_csv.c b/cdr/cdr_csv.c index 046713a86..4ef3ce174 100644 --- a/cdr/cdr_csv.c +++ b/cdr/cdr_csv.c @@ -58,6 +58,7 @@ static int accountlogs = 1; 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 @@ static int load_config(int reload) usegmtime = 0; loguniqueid = 0; loguserfield = 0; + newcdrcolumns = 0; if (!(v = ast_variable_browse(cfg, "csv"))) { ast_config_destroy(cfg); @@ -129,7 +131,10 @@ static int load_config(int reload) 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 @@ static int build_csv_record(char *buf, size_t bufsize, struct ast_cdr *cdr) /* 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 2c7cdf6f0..e175a2a76 100644 --- a/configs/samples/cdr.conf.sample +++ b/configs/samples/cdr.conf.sample @@ -154,6 +154,8 @@ 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" +;newcdrcolumns=yes ; Enable logging of post-1.8 CDR columns (peeraccount, linkedid, sequence). + ; Default is "no". ;[radius] ;usegmtime=yes ; log date/time in GMT |