* \ingroup cdr_drivers
*/
+/*! \li \ref cdr_syslog.c uses the configuration file \ref cdr_syslog.conf
+ * \addtogroup configuration_file Configuration Files
+ */
+
+/*!
+ * \page cdr_syslog.conf cdr_syslog.conf
+ * \verbinclude cdr_syslog.conf.sample
+ */
+
/*** MODULEINFO
- <depend>syslog</depend>
+ <depend>syslog</depend>
+ <support_level>core</support_level>
***/
#include "asterisk.h"
static const char name[] = "cdr-syslog";
-struct cdr_config {
+struct cdr_syslog_config {
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(ident);
AST_STRING_FIELD(format);
int facility;
int priority;
ast_mutex_t lock;
- AST_LIST_ENTRY(cdr_config) list;
+ AST_LIST_ENTRY(cdr_syslog_config) list;
};
-static AST_RWLIST_HEAD_STATIC(sinks, cdr_config);
+static AST_RWLIST_HEAD_STATIC(sinks, cdr_syslog_config);
static void free_config(void)
{
- struct cdr_config *sink;
+ struct cdr_syslog_config *sink;
while ((sink = AST_RWLIST_REMOVE_HEAD(&sinks, list))) {
ast_mutex_destroy(&sink->lock);
ast_free(sink);
{
struct ast_channel *dummy;
struct ast_str *str;
- struct cdr_config *sink;
+ struct cdr_syslog_config *sink;
/* Batching saves memory management here. Otherwise, it's the same as doing an
allocation and free each time. */
/* We need to dup here since the cdr actually belongs to the other channel,
so when we release this channel we don't want the CDR getting cleaned
up prematurely. */
- dummy->cdr = ast_cdr_dup(cdr);
+ ast_channel_cdr_set(dummy, ast_cdr_dup(cdr));
AST_RWLIST_RDLOCK(&sinks);
AST_RWLIST_UNLOCK(&sinks);
- ast_channel_release(dummy);
+ ast_channel_unref(dummy);
return 0;
}
}
while ((catg = ast_category_browse(cfg, catg))) {
- struct cdr_config *sink;
+ struct cdr_syslog_config *sink;
if (!strcasecmp(catg, "general")) {
continue;
continue;
}
- sink = ast_calloc_with_stringfields(1, struct cdr_config, 1024);
+ sink = ast_calloc_with_stringfields(1, struct cdr_syslog_config, 1024);
if (!sink) {
ast_log(AST_LOG_ERROR,
static int unload_module(void)
{
- ast_cdr_unregister(name);
+ if (ast_cdr_unregister(name)) {
+ return -1;
+ }
if (AST_RWLIST_WRLOCK(&sinks)) {
ast_cdr_register(name, ast_module_info->description, syslog_log);
return AST_MODULE_LOAD_DECLINE;
}
- free_config();
- res = load_config(1);
+ if ((res = load_config(1))) {
+ free_config();
+ }
+
AST_RWLIST_UNLOCK(&sinks);
return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;