From 2a7eac9940db9041bf015b178d3841ea0bc9eba5 Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Tue, 26 Feb 2008 19:14:04 +0000 Subject: [PATCH] Add an 'e' option to ResetCDR which re-enables a CDR that has been disabled. (closes issue #11170) Reported by: kratzers Patches: ResetCDR.1.diff uploaded by kratzers (license 307) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104215 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- CHANGES | 2 ++ include/asterisk/cdr.h | 1 + main/cdr.c | 6 ++++++ main/pbx.c | 2 ++ 4 files changed, 11 insertions(+) diff --git a/CHANGES b/CHANGES index 0d58b1b..56e536f 100644 --- a/CHANGES +++ b/CHANGES @@ -478,6 +478,8 @@ Call Detail Records (but a record will still be inserted, based on what columns remain). Note that the other two features from cdr_adaptive_odbc (alias and filter) are not currently supported. + * The ResetCDR application now has an 'e' option that re-enables a CDR if it + has been disabled using the NoCDR application. Miscellaneous New Modules ------------------------- diff --git a/include/asterisk/cdr.h b/include/asterisk/cdr.h index 96a5dc4..e8727ab 100644 --- a/include/asterisk/cdr.h +++ b/include/asterisk/cdr.h @@ -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) /*! \name CDR Flags */ /*@{ */ diff --git a/main/cdr.c b/main/cdr.c index 488eeee..00d66af 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -1025,6 +1025,12 @@ void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags) ast_set_flag(cdr, AST_CDR_FLAG_POSTED); } + /* enable CDR only */ + if (ast_test_flag(&flags, AST_CDR_FLAG_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); diff --git a/main/pbx.c b/main/pbx.c index e59ee9e..d790ddd 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -589,6 +589,7 @@ static struct pbx_builtin { " 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, @@ -6846,6 +6847,7 @@ AST_APP_OPTIONS(resetcdr_opts, { 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), }); /*! -- 1.7.9.5