aboutsummaryrefslogtreecommitdiffstats
path: root/cdr
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-25 18:21:27 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-25 18:21:27 +0000
commit5826baf5e11c0b1614adb15307ac6eafe1602f8d (patch)
treeb304021ed20e3aaffa05a0993c8555e70e319219 /cdr
parentd2a915204ae5f232a918dc6b53b04d20a5dfb0f6 (diff)
Don't re-register CDR module on reload.
(closes issue #17304) Reported by: jnemeth Patches: 20100507__issue17304.diff.txt uploaded by tilghman (license 14) Tested by: jnemeth git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@279410 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr')
-rw-r--r--cdr/cdr_odbc.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/cdr/cdr_odbc.c b/cdr/cdr_odbc.c
index e8a7ce828..ab4a1455d 100644
--- a/cdr/cdr_odbc.c
+++ b/cdr/cdr_odbc.c
@@ -54,6 +54,7 @@ enum {
CONFIG_USEGMTIME = 1 << 1,
CONFIG_DISPOSITIONSTRING = 1 << 2,
CONFIG_HRTIME = 1 << 3,
+ CONFIG_REGISTERED = 1 << 4,
};
static struct ast_flags config = { 0 };
@@ -242,14 +243,24 @@ static int odbc_load_module(int reload)
ast_verb(3, "cdr_odbc: dsn is %s\n", dsn);
ast_verb(3, "cdr_odbc: table is %s\n", table);
- res = ast_cdr_register(name, ast_module_info->description, odbc_log);
- if (res) {
- ast_log(LOG_ERROR, "cdr_odbc: Unable to register ODBC CDR handling\n");
+ if (!ast_test_flag(&config, CONFIG_REGISTERED)) {
+ res = ast_cdr_register(name, ast_module_info->description, odbc_log);
+ if (res) {
+ ast_log(LOG_ERROR, "cdr_odbc: Unable to register ODBC CDR handling\n");
+ } else {
+ ast_set_flag(&config, CONFIG_REGISTERED);
+ }
}
} while (0);
- if (cfg && cfg != CONFIG_STATUS_FILEUNCHANGED && cfg != CONFIG_STATUS_FILEINVALID)
+ if (ast_test_flag(&config, CONFIG_REGISTERED) && (!cfg || dsn == NULL || table == NULL)) {
+ ast_cdr_unregister(name);
+ ast_clear_flag(&config, CONFIG_REGISTERED);
+ }
+
+ if (cfg && cfg != CONFIG_STATUS_FILEUNCHANGED && cfg != CONFIG_STATUS_FILEINVALID) {
ast_config_destroy(cfg);
+ }
return res;
}