diff options
Diffstat (limited to 'comms/asterisk16/patches/patch-bd')
-rw-r--r-- | comms/asterisk16/patches/patch-bd | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/comms/asterisk16/patches/patch-bd b/comms/asterisk16/patches/patch-bd index 95a24221a05..0db249f8980 100644 --- a/comms/asterisk16/patches/patch-bd +++ b/comms/asterisk16/patches/patch-bd @@ -1,21 +1,44 @@ -$NetBSD: patch-bd,v 1.1 2010/05/07 03:40:24 jnemeth Exp $ +$NetBSD: patch-bd,v 1.2 2010/06/16 08:04:45 jnemeth Exp $ # reported upstream as https://issues.asterisk.org/view.php?id=17304 +# revised patch from upstream at https://issues.asterisk.org/file_download.php?file_id=26021&type=bug ---- cdr/cdr_odbc.c.orig 2008-11-20 18:23:03.000000000 +0000 +--- cdr/cdr_odbc.c.orig 2010-05-27 21:40:55.000000000 +0000 +++ cdr/cdr_odbc.c -@@ -220,9 +220,11 @@ static int odbc_load_module(int reload) +@@ -55,6 +55,7 @@ enum { + CONFIG_LOGUNIQUEID = 1 << 0, + CONFIG_USEGMTIME = 1 << 1, + CONFIG_DISPOSITIONSTRING = 1 << 2, ++ CONFIG_REGISTERED = 1 << 3, + }; + + static struct ast_flags config = { 0 }; +@@ -220,14 +221,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 (!reload) { ++ 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) ++ 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) { + ast_config_destroy(cfg); ++ } + return res; + } + |