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

This commit is contained in:
Matt Jordan 2015-05-04 09:25:55 -05:00 committed by Gerrit Code Review
commit e823fc9f9b
3 changed files with 16 additions and 0 deletions

View file

@ -56,6 +56,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 11.16 to 11.17
chan_dahdi:
- For users using the FXO port (FXS signaling) distinctive ring detection

View file

@ -54,6 +54,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 */
@ -109,6 +110,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);
@ -125,7 +127,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;
@ -237,6 +242,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 */

View file

@ -161,6 +161,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