00001 /* 00002 * Asterisk -- An open source telephony toolkit. 00003 * 00004 * Copyright (C) 1999 - 2005, Digium, Inc. 00005 * 00006 * Martin Pycko <martinp@digium.com> 00007 * 00008 * See http://www.asterisk.org for more information about 00009 * the Asterisk project. Please do not directly contact 00010 * any of the maintainers of this project for assistance; 00011 * the project provides a web site, mailing lists and IRC 00012 * channels for your use. 00013 * 00014 * This program is free software, distributed under the terms of 00015 * the GNU General Public License Version 2. See the LICENSE file 00016 * at the top of the source tree. 00017 */ 00018 00019 /*! \file 00020 * \brief Applications connected with CDR engine 00021 * 00022 * \ingroup applications 00023 */ 00024 00025 #include <sys/types.h> 00026 #include <stdlib.h> 00027 00028 #include "asterisk.h" 00029 00030 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 7221 $") 00031 00032 #include "asterisk/channel.h" 00033 #include "asterisk/module.h" 00034 #include "asterisk/pbx.h" 00035 00036 00037 static char *tdesc = "Tell Asterisk to not maintain a CDR for the current call"; 00038 00039 static char *nocdr_descrip = 00040 " NoCDR(): This application will tell Asterisk not to maintain a CDR for the\n" 00041 "current call.\n"; 00042 00043 static char *nocdr_app = "NoCDR"; 00044 static char *nocdr_synopsis = "Tell Asterisk to not maintain a CDR for the current call"; 00045 00046 STANDARD_LOCAL_USER; 00047 00048 LOCAL_USER_DECL; 00049 00050 static int nocdr_exec(struct ast_channel *chan, void *data) 00051 { 00052 struct localuser *u; 00053 00054 LOCAL_USER_ADD(u); 00055 00056 if (chan->cdr) { 00057 ast_cdr_free(chan->cdr); 00058 chan->cdr = NULL; 00059 } 00060 00061 LOCAL_USER_REMOVE(u); 00062 00063 return 0; 00064 } 00065 00066 int unload_module(void) 00067 { 00068 int res; 00069 00070 res = ast_unregister_application(nocdr_app); 00071 00072 STANDARD_HANGUP_LOCALUSERS; 00073 00074 return res; 00075 } 00076 00077 int load_module(void) 00078 { 00079 return ast_register_application(nocdr_app, nocdr_exec, nocdr_synopsis, nocdr_descrip); 00080 } 00081 00082 char *description(void) 00083 { 00084 return tdesc; 00085 } 00086 00087 int usecount(void) 00088 { 00089 int res; 00090 STANDARD_USECOUNT(res); 00091 return res; 00092 } 00093 00094 char *key() 00095 { 00096 return ASTERISK_GPL_KEY; 00097 }