diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-09 18:57:33 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-09 18:57:33 +0000 |
commit | 788b7d67f47e64ff11407365ea9f8c0fbadcaea6 (patch) | |
tree | 6326e940c37b4289323bc94ff1fbdf0675727508 /cdr/cdr_csv.c | |
parent | e12672b2485d5152712f9643a040e3acc7e32cd2 (diff) |
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/branches/1.4@113874 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr/cdr_csv.c')
-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 00b8de320..527646e29 100644 --- a/cdr/cdr_csv.c +++ b/cdr/cdr_csv.c @@ -57,6 +57,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 */ @@ -324,6 +325,7 @@ static int csv_log(struct ast_cdr *cdr) static int unload_module(void) { ast_cdr_unregister(name); + loaded = 0; return 0; } @@ -337,13 +339,21 @@ static int load_module(void) res = ast_cdr_register(name, ast_module_info->description, csv_log); if (res) { ast_log(LOG_ERROR, "Unable to register CSV CDR handling\n"); + } else { + loaded = 1; } return res; } static int reload(void) { - load_config(); + if (load_config()) { + loaded = 1; + } else { + loaded = 0; + ast_log(LOG_WARNING, "No [csv] section in cdr.conf. Unregistering backend.\n"); + ast_cdr_unregister(name); + } return 0; } |