summaryrefslogtreecommitdiff
path: root/cdr
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2010-07-09 11:06:19 +0000
committerOlle Johansson <oej@edvina.net>2010-07-09 11:06:19 +0000
commit28cbe2f75e33ec3f32da8a1b91a01a0658a133ff (patch)
tree0f90f73e7cd634fe5dbeb93c7836362091887f8d /cdr
parentc0fd67750b12ed00efef5cb190e2d60f9e96c2cf (diff)
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
Diffstat (limited to 'cdr')
-rw-r--r--cdr/cdr_csv.c12
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));
}