Prevent CDR backends from unregistering while billing data is in flight
[asterisk/asterisk.git] / cdr / cdr_custom.c
index 2a3b1a1..51235db 100644 (file)
@@ -184,7 +184,9 @@ static int custom_log(struct ast_cdr *cdr)
 
 static int unload_module(void)
 {
-       ast_cdr_unregister(name);
+       if (ast_cdr_unregister(name)) {
+               return -1;
+       }
 
        if (AST_RWLIST_WRLOCK(&sinks)) {
                ast_cdr_register(name, ast_module_info->description, custom_log);