diff options
author | Rodrigo Ramírez Norambuena <decipher.hk@gmail.com> | 2015-04-30 07:38:11 -0400 |
---|---|---|
committer | Rodrigo Ramírez Norambuena <decipher.hk@gmail.com> | 2015-04-30 07:38:11 -0400 |
commit | 7f611fa0e8fd54d191a4c2104b5d1ed4b1f8da97 (patch) | |
tree | 1d194abccd00cd22bfd6f027aa4ed81b340bc2c7 /cdr | |
parent | 92120247e99865d97a85461b08ba763e961e6232 (diff) |
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
Diffstat (limited to 'cdr')
-rw-r--r-- | cdr/cdr_csv.c | 10 |
1 files changed, 10 insertions, 0 deletions
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 */ |