53#define SQLITE_BACKEND_NAME "CEL sqlite3 custom backend"
89 ast_log(
LOG_ERROR,
"Out of memory creating temporary buffer for column list for table '%s.'\n",
table);
93 ast_log(
LOG_ERROR,
"Out of memory creating temporary buffer for column list for table '%s.'\n",
table);
97 while ((col =
strsep(&cols,
","))) {
99 escaped = sqlite3_mprintf(
"%q", col);
107 sqlite3_free(escaped);
162 reload ?
"re" :
"",
reload ?
"" :
"Module not activated.");
183 strcpy(
table,
"cel");
209 ast_verb(3,
"Logging CEL records to table '%s' in 'master.db'\n",
table);
249 char subst_buf[2048];
263 escaped = sqlite3_mprintf(
"%q", subst_buf);
265 sqlite3_free(escaped);
308 res = sqlite3_open(filename, &
db);
309 if (res != SQLITE_OK) {
316 sql = sqlite3_mprintf(
"SELECT COUNT(*) FROM %q;",
table);
319 if (res != SQLITE_OK) {
321 sql = sqlite3_mprintf(
"CREATE TABLE %q (AcctId INTEGER PRIMARY KEY, %s)",
table,
columns);
324 if (res != SQLITE_OK) {
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_cel_backend_unregister(const char *name)
Unregister a CEL backend.
struct ast_channel * ast_cel_fabricate_channel_from_event(const struct ast_event *event)
Create a fake channel from data in a CEL event.
int ast_cel_backend_register(const char *name, ast_cel_backend_cb backend_callback)
Register a CEL backend.
static int load_values_config(const char *tmp)
static int load_column_config(const char *tmp)
#define SQLITE_BACKEND_NAME
static void write_cel(struct ast_event *event)
static void free_config(void)
static const char config_file[]
static int load_module(void)
static int unload_module(void)
static int load_config(int reload)
static void dummy(char *unused,...)
General Asterisk PBX channel definitions.
#define ast_channel_unref(c)
Decrease channel reference count.
Standard Command Line Interface.
char * strsep(char **str, const char *delims)
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.
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)
@ CONFIG_FLAG_FILEUNCHANGED
Support for logging to various files, console and syslog Configuration in file logger....
#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.
Options provided by main asterisk program.
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.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str 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.
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within 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.
Main Channel structure associated with a channel.
Structure used to handle boolean flags.
Support for dynamic strings.
Structure for variables, used for configurations and for channel variables.
int error(const char *format,...)