Asterisk - The Open Source Telephony Project GIT-master-80b953f
Loading...
Searching...
No Matches
cdr_custom.c
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 1999 - 2009, Digium, Inc.
5 *
6 * Mark Spencer <markster@digium.com>
7 *
8 * Includes code and algorithms from the Zapata library.
9 *
10 * See http://www.asterisk.org for more information about
11 * the Asterisk project. Please do not directly contact
12 * any of the maintainers of this project for assistance;
13 * the project provides a web site, mailing lists and IRC
14 * channels for your use.
15 *
16 * This program is free software, distributed under the terms of
17 * the GNU General Public License Version 2. See the LICENSE file
18 * at the top of the source tree.
19 */
20
21/*!
22 * \file
23 * \brief Custom Comma Separated Value CDR records.
24 *
25 * \author Mark Spencer <markster@digium.com>
26 *
27 * \arg See also \ref AstCDR
28 *
29 * Logs in LOG_DIR/cdr_custom
30 * \ingroup cdr_drivers
31 *
32 * The logic for this module now resides in res/res_cdrel_custom.c.
33 *
34 */
35
36/*! \li \ref cdr_custom.c uses the configuration file \ref cdr_custom.conf
37 * \addtogroup configuration_file Configuration Files
38 */
39
40/*!
41 * \page cdr_custom.conf cdr_custom.conf
42 * \verbinclude cdr_custom.conf.sample
43 */
44
45/*** MODULEINFO
46 <depend>res_cdrel_custom</depend>
47 <support_level>core</support_level>
48 ***/
49
50#include "asterisk.h"
51
52#include "asterisk/cdr.h"
53#include "asterisk/module.h"
55
56#define CONFIG "cdr_custom.conf"
57
58#define CUSTOM_BACKEND_NAME "CDR File custom backend"
59
60static struct cdrel_configs *configs;
61
62/*!
63 * Protects in-flight log transactions from reloads.
64 */
66
67#define CDREL_RECORD_TYPE cdrel_record_cdr
68#define CDREL_BACKEND_TYPE cdrel_backend_text
69
70static int custom_log(struct ast_cdr *cdr)
71{
72 int res = 0;
73
75 res = cdrel_logger(configs, cdr);
77
78 return res;
79}
80
81static int unload_module(void)
82{
83 int res = 0;
84
88 if (res == 0) {
90 }
91
92 return res;
93}
94
105
106static int reload(void)
107{
108 int res = 0;
112 return res;
113}
114
115AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Customizable Comma Separated Values CDR Backend",
116 .support_level = AST_MODULE_SUPPORT_CORE,
117 .load = load_module,
118 .unload = unload_module,
119 .reload = reload,
120 .load_pri = AST_MODPRI_CDR_DRIVER,
121 .requires = "cdr,res_cdrel_custom",
Asterisk main include file. File version handling, generic pbx functions.
Call Detail Record API.
#define CDREL_RECORD_TYPE
Definition cdr_custom.c:67
static struct cdrel_configs * configs
Definition cdr_custom.c:60
#define CONFIG
Definition cdr_custom.c:56
static enum ast_module_load_result load_module(void)
Definition cdr_custom.c:95
static int custom_log(struct ast_cdr *cdr)
Definition cdr_custom.c:70
#define CDREL_BACKEND_TYPE
Definition cdr_custom.c:68
static ast_rwlock_t configs_lock
Definition cdr_custom.c:65
static int unload_module(void)
Definition cdr_custom.c:81
static int reload(void)
Definition cdr_custom.c:106
#define CUSTOM_BACKEND_NAME
Definition cdr_custom.c:58
#define ast_rwlock_wrlock(a)
Definition lock.h:243
#define ast_rwlock_rdlock(a)
Definition lock.h:242
#define ast_rwlock_init(rwlock)
wrapper for rwlock with tracking enabled
Definition lock.h:231
#define ast_rwlock_destroy(rwlock)
Definition lock.h:240
#define ast_rwlock_unlock(a)
Definition lock.h:241
Asterisk module definitions.
@ AST_MODFLAG_LOAD_ORDER
Definition module.h:331
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
Definition module.h:557
@ AST_MODPRI_CDR_DRIVER
Definition module.h:345
@ AST_MODULE_SUPPORT_CORE
Definition module.h:121
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition module.h:46
ast_module_load_result
Definition module.h:68
@ AST_MODULE_LOAD_SUCCESS
Definition module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition module.h:78
Protected header for the CDR and CEL Custom Backends.
int cdrel_logger(struct cdrel_configs *configs, void *data)
Log a record. The module's logging_cb must call this.
Definition loggers.c:270
int cdrel_reload_module(enum cdrel_backend_type backend_type, enum cdrel_record_type record_type, struct cdrel_configs **configs, const char *config_filename)
Perform module reload.
int cdrel_unload_module(enum cdrel_backend_type backend_type, enum cdrel_record_type record_type, struct cdrel_configs *configs, const char *backend_name)
Perform module unload.
struct cdrel_configs * cdrel_load_module(enum cdrel_backend_type backend_type, enum cdrel_record_type record_type, const char *config_filename, const char *backend_name, void *logging_cb)
Perform initial module load.
Responsible for call detail data.
Definition cdr.h:281
Structure for rwlock and tracking information.
Definition lock.h:164