a whole pile of Zaptel/DAHDI compatibility work, with lots more to come... this tree...
[asterisk-bristuff.git] / apps / app_cdr.c
bloba70d9d2f528b8c51924a76c3258c6c10c8007b04
1 /*
2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2005, Digium, Inc.
6 * Martin Pycko <martinp@digium.com>
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
19 /*! \file
21 * \brief Applications connected with CDR engine
23 * Martin Pycko <martinp@digium.com>
25 * \ingroup applications
28 #include "asterisk.h"
30 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
32 #include <sys/types.h>
33 #include <stdlib.h>
35 #include "asterisk/channel.h"
36 #include "asterisk/module.h"
37 #include "asterisk/pbx.h"
39 static char *nocdr_descrip =
40 " NoCDR(): This application will tell Asterisk not to maintain a CDR for the\n"
41 "current call.\n";
43 static char *nocdr_app = "NoCDR";
44 static char *nocdr_synopsis = "Tell Asterisk to not maintain a CDR for the current call";
47 static int nocdr_exec(struct ast_channel *chan, void *data)
49 struct ast_module_user *u;
51 u = ast_module_user_add(chan);
53 if (chan->cdr) {
54 ast_set_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED);
57 ast_module_user_remove(u);
59 return 0;
62 static int unload_module(void)
64 int res;
66 res = ast_unregister_application(nocdr_app);
68 ast_module_user_hangup_all();
70 return res;
73 static int load_module(void)
75 return ast_register_application(nocdr_app, nocdr_exec, nocdr_synopsis, nocdr_descrip);
78 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Tell Asterisk to not maintain a CDR for the current call");