diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-09 11:06:19 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-09 11:06:19 +0000 |
commit | 668fe85731160e1a4a36d9bcbbd9891a1720caf4 (patch) | |
tree | 0f90f73e7cd634fe5dbeb93c7836362091887f8d /cdr | |
parent | b502005acdeab661893f341e4303171b705ed773 (diff) |
Make it possible to disable individual cdr files per accountcode in cdr_csv
Review: https://reviewboard.asterisk.org/r/678/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@274866 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr')
-rw-r--r-- | cdr/cdr_csv.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cdr/cdr_csv.c b/cdr/cdr_csv.c index 10c4eebbd..a504b6b09 100644 --- a/cdr/cdr_csv.c +++ b/cdr/cdr_csv.c @@ -46,6 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #define DATE_FORMAT "%Y-%m-%d %T" static int usegmtime = 0; +static int accountlogs; static int loguniqueid = 0; static int loguserfield = 0; static int loaded = 0; @@ -100,6 +101,7 @@ static int load_config(int reload) } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) return 1; + accountlogs = 1; usegmtime = 0; loguniqueid = 0; loguserfield = 0; @@ -115,6 +117,14 @@ static int load_config(int reload) ast_debug(1, "logging time in GMT\n"); } + /* Turn on/off separate files per accountcode. Default is on (as before) */ + if ((tmp = ast_variable_retrieve(cfg, "csv", "accountlogs"))) { + accountlogs = ast_true(tmp); + if (accountlogs) { + ast_debug(1, "logging in separate files per accountcode\n"); + } + } + if ((tmp = ast_variable_retrieve(cfg, "csv", "loguniqueid"))) { loguniqueid = ast_true(tmp); if (loguniqueid) @@ -304,7 +314,7 @@ static int csv_log(struct ast_cdr *cdr) ast_log(LOG_ERROR, "Unable to re-open master file %s : %s\n", csvmaster, strerror(errno)); } - if (!ast_strlen_zero(cdr->accountcode)) { + if (accountlogs && !ast_strlen_zero(cdr->accountcode)) { if (writefile(buf, cdr->accountcode)) ast_log(LOG_WARNING, "Unable to write CSV record to account file '%s' : %s\n", cdr->accountcode, strerror(errno)); } |