3838#include "asterisk/stasis_message_router.h"
3939
4040/*** DOCUMENTATION
41- <application name="NoCDR" language="en_US">
42- <synopsis>
43- Tell Asterisk to not maintain a CDR for this channel.
44- </synopsis>
45- <syntax />
46- <description>
47- <para>This application will tell Asterisk not to maintain a CDR for
48- the current channel. This does <emphasis>NOT</emphasis> mean that
49- information is not tracked; rather, if the channel is hung up no
50- CDRs will be created for that channel.</para>
51- <para>If a subsequent call to ResetCDR occurs, all non-finalized
52- CDRs created for the channel will be enabled.</para>
53- <note><para>This application is deprecated. Please use the CDR_PROP
54- function to disable CDRs on a channel.</para></note>
55- </description>
56- <see-also>
57- <ref type="application">ResetCDR</ref>
58- <ref type="function">CDR_PROP</ref>
59- </see-also>
60- </application>
6141 <application name="ResetCDR" language="en_US">
6242 <synopsis>
6343 Resets the Call Data Record.
6848 <option name="v">
6949 <para>Save the CDR variables during the reset.</para>
7050 </option>
71- <option name="e">
72- <para>Enable the CDRs for this channel only (negate
73- effects of NoCDR).</para>
74- </option>
7551 </optionlist>
7652 </parameter>
7753 </syntax>
8460 current time.</para>
8561 <para>3. All variables are wiped from the CDR. Note that this step
8662 can be prevented with the <literal>v</literal> option.</para>
87- <para>On the other hand, if the <literal>e</literal> option is
88- specified, the effects of the NoCDR application will be lifted. CDRs
89- will be re-enabled for this channel.</para>
90- <note><para>The <literal>e</literal> option is deprecated. Please
91- use the CDR_PROP function instead.</para></note>
9263 </description>
9364 <see-also>
9465 <ref type="application">ForkCDR</ref>
95- <ref type="application">NoCDR</ref>
9666 <ref type="function">CDR_PROP</ref>
9767 </see-also>
9868 </application>
9969 ***/
10070
101- static const char nocdr_app [] = "NoCDR" ;
10271static const char resetcdr_app [] = "ResetCDR" ;
10372
10473enum reset_cdr_options {
@@ -109,7 +78,6 @@ enum reset_cdr_options {
10978
11079AST_APP_OPTIONS (resetcdr_opts , {
11180 AST_APP_OPTION ('v' , AST_CDR_FLAG_KEEP_VARS ),
112- AST_APP_OPTION ('e' , AST_CDR_FLAG_DISABLE_ALL ),
11381});
11482
11583STASIS_MESSAGE_TYPE_DEFN_LOCAL (appcdr_message_type );
@@ -118,10 +86,6 @@ STASIS_MESSAGE_TYPE_DEFN_LOCAL(appcdr_message_type);
11886struct app_cdr_message_payload {
11987 /*! The name of the channel to be manipulated */
12088 const char * channel_name ;
121- /*! Disable the CDR for this channel */
122- unsigned int disable :1 ;
123- /*! Re-enable the CDR for this channel */
124- unsigned int reenable :1 ;
12589 /*! Reset the CDR */
12690 unsigned int reset :1 ;
12791 /*! If reseting the CDR, keep the variables */
@@ -141,24 +105,9 @@ static void appcdr_callback(void *data, struct stasis_subscription *sub, struct
141105 return ;
142106 }
143107
144- if (payload -> disable ) {
145- if (ast_cdr_set_property (payload -> channel_name , AST_CDR_FLAG_DISABLE_ALL )) {
146- ast_log (AST_LOG_WARNING , "Failed to disable CDRs on channel %s\n" ,
147- payload -> channel_name );
148- }
149- }
150-
151- if (payload -> reenable ) {
152- if (ast_cdr_clear_property (payload -> channel_name , AST_CDR_FLAG_DISABLE_ALL )) {
153- ast_log (AST_LOG_WARNING , "Failed to enable CDRs on channel %s\n" ,
154- payload -> channel_name );
155- }
156- }
157-
158108 if (payload -> reset ) {
159109 if (ast_cdr_reset (payload -> channel_name , payload -> keep_variables )) {
160- ast_log (AST_LOG_WARNING , "Failed to reset CDRs on channel %s\n" ,
161- payload -> channel_name );
110+ ast_log (AST_LOG_WARNING , "Failed to reset CDRs on channel %s\n" , payload -> channel_name );
162111 }
163112 }
164113}
@@ -204,32 +153,13 @@ static int resetcdr_exec(struct ast_channel *chan, const char *data)
204153 payload -> channel_name = ast_channel_name (chan );
205154 payload -> reset = 1 ;
206155
207- if (ast_test_flag (& flags , AST_CDR_FLAG_DISABLE_ALL )) {
208- payload -> reenable = 1 ;
209- }
210-
211156 if (ast_test_flag (& flags , AST_CDR_FLAG_KEEP_VARS )) {
212157 payload -> keep_variables = 1 ;
213158 }
214159
215160 return publish_app_cdr_message (chan , payload );
216161}
217162
218- static int nocdr_exec (struct ast_channel * chan , const char * data )
219- {
220- RAII_VAR (struct app_cdr_message_payload * , payload ,
221- ao2_alloc (sizeof (* payload ), NULL ), ao2_cleanup );
222-
223- if (!payload ) {
224- return -1 ;
225- }
226-
227- payload -> channel_name = ast_channel_name (chan );
228- payload -> disable = 1 ;
229-
230- return publish_app_cdr_message (chan , payload );
231- }
232-
233163static int unload_module (void )
234164{
235165 RAII_VAR (struct stasis_message_router * , router , ast_cdr_message_router (), ao2_cleanup );
@@ -238,7 +168,6 @@ static int unload_module(void)
238168 stasis_message_router_remove (router , appcdr_message_type ());
239169 }
240170 STASIS_MESSAGE_TYPE_CLEANUP (appcdr_message_type );
241- ast_unregister_application (nocdr_app );
242171 ast_unregister_application (resetcdr_app );
243172 return 0 ;
244173}
@@ -253,10 +182,8 @@ static int load_module(void)
253182 }
254183
255184 res |= STASIS_MESSAGE_TYPE_INIT (appcdr_message_type );
256- res |= ast_register_application_xml (nocdr_app , nocdr_exec );
257185 res |= ast_register_application_xml (resetcdr_app , resetcdr_exec );
258- res |= stasis_message_router_add (router , appcdr_message_type (),
259- appcdr_callback , NULL );
186+ res |= stasis_message_router_add (router , appcdr_message_type (), appcdr_callback , NULL );
260187
261188 if (res ) {
262189 unload_module ();
0 commit comments