Make it possible to disable individual cdr files per accountcode in cdr_csv

Review: https://reviewboard.asterisk.org/r/678/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274866 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Olle Johansson
2010-07-09 11:06:19 +00:00
parent c0fd67750b
commit 28cbe2f75e
2 changed files with 12 additions and 1 deletions

View File

@@ -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));
}