58static const char desc[] = 
"Customizable SQLite3 CDR Backend";
 
   59static const char name[] = 
"cdr_sqlite3_custom";
 
   87        ast_log(
LOG_ERROR, 
"Out of memory creating temporary buffer for column list for table '%s.'\n", 
table);
 
   91        ast_log(
LOG_ERROR, 
"Out of memory creating temporary buffer for column list for table '%s.'\n", 
table);
 
   95    while ((col = 
strsep(&cols, 
","))) {
 
   97        escaped = sqlite3_mprintf(
"%q", col);
 
  105        sqlite3_free(escaped);
 
 
  133        ast_log(
LOG_ERROR, 
"Out of memory creating temporary buffer for value '%s'\n", tmp);
 
  137    for (i = 0; i < 
val.argc; i++) {
 
  146        strcpy(
value->expression, v); 
 
 
  182        strcpy(
table, 
"cdr");
 
  188            ast_log(
LOG_WARNING, 
"Invalid busy_timeout value '%s' specified. Using 1000 instead.\n", tmp);
 
  208    ast_verb(4, 
"cdr_sqlite3_custom: Logging CDR records to table '%s' in 'master.db'\n", 
table);
 
 
  249        char subst_buf[2048];
 
  256            ast_log(
LOG_ERROR, 
"Unable to allocate channel for variable substitution.\n");
 
  264            escaped = sqlite3_mprintf(
"%q", subst_buf);
 
  266            sqlite3_free(escaped);
 
 
  312    res = sqlite3_open(filename, &
db);
 
  313    if (res != SQLITE_OK) {
 
  320    sql = sqlite3_mprintf(
"SELECT COUNT(AcctId) FROM %q;", 
table);
 
  323    if (res != SQLITE_OK) {
 
  325        sql = sqlite3_mprintf(
"CREATE TABLE %q (AcctId INTEGER PRIMARY KEY, %s)", 
table, 
columns);
 
  328        if (res != SQLITE_OK) {
 
 
static int load_config(void)
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_calloc(num, len)
A wrapper for calloc()
int ast_cdr_unregister(const char *name)
Unregister a CDR handling engine.
int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be)
Register a CDR handling engine.
struct ast_cdr * ast_cdr_dup(struct ast_cdr *cdr)
Duplicate a public CDR.
static int free_config(void)
static int load_values_config(const char *tmp)
static int load_column_config(const char *tmp)
static int write_cdr(struct ast_cdr *cdr)
static const char config_file[]
static int load_module(void)
static int unload_module(void)
static void dummy(char *unused,...)
General Asterisk PBX channel definitions.
#define ast_channel_unref(c)
Decrease channel reference count.
void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value)
#define ast_dummy_channel_alloc()
Create a fake channel structure.
Standard Command Line Interface.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_STANDARD_RAW_ARGS(args, parse)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
#define CONFIG_STATUS_FILEMISSING
#define CONFIG_STATUS_FILEUNCHANGED
#define CONFIG_STATUS_FILEINVALID
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
@ CONFIG_FLAG_FILEUNCHANGED
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define ast_mutex_unlock(a)
#define ast_mutex_lock(a)
#define AST_MUTEX_DEFINE_STATIC(mutex)
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_EXTENDED
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_LOG_DIR
Core PBX routines and definitions.
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
size_t attribute_pure ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
char * ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
Strip leading/trailing whitespace and quotes from a string.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
char *attribute_pure ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
Responsible for call detail data.
Main Channel structure associated with a channel.
Structure used to handle boolean flags.
Support for dynamic strings.
int error(const char *format,...)