58 #define SQLITE_BACKEND_NAME "CEL sqlite3 custom backend" 94 ast_log(
LOG_ERROR,
"Out of memory creating temporary buffer for column list for table '%s.'\n",
table);
98 ast_log(
LOG_ERROR,
"Out of memory creating temporary buffer for column list for table '%s.'\n",
table);
102 while ((col =
strsep(&cols,
","))) {
104 escaped = sqlite3_mprintf(
"%q", col);
112 sqlite3_free(escaped);
137 ast_log(
LOG_ERROR,
"Out of memory creating temporary buffer for value '%s'\n", tmp);
140 while ((val =
strsep(&vals,
","))) {
143 value =
ast_calloc(
sizeof(
char),
sizeof(*value) + strlen(val) + 1);
149 value->
expression = (
char *) value +
sizeof(*value);
167 reload ?
"re" :
"", reload ?
"" :
"Module not activated.");
188 strcpy(
table,
"cel");
194 ast_log(
LOG_WARNING,
"Invalid busy_timeout value '%s' specified. Using 1000 instead.\n", tmp);
214 ast_verb(3,
"Logging CEL records to table '%s' in 'master.db'\n",
table);
254 char subst_buf[2048];
268 escaped = sqlite3_mprintf(
"%q", subst_buf);
270 sqlite3_free(escaped);
278 if (sqlite3_exec(
db, sql,
NULL,
NULL, &error) != SQLITE_OK) {
313 res = sqlite3_open(filename, &
db);
314 if (res != SQLITE_OK) {
321 sql = sqlite3_mprintf(
"SELECT COUNT(*) FROM %q;",
table);
324 if (res != SQLITE_OK) {
326 sql = sqlite3_mprintf(
"CREATE TABLE %q (AcctId INTEGER PRIMARY KEY, %s)",
table,
columns);
327 res = sqlite3_exec(
db, sql,
NULL,
NULL, &error);
329 if (res != SQLITE_OK) {
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
static void write_cel(struct ast_event *event)
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
int ast_cel_backend_register(const char *name, ast_cel_backend_cb backend_callback)
Register a CEL backend.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static void dummy(char *unused,...)
#define CONFIG_STATUS_FILEINVALID
Structure for variables, used for configurations and for channel variables.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#define ast_mutex_lock(a)
static int load_module(void)
#define ast_strdup(str)
A wrapper for strdup()
#define ast_verb(level,...)
#define ast_strlen_zero(foo)
static int load_config(int reload)
Configuration File Parser.
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_debug(level,...)
Log a DEBUG message.
#define ast_config_load(filename, flags)
Load a config file.
General Asterisk PBX channel definitions.
Asterisk file paths, configured in asterisk.conf.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
void ast_config_destroy(struct ast_config *config)
Destroys a config.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
static void free_config(void)
Core PBX routines and definitions.
int ast_cel_backend_unregister(const char *name)
Unregister a CEL backend.
#define CONFIG_STATUS_FILEUNCHANGED
#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_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static const char config_file[]
const char * ast_config_AST_LOG_DIR
#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_calloc(num, len)
A wrapper for calloc()
static int load_values_config(const char *tmp)
struct ast_channel * ast_cel_fabricate_channel_from_event(const struct ast_event *event)
Create a fake channel from data in a CEL event.
#define SQLITE_BACKEND_NAME
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *result,...)
The argument parsing routine.
Module has failed to load, may be in an inconsistent state.
Structure used to handle boolean flags.
Support for logging to various files, console and syslog Configuration in file logger.conf.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
#define CONFIG_STATUS_FILEMISSING
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
char * strsep(char **str, const char *delims)
Standard Command Line Interface.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
static int load_column_config(const char *tmp)
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
static int unload_module(void)
Options provided by main asterisk program.
int error(const char *format,...)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define AST_MUTEX_DEFINE_STATIC(mutex)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
#define ast_mutex_unlock(a)