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
This commit is contained in:
Naveen Albert 2022-12-22 01:58:54 +00:00 committed by George Joseph
parent 1c9f8ad7a6
commit a46d5f9b76
3 changed files with 9 additions and 76 deletions

View File

@ -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 @@ enum reset_cdr_options {
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 @@ STASIS_MESSAGE_TYPE_DEFN_LOCAL(appcdr_message_type);
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 @@ static void appcdr_callback(void *data, struct stasis_subscription *sub, struct
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 @@ static int resetcdr_exec(struct ast_channel *chan, const char *data)
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 @@ static int resetcdr_exec(struct ast_channel *chan, const char *data)
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 @@ static int unload_module(void)
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 @@ static int load_module(void)
}
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();

View File

@ -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>

View File

@ -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.