[Asterisk-code-review] app_cdr: Remove deprecated application and option. (asterisk[master])

N A asteriskteam at digium.com
Wed Dec 21 20:01:20 CST 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19746 )


Change subject: app_cdr: Remove deprecated application and option.
......................................................................

app_cdr: Remove deprecated application and option.

This removes the deprecated NoCDR application, which
was deprecated in Asterisk 12, having long been fully
superseded by the CDR_PROP function.

The deprecated e option to ResetCDR is also removed
for the same reason.

ASTERISK-30371 #close

Change-Id: Id9ed094d8e4baf98bcbc610035c2295bfafe9ec0
---
M apps/app_cdr.c
M apps/app_forkcdr.c
A doc/UPGRADE-staging/app_cdr.txt
3 files changed, 27 insertions(+), 76 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/46/19746/1

diff --git a/apps/app_cdr.c b/apps/app_cdr.c
index 3e52302..6929088 100644
--- a/apps/app_cdr.c
+++ b/apps/app_cdr.c
@@ -38,26 +38,6 @@
 #include "asterisk/stasis_message_router.h"
 
 /*** DOCUMENTATION
-	<application name="NoCDR" language="en_US">
-		<synopsis>
-			Tell Asterisk to not maintain a CDR for this channel.
-		</synopsis>
-		<syntax />
-		<description>
-			<para>This application will tell Asterisk not to maintain a CDR for
-			the current channel. This does <emphasis>NOT</emphasis> mean that
-			information is not tracked; rather, if the channel is hung up no
-			CDRs will be created for that channel.</para>
-			<para>If a subsequent call to ResetCDR occurs, all non-finalized
-			CDRs created for the channel will be enabled.</para>
-			<note><para>This application is deprecated. Please use the CDR_PROP
-			function to disable CDRs on a channel.</para></note>
-		</description>
-		<see-also>
-			<ref type="application">ResetCDR</ref>
-			<ref type="function">CDR_PROP</ref>
-		</see-also>
-	</application>
 	<application name="ResetCDR" language="en_US">
 		<synopsis>
 			Resets the Call Data Record.
@@ -68,10 +48,6 @@
 					<option name="v">
 						<para>Save the CDR variables during the reset.</para>
 					</option>
-					<option name="e">
-						<para>Enable the CDRs for this channel only (negate
-						effects of NoCDR).</para>
-					</option>
 				</optionlist>
 			</parameter>
 		</syntax>
@@ -84,21 +60,14 @@
 			current time.</para>
 			<para>3. All variables are wiped from the CDR. Note that this step
 			can be prevented with the <literal>v</literal> option.</para>
-			<para>On the other hand, if the <literal>e</literal> option is
-			specified, the effects of the NoCDR application will be lifted. CDRs
-			will be re-enabled for this channel.</para>
-			<note><para>The <literal>e</literal> option is deprecated. Please
-			use the CDR_PROP function instead.</para></note>
 		</description>
 		<see-also>
 			<ref type="application">ForkCDR</ref>
-			<ref type="application">NoCDR</ref>
 			<ref type="function">CDR_PROP</ref>
 		</see-also>
 	</application>
  ***/
 
-static const char nocdr_app[] = "NoCDR";
 static const char resetcdr_app[] = "ResetCDR";
 
 enum reset_cdr_options {
@@ -109,7 +78,6 @@
 
 AST_APP_OPTIONS(resetcdr_opts, {
 	AST_APP_OPTION('v', AST_CDR_FLAG_KEEP_VARS),
-	AST_APP_OPTION('e', AST_CDR_FLAG_DISABLE_ALL),
 });
 
 STASIS_MESSAGE_TYPE_DEFN_LOCAL(appcdr_message_type);
@@ -118,10 +86,6 @@
 struct app_cdr_message_payload {
 	/*! The name of the channel to be manipulated */
 	const char *channel_name;
-	/*! Disable the CDR for this channel */
-	unsigned int disable:1;
-	/*! Re-enable the CDR for this channel */
-	unsigned int reenable:1;
 	/*! Reset the CDR */
 	unsigned int reset:1;
 	/*! If reseting the CDR, keep the variables */
@@ -141,24 +105,9 @@
 		return;
 	}
 
-	if (payload->disable) {
-		if (ast_cdr_set_property(payload->channel_name, AST_CDR_FLAG_DISABLE_ALL)) {
-			ast_log(AST_LOG_WARNING, "Failed to disable CDRs on channel %s\n",
-				payload->channel_name);
-		}
-	}
-
-	if (payload->reenable) {
-		if (ast_cdr_clear_property(payload->channel_name, AST_CDR_FLAG_DISABLE_ALL)) {
-			ast_log(AST_LOG_WARNING, "Failed to enable CDRs on channel %s\n",
-				payload->channel_name);
-		}
-	}
-
 	if (payload->reset) {
 		if (ast_cdr_reset(payload->channel_name, payload->keep_variables)) {
-			ast_log(AST_LOG_WARNING, "Failed to reset CDRs on channel %s\n",
-				payload->channel_name);
+			ast_log(AST_LOG_WARNING, "Failed to reset CDRs on channel %s\n", payload->channel_name);
 		}
 	}
 }
@@ -204,10 +153,6 @@
 	payload->channel_name = ast_channel_name(chan);
 	payload->reset = 1;
 
-	if (ast_test_flag(&flags, AST_CDR_FLAG_DISABLE_ALL)) {
-		payload->reenable = 1;
-	}
-
 	if (ast_test_flag(&flags, AST_CDR_FLAG_KEEP_VARS)) {
 		payload->keep_variables = 1;
 	}
@@ -215,21 +160,6 @@
 	return publish_app_cdr_message(chan, payload);
 }
 
-static int nocdr_exec(struct ast_channel *chan, const char *data)
-{
-	RAII_VAR(struct app_cdr_message_payload *, payload,
-		ao2_alloc(sizeof(*payload), NULL), ao2_cleanup);
-
-	if (!payload) {
-		return -1;
-	}
-
-	payload->channel_name = ast_channel_name(chan);
-	payload->disable = 1;
-
-	return publish_app_cdr_message(chan, payload);
-}
-
 static int unload_module(void)
 {
 	RAII_VAR(struct stasis_message_router *, router, ast_cdr_message_router(), ao2_cleanup);
@@ -238,7 +168,6 @@
 		stasis_message_router_remove(router, appcdr_message_type());
 	}
 	STASIS_MESSAGE_TYPE_CLEANUP(appcdr_message_type);
-	ast_unregister_application(nocdr_app);
 	ast_unregister_application(resetcdr_app);
 	return 0;
 }
@@ -253,10 +182,8 @@
 	}
 
 	res |= STASIS_MESSAGE_TYPE_INIT(appcdr_message_type);
-	res |= ast_register_application_xml(nocdr_app, nocdr_exec);
 	res |= ast_register_application_xml(resetcdr_app, resetcdr_exec);
-	res |= stasis_message_router_add(router, appcdr_message_type(),
-	                                 appcdr_callback, NULL);
+	res |= stasis_message_router_add(router, appcdr_message_type(), appcdr_callback, NULL);
 
 	if (res) {
 		unload_module();
diff --git a/apps/app_forkcdr.c b/apps/app_forkcdr.c
index a906fc9..9e4c9ae 100644
--- a/apps/app_forkcdr.c
+++ b/apps/app_forkcdr.c
@@ -87,7 +87,7 @@
 		</description>
 		<see-also>
 			<ref type="function">CDR</ref>
-			<ref type="application">NoCDR</ref>
+			<ref type="function">CDR_PROP</ref>
 			<ref type="application">ResetCDR</ref>
 		</see-also>
 	</application>
diff --git a/doc/UPGRADE-staging/app_cdr.txt b/doc/UPGRADE-staging/app_cdr.txt
new file mode 100644
index 0000000..114f0ad
--- /dev/null
+++ b/doc/UPGRADE-staging/app_cdr.txt
@@ -0,0 +1,6 @@
+Subject: app_cdr
+Master-Only: True
+
+The previously deprecated NoCDR application has been removed.
+Additionally, the previously deprecated 'e' option to the ResetCDR
+application has been removed.

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19746
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Id9ed094d8e4baf98bcbc610035c2295bfafe9ec0
Gerrit-Change-Number: 19746
Gerrit-PatchSet: 1
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221222/470df0bc/attachment-0001.html>


More information about the asterisk-code-review mailing list