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 * 00021 * \brief Applications connected with CDR engine 00022 * 00023 * Martin Pycko <martinp@digium.com> 00024 * 00025 * \ingroup applications 00026 */ 00027 00028 #include "asterisk.h" 00029 00030 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 61136 $") 00031 00032 #include <sys/types.h> 00033 #include <stdlib.h> 00034 00035 #include "asterisk/channel.h" 00036 #include "asterisk/module.h" 00037 #include "asterisk/pbx.h" 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 00047 static int nocdr_exec(struct ast_channel *chan, void *data) 00048 { 00049 struct ast_module_user *u; 00050 00051 u = ast_module_user_add(chan); 00052 00053 if (chan->cdr) { 00054 ast_set_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED); 00055 } 00056 00057 ast_module_user_remove(u); 00058 00059 return 0; 00060 } 00061 00062 static int unload_module(void) 00063 { 00064 int res; 00065 00066 res = ast_unregister_application(nocdr_app); 00067 00068 ast_module_user_hangup_all(); 00069 00070 return res; 00071 } 00072 00073 static int load_module(void) 00074 { 00075 return ast_register_application(nocdr_app, nocdr_exec, nocdr_synopsis, nocdr_descrip); 00076 } 00077 00078 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Tell Asterisk to not maintain a CDR for the current call");