summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-10-27 20:04:17 +0000
committerMatthew Jordan <mjordan@digium.com>2013-10-27 20:04:17 +0000
commit3713fa5c9f9bab64f21a3602c4a201bcb2458084 (patch)
tree14a82dae119e398850640e050a97801bcffd3d96 /addons
parent2e24dfe4d1c44f978607aaee80225db8e18967fc (diff)
Prevent CDR backends from unregistering while billing data is in flight
This patch makes it so that CDR backends cannot be unregistered while active CDR records exist. This helps to prevent billing data from being lost during restarts and shutdowns. Review: https://reviewboard.asterisk.org/r/2880/ ........ Merged revisions 402081 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402082 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'addons')
-rw-r--r--addons/cdr_mysql.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/addons/cdr_mysql.c b/addons/cdr_mysql.c
index 25b55b35f..b00a3f345 100644
--- a/addons/cdr_mysql.c
+++ b/addons/cdr_mysql.c
@@ -384,9 +384,11 @@ static int my_unload_module(int reload)
}
dbport = 0;
- ast_cdr_unregister(name);
-
- return 0;
+ if (reload) {
+ return ast_cdr_backend_suspend(name);
+ } else {
+ return ast_cdr_unregister(name);
+ }
}
static int my_load_config_string(struct ast_config *cfg, const char *category, const char *variable, struct ast_str **field, const char *def)
@@ -660,7 +662,11 @@ static int my_load_module(int reload)
return AST_MODULE_LOAD_FAILURE;
}
- res = ast_cdr_register(name, desc, mysql_log);
+ if (!reload) {
+ res = ast_cdr_register(name, desc, mysql_log);
+ } else {
+ res = ast_cdr_backend_unsuspend(name);
+ }
if (res) {
ast_log(LOG_ERROR, "Unable to register MySQL CDR handling\n");
} else {