39 #include "asterisk/module.h"
48 static const char CONFIG[] =
"cdr_syslog.conf";
52 static const char name[] =
"cdr-syslog";
69 struct cdr_config *sink;
128 int default_facility = LOG_LOCAL4;
129 int default_priority = LOG_INFO;
130 const char *catg = NULL, *tmp;
135 "Unable to load %s. Not logging custom CSV CDRs to syslog.\n", CONFIG);
149 "Invalid facility '%s' specified, defaulting to '%s'\n",
160 "Invalid priority '%s' specified, defaulting to '%s'\n",
170 if (!strcasecmp(catg,
"general")) {
176 "No 'template' parameter found for '%s'. Skipping.\n", catg);
184 "Unable to allocate memory for configuration settings.\n");
199 "Invalid facility '%s' specified for '%s,' defaulting to '%s'\n",
212 "Invalid priority '%s' specified for '%s,' defaulting to '%s'\n",
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
Main Channel structure associated with a channel.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
int ast_syslog_priority(const char *priority)
Maps a syslog priority name from a string to a syslog priority constant.
const char * ast_variable_retrieve(const struct ast_config *config, const char *category, const char *variable)
Gets a variable.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
static int load_config(int reload)
#define ast_channel_unref(c)
Decrease channel reference count.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static void dummy(char *unused,...)
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
struct ast_cdr * ast_cdr_dup(struct ast_cdr *cdr)
Duplicate a record.
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
#define ast_calloc_with_stringfields(n, type, size)
Allocate a structure with embedded stringfields in a single allocation.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define ast_mutex_lock(a)
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
const char * ast_syslog_priority_name(int priority)
Maps a syslog priority constant to a string.
const ast_string_field ident
static void free_config(void)
void ast_config_destroy(struct ast_config *config)
Destroys a config.
#define CONFIG_STATUS_FILEMISSING
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be)
Register a CDR handling engine.
struct cdr_config::@76 list
#define ast_config_load(filename, flags)
Load a config file.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
static int syslog_log(struct ast_cdr *cdr)
#define AST_STRING_FIELD(name)
Declare a string field.
char * ast_category_browse(struct ast_config *config, const char *prev)
Goes through categories.
Syslog support functions for Asterisk logging.
Core PBX routines and definitions.
Responsible for call detail data.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static enum ast_module_load_result load_module(void)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
static struct ast_threadstorage syslog_buf
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_RWLIST_REMOVE_HEAD
Structure used to handle boolean flags.
static const char CONFIG[]
#define AST_RWLIST_INSERT_TAIL
const ast_string_field format
int ast_syslog_facility(const char *facility)
Maps a syslog facility name from a string to a syslog facility constant.
#define ast_mutex_init(pmutex)
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
#define CONFIG_STATUS_FILEINVALID
#define ast_mutex_destroy(a)
struct ast_channel * ast_dummy_channel_alloc(void)
Create a fake channel structure.
#define ASTERISK_GPL_KEY
The text the key() function should return.
static int unload_module(void)
const char * ast_syslog_facility_name(int facility)
Maps a syslog facility constant to a string.
void ast_cdr_unregister(const char *name)
Unregister a CDR handling engine.
Structure for mutex and tracking information.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
#define CONFIG_STATUS_FILEUNCHANGED
#define ast_mutex_unlock(a)
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.