All,
I'm new here, so be gentle... While it is probably better to disable CDR using
NoCDR() as needed, there might be instances where users would prefer to
disable CDR using NoCDR() and then re-enable it as needed using ResetCDR()
(without resetting the CDR to its initial state). Attached is a minimal patch
which adds an 'e' option to ResetCDR which allows users to re-enable CDR
only.
Stephen Kratzer
Network Engineer
CTI Networks, Inc.
Index: include/asterisk/cdr.h
===================================================================
--- include/asterisk/cdr.h (revision 88937)
+++ include/asterisk/cdr.h (working copy)
@@ -29,6 +29,7 @@
#define AST_CDR_FLAG_LOCKED (1 << 2)
#define AST_CDR_FLAG_CHILD (1 << 3)
#define AST_CDR_FLAG_POST_DISABLED (1 << 4)
+#define AST_CDR_FLAG_POST_ENABLE (1 << 5)
#define AST_CDR_NULL 0
#define AST_CDR_FAILED (1 << 0)
Index: main/cdr.c
===================================================================
--- main/cdr.c (revision 88937)
+++ main/cdr.c (working copy)
@@ -1021,6 +1021,12 @@
ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
}
+ /* enable CDR only */
+ if (ast_test_flag(&flags, AST_CDR_POST_ENABLE)) {
+ ast_clear_flag(cdr, AST_CDR_FLAG_POST_DISABLED);
+ continue;
+ }
+
/* clear variables */
if (!ast_test_flag(&flags, AST_CDR_FLAG_KEEP_VARS)) {
ast_cdr_free_vars(cdr, 0);
Index: main/pbx.c
===================================================================
--- main/pbx.c (revision 88937)
+++ main/pbx.c (working copy)
@@ -463,6 +463,7 @@
" w -- Store the current CDR record before resetting it.\n"
" a -- Store any stacked records.\n"
" v -- Save CDR variables.\n"
+ " e -- Enable CDR only (negate effects of NoCDR).\n"
},
{ "Ringing", pbx_builtin_ringing,
@@ -5594,6 +5595,7 @@
AST_APP_OPTION('w', AST_CDR_FLAG_POSTED),
AST_APP_OPTION('a', AST_CDR_FLAG_LOCKED),
AST_APP_OPTION('v', AST_CDR_FLAG_KEEP_VARS),
+ AST_APP_OPTION('e', AST_CDR_FLAG_POST_ENABLE),
});
/*!
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev