Asterisk - The Open Source Telephony Project GIT-master-80b953f
Loading...
Searching...
No Matches
Macros | Functions | Variables
cdr_custom.c File Reference

Custom Comma Separated Value CDR records. More...

#include "asterisk.h"
#include "asterisk/cdr.h"
#include "asterisk/module.h"
#include "asterisk/res_cdrel_custom.h"
Include dependency graph for cdr_custom.c:

Go to the source code of this file.

Macros

#define CDREL_BACKEND_TYPE   cdrel_backend_text
 
#define CDREL_RECORD_TYPE   cdrel_record_cdr
 
#define CONFIG   "cdr_custom.conf"
 
#define CUSTOM_BACKEND_NAME   "CDR File custom backend"
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int custom_log (struct ast_cdr *cdr)
 
static enum ast_module_load_result load_module (void)
 
static int reload (void)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Customizable Comma Separated Values CDR Backend" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CDR_DRIVER, .requires = "cdr,res_cdrel_custom", }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct cdrel_configs * configs
 
static ast_rwlock_t configs_lock
 

Detailed Description

Custom Comma Separated Value CDR records.

Author
Mark Spencer marks.nosp@m.ter@.nosp@m.digiu.nosp@m.m.co.nosp@m.m

Logs in LOG_DIR/cdr_custom

The logic for this module now resides in res/res_cdrel_custom.c.

Definition in file cdr_custom.c.

Macro Definition Documentation

◆ CDREL_BACKEND_TYPE

#define CDREL_BACKEND_TYPE   cdrel_backend_text

Definition at line 68 of file cdr_custom.c.

◆ CDREL_RECORD_TYPE

#define CDREL_RECORD_TYPE   cdrel_record_cdr

Definition at line 67 of file cdr_custom.c.

◆ CONFIG

#define CONFIG   "cdr_custom.conf"

Definition at line 56 of file cdr_custom.c.

◆ CUSTOM_BACKEND_NAME

#define CUSTOM_BACKEND_NAME   "CDR File custom backend"

Definition at line 58 of file cdr_custom.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 122 of file cdr_custom.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 122 of file cdr_custom.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 122 of file cdr_custom.c.

◆ custom_log()

static int custom_log ( struct ast_cdr cdr)
static

Definition at line 70 of file cdr_custom.c.

71{
72 int res = 0;
73
75 res = cdrel_logger(configs, cdr);
77
78 return res;
79}
static ast_rwlock_t configs_lock
Definition cdr_custom.c:65
#define ast_rwlock_rdlock(a)
Definition lock.h:242
#define ast_rwlock_unlock(a)
Definition lock.h:241
int cdrel_logger(struct cdrel_configs *configs, void *data)
Log a record. The module's logging_cb must call this.
Definition loggers.c:270

References ast_rwlock_rdlock, ast_rwlock_unlock, cdrel_logger(), and configs_lock.

Referenced by load_module().

◆ load_module()

static enum ast_module_load_result load_module ( void  )
static

Definition at line 95 of file cdr_custom.c.

96{
97 if (ast_rwlock_init(&configs_lock) != 0) {
99 }
100
102
104}
#define CDREL_RECORD_TYPE
Definition cdr_custom.c:67
#define CONFIG
Definition cdr_custom.c:56
static int custom_log(struct ast_cdr *cdr)
Definition cdr_custom.c:70
#define CDREL_BACKEND_TYPE
Definition cdr_custom.c:68
#define CUSTOM_BACKEND_NAME
Definition cdr_custom.c:58
#define ast_rwlock_init(rwlock)
wrapper for rwlock with tracking enabled
Definition lock.h:231
@ 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
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.

References AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_rwlock_init, CDREL_BACKEND_TYPE, cdrel_load_module(), CDREL_RECORD_TYPE, CONFIG, configs_lock, CUSTOM_BACKEND_NAME, and custom_log().

◆ reload()

static int reload ( void  )
static

Definition at line 106 of file cdr_custom.c.

107{
108 int res = 0;
112 return res;
113}
#define ast_rwlock_wrlock(a)
Definition lock.h:243
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.

References ast_rwlock_unlock, ast_rwlock_wrlock, CDREL_BACKEND_TYPE, CDREL_RECORD_TYPE, cdrel_reload_module(), CONFIG, and configs_lock.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 81 of file cdr_custom.c.

82{
83 int res = 0;
84
88 if (res == 0) {
90 }
91
92 return res;
93}
#define ast_rwlock_destroy(rwlock)
Definition lock.h:240
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.

References ast_rwlock_destroy, ast_rwlock_unlock, ast_rwlock_wrlock, CDREL_BACKEND_TYPE, CDREL_RECORD_TYPE, cdrel_unload_module(), configs_lock, and CUSTOM_BACKEND_NAME.

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Customizable Comma Separated Values CDR Backend" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CDR_DRIVER, .requires = "cdr,res_cdrel_custom", }
static

Definition at line 122 of file cdr_custom.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 122 of file cdr_custom.c.

◆ configs

struct cdrel_configs* configs
static

Definition at line 60 of file cdr_custom.c.

◆ configs_lock

ast_rwlock_t configs_lock
static

Protects in-flight log transactions from reloads.

Definition at line 65 of file cdr_custom.c.

Referenced by custom_log(), load_module(), reload(), and unload_module().