197 ast_log(
LOG_WARNING,
"Syntax: REALTIME(family,fieldmatch[,matchvalue[,delim1[,delim2]]]) - missing argument!\n");
221 for (var = head;
var; n++, var = var->
next)
222 resultslen += strlen(var->name) + strlen(var->value);
224 resultslen += n * (strlen(
args.delim1) + strlen(
args.delim2)) + 1;
226 if (resultslen > len) {
227 ast_log(
LOG_WARNING,
"Failed to fetch. Realtime data is too large: need %zu, have %zu.\n", resultslen, len);
237 for (var = head;
var; var = var->next)
260 ast_log(
LOG_WARNING,
"Syntax: %s(family,fieldmatch,matchvalue,updatecol) - missing argument!\n", cmd);
267 ast_log(
LOG_WARNING,
"Syntax: %s(family,fieldmatch,matchvalue,updatecol) - missing argument!\n", cmd);
278 ast_log(
LOG_WARNING,
"Failed to update. Check the debug log for possible data repository related entries.\n");
295 enum { rtfield, rthash } which;
303 if (!strcmp(cmd,
"REALTIME_FIELD")) {
310 ast_log(
LOG_WARNING,
"Syntax: %s(family,fieldmatch,matchvalue%s) - missing argument!\n", cmd, which == rtfield ?
",fieldname" :
"");
316 if ((which == rtfield &&
args.argc != 4) || (which == rthash &&
args.argc != 3)) {
317 ast_log(
LOG_WARNING,
"Syntax: %s(family,fieldmatch,matchvalue%s) - missing argument!\n", cmd, which == rtfield ?
",fieldname" :
"");
335 for (var = head;
var; var = var->
next) {
336 if (which == rtfield) {
338 if (!strcasecmp(var->
name,
args.fieldname)) {
343 }
else if (which == rthash) {
352 if (which == rthash) {
379 ast_log(
LOG_WARNING,
"Syntax: REALTIME_STORE(family,field1,field2,...,field30) - missing argument!\n");
391 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],
392 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],
393 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],
394 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],
395 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],
396 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 400 ast_log(
LOG_WARNING,
"Failed to store. Check the debug log for possible data repository related entries.\n");
402 snprintf(storeid,
sizeof(storeid),
"%d", res);
427 ast_log(
LOG_WARNING,
"Syntax: REALTIME_DESTROY(family,fieldmatch[,matchvalue[,delim1[,delim2]]]) - missing argument!\n");
452 for (var = head;
var; n++, var = var->
next) {
453 resultslen += strlen(var->name) + strlen(var->value);
456 resultslen += n * (strlen(
args.delim1) + strlen(
args.delim2)) + 1;
458 if (resultslen > len) {
463 ast_log(
LOG_WARNING,
"Failed to fetch/destroy. Realtime data is too large: need %zu, have %zu.\n", resultslen, len);
473 for (var = head;
var; var = var->next) {
504 .
name =
"REALTIME_FIELD",
510 .
name =
"REALTIME_HASH",
515 .
name =
"REALTIME_STORE",
520 .
name =
"REALTIME_DESTROY",
struct ast_variable * next
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
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...
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
static int load_module(void)
static struct ast_custom_function realtime_store_function
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
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
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...
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.
static struct ast_threadstorage buf2
#define ast_str_alloca(init_len)
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
static int unload_module(void)
int ast_update_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Update realtime configuration.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static struct ast_custom_function realtime_function
#define ast_strlen_zero(foo)
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)
Configuration File Parser.
#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.
int ast_store_realtime(const char *family,...) attribute_sentinel
Create realtime configuration.
General Asterisk PBX channel definitions.
static struct ast_threadstorage buf3
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)
#define ast_strdupa(s)
duplicate a string in memory from the stack
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)
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
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.
int ast_destroy_realtime(const char *family, const char *keyfield, const char *lookup,...) attribute_sentinel
Destroy realtime configuration.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct ast_variable * ast_load_realtime_all(const char *family,...) attribute_sentinel
#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 AST_APP_ARG(name)
Define an application argument.