2003-09-18 21:17:14 +00:00
|
|
|
/*
|
2005-09-14 20:46:50 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2003-09-18 21:17:14 +00:00
|
|
|
*
|
2005-09-14 20:46:50 +00:00
|
|
|
* Copyright (C) 1999 - 2005, Digium, Inc.
|
2003-09-18 21:17:14 +00:00
|
|
|
*
|
2003-09-18 21:52:01 +00:00
|
|
|
* Martin Pycko <martinp@digium.com>
|
2003-09-18 21:17:14 +00:00
|
|
|
*
|
2005-09-14 20:46:50 +00:00
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
|
|
|
*
|
2003-09-18 21:17:14 +00:00
|
|
|
* This program is free software, distributed under the terms of
|
2005-09-14 20:46:50 +00:00
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \file
|
2005-12-30 21:18:06 +00:00
|
|
|
*
|
2005-10-24 20:12:06 +00:00
|
|
|
* \brief Applications connected with CDR engine
|
2005-09-14 20:46:50 +00:00
|
|
|
*
|
2006-10-31 06:37:48 +00:00
|
|
|
* \author Martin Pycko <martinp@digium.com>
|
2005-12-30 21:18:06 +00:00
|
|
|
*
|
2005-11-06 15:09:47 +00:00
|
|
|
* \ingroup applications
|
2003-09-18 21:17:14 +00:00
|
|
|
*/
|
|
|
|
|
2005-06-06 22:39:32 +00:00
|
|
|
#include "asterisk.h"
|
|
|
|
|
|
|
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|
|
|
|
2006-06-07 18:54:56 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2005-04-21 06:02:45 +00:00
|
|
|
#include "asterisk/channel.h"
|
|
|
|
#include "asterisk/module.h"
|
|
|
|
#include "asterisk/pbx.h"
|
2003-09-18 21:17:14 +00:00
|
|
|
|
2005-11-10 20:56:45 +00:00
|
|
|
static char *nocdr_descrip =
|
|
|
|
" NoCDR(): This application will tell Asterisk not to maintain a CDR for the\n"
|
|
|
|
"current call.\n";
|
2003-09-18 21:17:14 +00:00
|
|
|
|
|
|
|
static char *nocdr_app = "NoCDR";
|
2005-11-10 20:56:45 +00:00
|
|
|
static char *nocdr_synopsis = "Tell Asterisk to not maintain a CDR for the current call";
|
2003-09-18 21:17:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
static int nocdr_exec(struct ast_channel *chan, void *data)
|
|
|
|
{
|
2006-08-21 02:11:39 +00:00
|
|
|
struct ast_module_user *u;
|
2005-10-19 18:19:02 +00:00
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
u = ast_module_user_add(chan);
|
2005-10-19 18:19:02 +00:00
|
|
|
|
2003-09-18 21:17:14 +00:00
|
|
|
if (chan->cdr) {
|
2003-10-22 02:53:39 +00:00
|
|
|
ast_cdr_free(chan->cdr);
|
2003-09-18 21:17:14 +00:00
|
|
|
chan->cdr = NULL;
|
|
|
|
}
|
2005-10-19 18:19:02 +00:00
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
ast_module_user_remove(u);
|
2005-10-19 18:19:02 +00:00
|
|
|
|
2003-09-18 21:17:14 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int unload_module(void)
|
2003-09-18 21:17:14 +00:00
|
|
|
{
|
2005-10-18 22:52:21 +00:00
|
|
|
int res;
|
|
|
|
|
|
|
|
res = ast_unregister_application(nocdr_app);
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
ast_module_user_hangup_all();
|
2005-10-18 22:52:21 +00:00
|
|
|
|
|
|
|
return res;
|
2003-09-18 21:17:14 +00:00
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int load_module(void)
|
2003-09-18 21:17:14 +00:00
|
|
|
{
|
|
|
|
return ast_register_application(nocdr_app, nocdr_exec, nocdr_synopsis, nocdr_descrip);
|
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Tell Asterisk to not maintain a CDR for the current call");
|