35 #include "asterisk/file.h"
199 ast_log(
LOG_WARNING,
"Syntax: REALTIME(family,fieldmatch[,matchvalue[,delim1[,delim2]]]) - missing argument!\n");
223 for (var = head;
var; n++, var = var->
next)
224 resultslen += strlen(var->name) + strlen(var->value);
226 resultslen += n * (strlen(
args.delim1) + strlen(
args.delim2)) + 1;
228 if (resultslen > len) {
229 ast_log(
LOG_WARNING,
"Failed to fetch. Realtime data is too large: need %zu, have %zu.\n", resultslen, len);
236 for (var = head;
var; var = var->next)
259 ast_log(
LOG_WARNING,
"Syntax: %s(family,fieldmatch,matchvalue,updatecol) - missing argument!\n", cmd);
266 ast_log(
LOG_WARNING,
"Syntax: %s(family,fieldmatch,matchvalue,updatecol) - missing argument!\n", cmd);
277 ast_log(
LOG_WARNING,
"Failed to update. Check the debug log for possible data repository related entries.\n");
294 enum { rtfield, rthash } which;
302 if (!strcmp(cmd,
"REALTIME_FIELD")) {
309 ast_log(
LOG_WARNING,
"Syntax: %s(family,fieldmatch,matchvalue%s) - missing argument!\n", cmd, which == rtfield ?
",fieldname" :
"");
315 if ((which == rtfield &&
args.argc != 4) || (which == rthash &&
args.argc != 3)) {
316 ast_log(
LOG_WARNING,
"Syntax: %s(family,fieldmatch,matchvalue%s) - missing argument!\n", cmd, which == rtfield ?
",fieldname" :
"");
334 for (var = head;
var; var = var->
next) {
335 if (which == rtfield) {
337 if (!strcasecmp(var->
name,
args.fieldname)) {
342 }
else if (which == rthash) {
351 if (which == rthash) {
378 ast_log(
LOG_WARNING,
"Syntax: REALTIME_STORE(family,field1,field2,...,field30) - missing argument!\n");
390 a.f[0], v.v[0], a.f[1], v.v[1], a.f[2], v.v[2], a.f[3], v.v[3], a.f[4], v.v[4],
391 a.f[5], v.v[5], a.f[6], v.v[6], a.f[7], v.v[7], a.f[8], v.v[8], a.f[9], v.v[9],
392 a.f[10], v.v[10], a.f[11], v.v[11], a.f[12], v.v[12], a.f[13], v.v[13], a.f[14], v.v[14],
393 a.f[15], v.v[15], a.f[16], v.v[16], a.f[17], v.v[17], a.f[18], v.v[18], a.f[19], v.v[19],
394 a.f[20], v.v[20], a.f[21], v.v[21], a.f[22], v.v[22], a.f[23], v.v[23], a.f[24], v.v[24],
395 a.f[25], v.v[25], a.f[26], v.v[26], a.f[27], v.v[27], a.f[28], v.v[28], a.f[29], v.v[29],
SENTINEL
399 ast_log(
LOG_WARNING,
"Failed to store. Check the debug log for possible data repository related entries.\n");
401 snprintf(storeid,
sizeof(storeid),
"%d", res);
426 ast_log(
LOG_WARNING,
"Syntax: REALTIME_DESTROY(family,fieldmatch[,matchvalue[,delim1[,delim2]]]) - missing argument!\n");
451 for (var = head;
var; n++, var = var->
next) {
452 resultslen += strlen(var->name) + strlen(var->value);
455 resultslen += n * (strlen(
args.delim1) + strlen(
args.delim2)) + 1;
457 if (resultslen > len) {
462 ast_log(
LOG_WARNING,
"Failed to fetch/destroy. Realtime data is too large: need %zu, have %zu.\n", resultslen, len);
469 for (var = head;
var; var = var->next) {
500 .
name =
"REALTIME_FIELD",
506 .
name =
"REALTIME_HASH",
511 .
name =
"REALTIME_STORE",
516 .
name =
"REALTIME_DESTROY",
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
int ast_store_realtime(const char *family,...) attribute_sentinel
Create realtime configuration.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
static int load_module(void)
static struct ast_custom_function realtime_store_function
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static struct ast_custom_function realtimehash_function
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
static int function_realtime_writedestroy(struct ast_channel *chan, const char *cmd, char *data, const char *value)
Wrapper to execute REALTIME_DESTROY from a write operation. Allows execution even if live_dangerously...
struct ast_variable * ast_load_realtime_all(const char *family,...) attribute_sentinel
Structure for variables, used for configurations and for channel variables.
Configuration File Parser.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
static struct ast_threadstorage buf2
#define ast_str_alloca(init_len)
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
static int unload_module(void)
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static struct ast_custom_function realtime_function
static struct ast_custom_function realtime_destroy_function
static int function_realtime_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Update realtime configuration.
#define ast_custom_function_register_escalating(acf, escalation)
Register a custom function which requires escalated privileges.
static struct ast_custom_function realtimefield_function
#define ast_debug(level,...)
Log a DEBUG message.
General Asterisk PBX channel definitions.
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Destroy realtime configuration.
static struct ast_threadstorage buf3
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Data structure associated with a custom dialplan function.
static int realtimefield_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
Core PBX routines and definitions.
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
static int function_realtime_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
#define ast_strdupa(s)
duplicate a string in memory from the stack
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
struct sla_ringing_trunk * first
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 buf1
static int function_realtime_readdestroy(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
char * ast_str_set_escapecommas(struct ast_str **buf, ssize_t maxlen, const char *src, size_t maxsrc)
Set a dynamic string to a non-NULL terminated substring, with escaping of commas. ...
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define AST_APP_ARG(name)
Define an application argument.
struct ast_variable * next
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define ast_custom_function_register(acf)
Register a custom function.
static int function_realtime_store(struct ast_channel *chan, const char *cmd, char *data, const char *value)
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.