diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-09 19:00:40 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-09 19:00:40 +0000 |
commit | d3c8cbf15ae13f68804d5d4715a890afb35bd159 (patch) | |
tree | 30c67b3c2ef9cf76decfe92d3443f9e3f9ec77c2 | |
parent | 57edc654e19db8758ec564fc1b825d86316f849a (diff) |
Merged revisions 113874 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r113874 | tilghman | 2008-04-09 13:57:33 -0500 (Wed, 09 Apr 2008) | 4 lines
If the [csv] section does not exist in cdr.conf, then an unload/load sequence
is needed to correct the problem. Track whether the load succeeded with a
variable, so we can fix this with a simple reload event, instead.
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@113875 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | cdr/cdr_csv.c | 16 | ||||
-rw-r--r-- | configs/cdr.conf.sample | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/cdr/cdr_csv.c b/cdr/cdr_csv.c index cca1e8714..61880246c 100644 --- a/cdr/cdr_csv.c +++ b/cdr/cdr_csv.c @@ -50,6 +50,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static int usegmtime = 0; static int loguniqueid = 0; static int loguserfield = 0; +static int loaded = 0; static char *config = "cdr.conf"; /* #define CSV_LOGUNIQUEID 1 */ @@ -316,6 +317,7 @@ static int csv_log(struct ast_cdr *cdr) static int unload_module(void) { ast_cdr_unregister(name); + loaded = 0; return 0; } @@ -326,15 +328,23 @@ static int load_module(void) if(!load_config(0)) return AST_MODULE_LOAD_DECLINE; - if ((res = ast_cdr_register(name, ast_module_info->description, csv_log))) + if ((res = ast_cdr_register(name, ast_module_info->description, csv_log))) { ast_log(LOG_ERROR, "Unable to register CSV CDR handling\n"); - + } else { + loaded = 1; + } return res; } static int reload(void) { - load_config(1); + if (load_config(1)) { + loaded = 1; + } else { + loaded = 0; + ast_log(LOG_WARNING, "No [csv] section in cdr.conf. Unregistering backend.\n"); + ast_cdr_unregister(name); + } return 0; } diff --git a/configs/cdr.conf.sample b/configs/cdr.conf.sample index c2882c1f0..693b28092 100644 --- a/configs/cdr.conf.sample +++ b/configs/cdr.conf.sample @@ -136,8 +136,8 @@ [csv] 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 +loguniqueid=yes ; log uniqueid. Default is "no" +loguserfield=yes ; log user field. Default is "no" ;[radius] ;usegmtime=yes ; log date/time in GMT |