271 #define locked_copy_string(chan, dest, source, len) \ 273 ast_channel_lock(chan); \ 274 ast_copy_string(dest, source, len); \ 275 ast_channel_unlock(chan); \ 277 #define locked_string_field_set(chan, field, source) \ 279 ast_channel_lock(chan); \ 280 ast_channel_##field##_set(chan, source); \ 281 ast_channel_unlock(chan); \ 285 "SPEECH",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
286 "DIGITAL",
"RESTRICTED_DIGITAL",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
287 "3K1AUDIO",
"DIGITAL_W_TONES",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
288 "VIDEO",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK", };
291 char *data,
char *
buf,
size_t len)
301 if (!strcasecmp(data,
"audionativeformat")) {
312 }
else if (!strcasecmp(data,
"videonativeformat")) {
323 }
else if (!strcasecmp(data,
"audioreadformat")) {
325 }
else if (!strcasecmp(data,
"audiowriteformat")) {
329 }
else if (!strcasecmp(data,
"dtmf_features")) {
333 }
else if (!strcasecmp(data,
"language"))
335 else if (!strcasecmp(data,
"musicclass"))
337 else if (!strcasecmp(data,
"name")) {
339 }
else if (!strcasecmp(data,
"parkinglot"))
341 else if (!strcasecmp(data,
"state"))
343 else if (!strcasecmp(data,
"onhold")) {
346 }
else if (!strcasecmp(data,
"channeltype"))
348 else if (!strcasecmp(data,
"accountcode"))
350 else if (!strcasecmp(data,
"checkhangup")) {
352 }
else if (!strcasecmp(data,
"peeraccount"))
354 else if (!strcasecmp(data,
"hangupsource"))
360 else if (!strcasecmp(data,
"exten"))
362 else if (!strcasecmp(data,
"context"))
364 else if (!strcasecmp(data,
"userfield"))
366 else if (!strcasecmp(data,
"channame"))
368 else if (!strcasecmp(data,
"linkedid")) {
378 }
else if (!strcasecmp(data,
"peer")) {
407 }
else if (!strcasecmp(data,
"uniqueid")) {
409 }
else if (!strcasecmp(data,
"transfercapability")) {
411 }
else if (!strcasecmp(data,
"callgroup")) {
415 }
else if (!strcasecmp(data,
"pickupgroup")) {
419 }
else if (!strcasecmp(data,
"namedcallgroup")) {
423 }
else if (!strcasecmp(data,
"namedpickupgroup")) {
427 }
else if (!strcasecmp(data,
"after_bridge_goto")) {
429 }
else if (!strcasecmp(data,
"amaflags")) {
433 }
else if (!strncasecmp(data,
"secure_bridge_", 14)) {
441 if (!strcasecmp(data,
"secure_bridge_signaling")) {
442 snprintf(buf, len,
"%s", encrypt->
signaling ?
"1" :
"");
443 }
else if (!strcasecmp(data,
"secure_bridge_media")) {
444 snprintf(buf, len,
"%s", encrypt->
media ?
"1" :
"");
448 }
else if (!strcasecmp(data,
"max_forwards")) {
452 }
else if (!strcasecmp(data,
"callid")) {
471 char *data,
const char *
value)
476 if (!strcasecmp(data,
"language"))
478 else if (!strcasecmp(data,
"parkinglot"))
480 else if (!strcasecmp(data,
"musicclass"))
482 else if (!strcasecmp(data,
"accountcode"))
484 else if (!strcasecmp(data,
"userfield"))
486 else if (!strcasecmp(data,
"after_bridge_goto")) {
492 }
else if (!strcasecmp(data,
"amaflags")) {
495 if (isdigit(*value)) {
496 if (sscanf(value,
"%30d", &amaflags) != 1) {
505 }
else if (!strcasecmp(data,
"peeraccount"))
507 else if (!strcasecmp(data,
"hangupsource"))
510 else if (!strcasecmp(data,
"tonezone")) {
513 ast_log(
LOG_ERROR,
"Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n", value);
524 }
else if (!strcasecmp(data,
"dtmf_features")) {
526 }
else if (!strcasecmp(data,
"callgroup")) {
530 }
else if (!strcasecmp(data,
"pickupgroup")) {
534 }
else if (!strcasecmp(data,
"namedcallgroup")) {
541 }
else if (!strcasecmp(data,
"namedpickupgroup")) {
548 }
else if (!strcasecmp(data,
"txgain")) {
549 sscanf(value,
"%4hhd", &gainset);
551 }
else if (!strcasecmp(data,
"rxgain")) {
552 sscanf(value,
"%4hhd", &gainset);
554 }
else if (!strcasecmp(data,
"transfercapability")) {
558 for (i = 0; i < 0x20; i++) {
565 }
else if (!strcasecmp(data,
"hangup_handler_pop")) {
569 }
else if (!strcasecmp(data,
"hangup_handler_push")) {
571 }
else if (!strcasecmp(data,
"hangup_handler_wipe")) {
576 }
else if (!strncasecmp(data,
"secure_bridge_", 14)) {
580 if (!chan || !value) {
590 if (!(store =
ast_calloc(1,
sizeof(*store)))) {
601 if (!strcasecmp(data,
"secure_bridge_signaling")) {
603 }
else if (!strcasecmp(data,
"secure_bridge_media")) {
607 }
else if (!strcasecmp(data,
"max_forwards")) {
609 if (sscanf(value,
"%d", &max_forwards) != 1) {
634 .function =
function,
667 if ((res = regcomp(&re, data, REG_EXTENDED | REG_ICASE | REG_NOSUB))) {
668 regerror(res, &re, buf, maxlen);
669 ast_log(
LOG_WARNING,
"Error compiling regular expression for %s(%s): %s\n",
function, data, buf);
693 ast_log(
LOG_WARNING,
"Number of channels exceeds the available buffer space. Output will be truncated!\n");
718 char *
template =
ast_alloca(4 + strlen(data));
726 sprintf(
template,
"${%s}", data);
753 .
name =
"MASTER_CHANNEL",
static char musicclass[MAX_MUSICCLASS]
static char accountcode[AST_MAX_ACCOUNT_CODE]
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
int ast_max_forwards_set(struct ast_channel *chan, int starting_count)
Set the starting max forwards for a particular channel.
int ast_max_forwards_get(struct ast_channel *chan)
Get the current max forwards for a particular channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
int ast_channel_hold_state(const struct ast_channel *chan)
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]
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
#define AST_OPTION_TXGAIN
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
#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)
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
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
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
ast_channel_state
ast_channel states
void ast_channel_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
int ast_bridge_features_ds_set_string(struct ast_channel *chan, const char *features)
Sets the features a channel will use upon being bridged.
int ast_pbx_hangup_handler_pop(struct ast_channel *chan)
Pop the top of the channel hangup handler stack.
#define ast_str_alloca(init_len)
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 struct ast_datastore_info secure_call_info
void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value)
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
int ast_channel_priority(const struct ast_channel *chan)
const char * ast_channel_linkedid(const struct ast_channel *chan)
static int func_mchan_write(struct ast_channel *chan, const char *function, char *data, const char *value)
struct ast_namedgroups * ast_channel_named_callgroups(const struct ast_channel *chan)
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.
char * ast_print_group(char *buf, int buflen, ast_group_t group)
Print call and pickup groups into buffer.
#define ast_strlen_zero(foo)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
enum ama_flags ast_channel_string2amaflag(const char *flag)
Convert a string to a detail record AMA flag.
General Asterisk PBX channel definitions.
const char * ast_channel_accountcode(const struct ast_channel *chan)
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.
A set of tones for a given locale.
Data structure associated with a custom dialplan function.
#define locked_copy_string(chan, dest, source, len)
#define ao2_ref(o, delta)
void ast_channel_amaflags_set(struct ast_channel *chan, enum ama_flags value)
static char language[MAX_LANGUAGE]
void ast_bridge_discard_after_goto(struct ast_channel *chan)
Discard channel after bridge goto location.
ast_group_t ast_get_group(const char *s)
const char * ast_channel_exten(const struct ast_channel *chan)
Core PBX routines and definitions.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
int ast_bridge_features_ds_get_string(struct ast_channel *chan, char *buffer, size_t buf_size)
writes a channel's DTMF features to a buffer string
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
const char * ast_channel_uniqueid(const struct ast_channel *chan)
const char * ast_channel_userfield(const struct ast_channel *chan)
struct ast_namedgroups * ast_get_namedgroups(const char *s)
Create an ast_namedgroups set with group names from comma separated string.
#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 ...
#define AST_OPTION_RXGAIN
void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
static struct ast_custom_function channels_function
static int load_module(void)
Channel datastore data for max forwards.
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
void ast_callid_strnprint(char *buffer, size_t buffer_size, ast_callid callid)
copy a string representation of the callid into a target string
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static struct ast_tone_zone * ast_tone_zone_ref(struct ast_tone_zone *tz)
Increase the reference count on an ast_tone_zone.
const char * ast_channel_appl(const struct ast_channel *chan)
#define locked_string_field_set(chan, field, source)
const char * ast_channel_peeraccount(const struct ast_channel *chan)
static int func_mchan_read(struct ast_channel *chan, const char *function, char *data, struct ast_str **buf, ssize_t len)
#define ast_channel_unlock(chan)
#define AST_OPTION_CHANNEL_WRITE
Handle channel write data If a channel needs to process the data from a func_channel write operation ...
#define ast_calloc(num, len)
A wrapper for calloc()
Structure to handle passing func_channel_write info to channels via setoption.
void ast_pbx_hangup_handler_push(struct ast_channel *chan, const char *handler)
Push the given hangup handler onto the channel hangup handler stack.
const char * ast_channel_hangupsource(const struct ast_channel *chan)
static const char *const transfercapability_table[0x20]
Basic bridge subclass API.
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
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...
const char * ast_channel_data(const struct ast_channel *chan)
After Bridge Execution API.
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.
struct ast_namedgroups * ast_channel_named_pickupgroups(const struct ast_channel *chan)
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
const char * ast_channel_name(const struct ast_channel *chan)
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.
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
static int unload_module(void)
const char * ast_channel_language(const struct ast_channel *chan)
static int func_channel_write(struct ast_channel *chan, const char *function, char *data, const char *value)
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
const char * ast_channel_context(const struct ast_channel *chan)
void ast_bridge_set_after_go_on(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *parseable_goto)
Set channel to go on in the dialplan after the bridge.
#define ast_datastore_alloc(info, uid)
void ast_bridge_read_after_goto(struct ast_channel *chan, char *buffer, size_t buf_size)
Read after bridge goto if it exists.
struct ast_namedgroups * ast_unref_namedgroups(struct ast_namedgroups *groups)
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
#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_format * ast_channel_writeformat(struct ast_channel *chan)
char * ast_print_namedgroups(struct ast_str **buf, struct ast_namedgroups *groups)
Print named call groups and named pickup groups.
enum ama_flags ast_channel_amaflags(const struct ast_channel *chan)
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
ast_callid ast_channel_callid(const struct ast_channel *chan)
const char * ast_channel_parkinglot(const struct ast_channel *chan)
#define ast_custom_function_register(acf)
Register a custom function.
const char * ast_channel_musicclass(const struct ast_channel *chan)
static struct ast_custom_function mchan_function