317 #define locked_copy_string(chan, dest, source, len) \
319 ast_channel_lock(chan); \
320 ast_copy_string(dest, source, len); \
321 ast_channel_unlock(chan); \
323 #define locked_string_field_set(chan, field, source) \
325 ast_channel_lock(chan); \
326 ast_string_field_set(chan, field, source); \
327 ast_channel_unlock(chan); \
331 "SPEECH",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
332 "DIGITAL",
"RESTRICTED_DIGITAL",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
333 "3K1AUDIO",
"DIGITAL_W_TONES",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
334 "VIDEO",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK", };
337 char *data,
char *buf,
size_t len)
346 if (!strcasecmp(data,
"audionativeformat"))
350 else if (!strcasecmp(data,
"videonativeformat"))
354 else if (!strcasecmp(data,
"audioreadformat"))
356 else if (!strcasecmp(data,
"audiowriteformat"))
359 else if (!strcasecmp(data,
"trace")) {
361 ast_copy_string(buf, ast_channel_trace_is_enabled(chan) ?
"1" :
"0", len);
365 else if (!strcasecmp(data,
"tonezone") && chan->
zone)
367 else if (!strcasecmp(data,
"language"))
369 else if (!strcasecmp(data,
"musicclass"))
371 else if (!strcasecmp(data,
"name")) {
373 }
else if (!strcasecmp(data,
"parkinglot"))
375 else if (!strcasecmp(data,
"state"))
377 else if (!strcasecmp(data,
"channeltype"))
379 else if (!strcasecmp(data,
"accountcode"))
381 else if (!strcasecmp(data,
"checkhangup")) {
385 }
else if (!strcasecmp(data,
"peeraccount"))
387 else if (!strcasecmp(data,
"hangupsource"))
389 else if (!strcasecmp(data,
"appname") && chan->
appl)
391 else if (!strcasecmp(data,
"appdata") && chan->
data)
393 else if (!strcasecmp(data,
"exten") && chan->
data)
395 else if (!strcasecmp(data,
"context") && chan->
data)
397 else if (!strcasecmp(data,
"userfield") && chan->
data)
399 else if (!strcasecmp(data,
"channame") && chan->
data)
401 else if (!strcasecmp(data,
"linkedid")) {
411 }
else if (!strcasecmp(data,
"peer")) {
415 if (p || chan->
tech || chan->
cdr)
427 }
else if (!strcasecmp(data,
"uniqueid")) {
429 }
else if (!strcasecmp(data,
"transfercapability"))
431 else if (!strcasecmp(data,
"callgroup")) {
434 }
else if (!strcasecmp(data,
"amaflags")) {
436 snprintf(amabuf,
sizeof(amabuf),
"%d", chan->
amaflags);
438 }
else if (!strncasecmp(data,
"secure_bridge_", 14)) {
443 if (!strcasecmp(data,
"secure_bridge_signaling")) {
444 snprintf(buf, len,
"%s", encrypt->
signaling ?
"1" :
"");
445 }
else if (!strcasecmp(data,
"secure_bridge_media")) {
446 snprintf(buf, len,
"%s", encrypt->
media ?
"1" :
"");
459 char *data,
const char *
value)
464 if (!strcasecmp(data,
"language"))
466 else if (!strcasecmp(data,
"parkinglot"))
468 else if (!strcasecmp(data,
"musicclass"))
470 else if (!strcasecmp(data,
"accountcode"))
472 else if (!strcasecmp(data,
"userfield"))
474 else if (!strcasecmp(data,
"amaflags")) {
476 if(isdigit(*value)) {
477 sscanf(value,
"%30d", &chan->
amaflags);
478 }
else if (!strcasecmp(value,
"OMIT")){
480 }
else if (!strcasecmp(value,
"BILLING")){
482 }
else if (!strcasecmp(value,
"DOCUMENTATION")){
486 }
else if (!strcasecmp(data,
"peeraccount"))
488 else if (!strcasecmp(data,
"hangupsource"))
492 else if (!strcasecmp(data,
"trace")) {
495 ret = ast_channel_trace_enable(chan);
497 ret = ast_channel_trace_disable(chan);
505 else if (!strcasecmp(data,
"tonezone")) {
508 ast_log(
LOG_ERROR,
"Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n", value);
519 }
else if (!strcasecmp(data,
"callgroup"))
521 else if (!strcasecmp(data,
"txgain")) {
522 sscanf(value,
"%4hhd", &gainset);
524 }
else if (!strcasecmp(data,
"rxgain")) {
525 sscanf(value,
"%4hhd", &gainset);
527 }
else if (!strcasecmp(data,
"transfercapability")) {
529 for (i = 0; i < 0x20; i++) {
530 if (!strcasecmp(transfercapability_table[i], value) && strcmp(value,
"UNK")) {
535 }
else if (!strncasecmp(data,
"secure_bridge_", 14)) {
539 if (!chan || !value) {
549 if (!(store =
ast_calloc(1,
sizeof(*store)))) {
561 if (!strcasecmp(data,
"secure_bridge_signaling")) {
563 }
else if (!strcasecmp(data,
"secure_bridge_media")) {
583 .function =
function,
616 if ((res = regcomp(&re, data, REG_EXTENDED | REG_ICASE | REG_NOSUB))) {
617 regerror(res, &re, buf, maxlen);
618 ast_log(
LOG_WARNING,
"Error compiling regular expression for %s(%s): %s\n",
function, data, buf);
633 size_t namelen = strlen(c->
name);
639 strcat(buf, c->
name);
642 ast_log(
LOG_WARNING,
"Number of channels exceeds the available buffer space. Output will be truncated!\n");
664 char *data,
struct ast_str **buf, ssize_t
len)
667 char *
template =
ast_alloca(4 + strlen(data));
675 sprintf(
template,
"${%s}", data);
702 .
name =
"MASTER_CHANNEL",
int(* func_channel_read)(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
Provide additional read items for CHANNEL() dialplan function.
const ast_string_field peeraccount
static char musicclass[MAX_MUSICCLASS]
static char accountcode[AST_MAX_ACCOUNT_CODE]
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Asterisk main include file. File version handling, generic pbx functions.
static char parkinglot[AST_MAX_CONTEXT]
struct ast_tone_zone * zone
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
const ast_string_field uniqueid
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_channel_unref(c)
Decrease channel reference count.
static int func_channels_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t maxlen)
char context[AST_MAX_CONTEXT]
globally accessible channel datastores
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
static struct ast_custom_function channel_function
unsigned short transfercapability
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
const char * ast_state2str(enum ast_channel_state)
Gives the string form of a given channel state.
const ast_string_field linkedid
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
static int func_mchan_write(struct ast_channel *chan, const char *function, char *data, const char *value)
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
String fields in structures.
char * ast_print_group(char *buf, int buflen, ast_group_t group)
print call- and pickup groups into buffer
General Asterisk PBX channel definitions.
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
Set the source of the hangup in this channel and it's bridge.
#define AST_OPTION_CHANNEL_WRITE
Handle channel write data If a channel needs to process the data from a func_channel write operation ...
A set of tones for a given locale.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Data structure associated with a custom dialplan function.
#define locked_copy_string(chan, dest, source, len)
const ast_string_field parkinglot
static char language[MAX_LANGUAGE]
ast_group_t ast_get_group(const char *s)
Core PBX routines and definitions.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
struct ast_datastore_info secure_call_info
char * ast_getformatname(format_t format)
Get the name of a format.
#define AST_CHAN_WRITE_INFO_T_VERSION
ast_chan_write_info_t version. Must be incremented if structure is changed
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static struct ast_custom_function channels_function
static int load_module(void)
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
enum ast_channel_state _state
struct ast_channel * ast_bridged_channel(struct ast_channel *chan)
Find bridged channel.
const ast_string_field name
const ast_string_field hangupsource
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_tone_zone * ast_tone_zone_ref(struct ast_tone_zone *tz)
Increase the reference count on an ast_tone_zone.
struct ast_datastore * ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
#define locked_string_field_set(chan, field, source)
static int func_mchan_read(struct ast_channel *chan, const char *function, char *data, struct ast_str **buf, ssize_t len)
#define AST_FORMAT_VIDEO_MASK
#define ast_channel_unlock(chan)
Structure to handle passing func_channel_write info to channels via setoption.
#define AST_FORMAT_AUDIO_MASK
const ast_string_field userfield
static const char *const transfercapability_table[0x20]
char country[16]
Country code that this set of tones is for.
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...
static int func_channel_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"...
#define AST_OPTION_RXGAIN
static int func_channel_write_real(struct ast_channel *chan, const char *function, char *data, const char *value)
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
const ast_string_field musicclass
const ast_string_field accountcode
static int unload_module(void)
static int func_channel_write(struct ast_channel *chan, const char *function, char *data, const char *value)
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
int(* func_channel_write)(struct ast_channel *chan, const char *function, char *data, const char *value)
Provide additional write items for CHANNEL() dialplan function.
#define ASTERISK_GPL_KEY
The text the key() function should return.
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
Asterisk module definitions.
struct ast_channel_tech * tech
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define ast_custom_function_register(acf)
Register a custom function.
const ast_string_field language
char exten[AST_MAX_EXTENSION]
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
#define AST_OPTION_TXGAIN
static struct ast_custom_function mchan_function