353#define locked_copy_string(chan, dest, source, len) \
355 ast_channel_lock(chan); \
356 ast_copy_string(dest, source, len); \
357 ast_channel_unlock(chan); \
359#define locked_string_field_set(chan, field, source) \
361 ast_channel_lock(chan); \
362 ast_channel_##field##_set(chan, source); \
363 ast_channel_unlock(chan); \
367 "SPEECH",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
368 "DIGITAL",
"RESTRICTED_DIGITAL",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
369 "3K1AUDIO",
"DIGITAL_W_TONES",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
370 "VIDEO",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK",
"UNK", };
373 char *data,
char *
buf,
size_t len)
383 if (!strcasecmp(data,
"audionativeformat")) {
394 }
else if (!strcasecmp(data,
"videonativeformat")) {
405 }
else if (!strcasecmp(data,
"audioreadformat")) {
407 }
else if (!strcasecmp(data,
"audiowriteformat")) {
411 }
else if (!strcasecmp(data,
"dtmf_features")) {
415 }
else if (!strcasecmp(data,
"language"))
417 else if (!strcasecmp(data,
"musicclass"))
419 else if (!strcasecmp(data,
"name")) {
421 }
else if (!strcasecmp(data,
"parkinglot"))
423 else if (!strcasecmp(data,
"state"))
425 else if (!strcasecmp(data,
"onhold")) {
428 }
else if (!strcasecmp(data,
"channeltype"))
430 else if (!strcasecmp(data,
"accountcode"))
432 else if (!strcasecmp(data,
"checkhangup")) {
434 }
else if (!strcasecmp(data,
"peeraccount"))
436 else if (!strcasecmp(data,
"hangupsource"))
442 else if (!strcasecmp(data,
"exten"))
444 else if (!strcasecmp(data,
"context"))
446 else if (!strcasecmp(data,
"lastexten"))
448 else if (!strcasecmp(data,
"lastcontext"))
450 else if (!strcasecmp(data,
"userfield"))
452 else if (!strcasecmp(data,
"channame"))
454 else if (!strcasecmp(data,
"linkedid")) {
464 }
else if (!strcasecmp(data,
"peer")) {
493 }
else if (!strcasecmp(
data,
"uniqueid")) {
495 }
else if (!strcasecmp(
data,
"transfercapability")) {
497 }
else if (!strcasecmp(
data,
"callgroup")) {
501 }
else if (!strcasecmp(
data,
"pickupgroup")) {
505 }
else if (!strcasecmp(
data,
"namedcallgroup")) {
509 }
else if (!strcasecmp(data,
"namedpickupgroup")) {
513 }
else if (!strcasecmp(data,
"after_bridge_goto")) {
515 }
else if (!strcasecmp(data,
"amaflags")) {
519 }
else if (!strncasecmp(data,
"secure_bridge_", 14)) {
527 if (!strcasecmp(data,
"secure_bridge_signaling")) {
529 }
else if (!strcasecmp(data,
"secure_bridge_media")) {
530 snprintf(
buf,
len,
"%s", encrypt->
media ?
"1" :
"");
534 }
else if (!strcasecmp(data,
"max_forwards")) {
538 }
else if (!strcasecmp(data,
"callid")) {
548 }
else if (!strcasecmp(data,
"tdd")) {
550 int status_size = (int)
sizeof(
status);
555 }
else if (!strcasecmp(data,
"digitdetect")) {
557 int status_size = (int)
sizeof(
status);
562 }
else if (!strcasecmp(data,
"faxdetect")) {
564 int status_size = (int)
sizeof(
status);
569 }
else if (!strcasecmp(data,
"device_name")) {
571 }
else if (!strcasecmp(data,
"tenantid")) {
582 char *data,
const char *
value)
587 if (!strcasecmp(data,
"language"))
589 else if (!strcasecmp(data,
"parkinglot"))
591 else if (!strcasecmp(data,
"musicclass"))
593 else if (!strcasecmp(data,
"accountcode"))
595 else if (!strcasecmp(data,
"userfield"))
597 else if (!strcasecmp(data,
"after_bridge_goto")) {
603 }
else if (!strcasecmp(data,
"amaflags")) {
606 if (isdigit(*
value)) {
616 }
else if (!strcasecmp(data,
"peeraccount"))
618 else if (!strcasecmp(data,
"hangupsource"))
621 else if (!strcasecmp(data,
"tonezone")) {
624 ast_log(
LOG_ERROR,
"Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n",
value);
635 }
else if (!strcasecmp(data,
"dtmf_features")) {
637 }
else if (!strcasecmp(data,
"callgroup")) {
641 }
else if (!strcasecmp(data,
"pickupgroup")) {
645 }
else if (!strcasecmp(data,
"namedcallgroup")) {
652 }
else if (!strcasecmp(data,
"namedpickupgroup")) {
659 }
else if (!strcasecmp(data,
"tdd")) {
661 if (!strcasecmp(
value,
"mate")) {
667 }
else if (!strcasecmp(data,
"relaxdtmf")) {
670 }
else if (!strcasecmp(data,
"txgain")) {
671 sscanf(
value,
"%4hhd", &gainset);
673 }
else if (!strcasecmp(data,
"rxgain")) {
674 sscanf(
value,
"%4hhd", &gainset);
676 }
else if (!strcasecmp(data,
"digitdetect")) {
679 }
else if (!strcasecmp(data,
"faxdetect")) {
682 }
else if (!strcasecmp(data,
"transfercapability")) {
686 for (i = 0; i < 0x20; i++) {
693 }
else if (!strcasecmp(data,
"hangup_handler_pop")) {
697 }
else if (!strcasecmp(data,
"hangup_handler_push")) {
699 }
else if (!strcasecmp(data,
"hangup_handler_wipe")) {
704 }
else if (!strncasecmp(data,
"secure_bridge_", 14)) {
708 if (!chan || !
value) {
718 if (!(store =
ast_calloc(1,
sizeof(*store)))) {
729 if (!strcasecmp(data,
"secure_bridge_signaling")) {
731 }
else if (!strcasecmp(data,
"secure_bridge_media")) {
735 }
else if (!strcasecmp(data,
"max_forwards")) {
745 }
else if (!strcasecmp(data,
"tenantid")) {
764 .function = function,
797 if ((res = regcomp(&re, data, REG_EXTENDED | REG_ICASE | REG_NOSUB))) {
798 regerror(res, &re,
buf, maxlen);
823 ast_log(
LOG_WARNING,
"Number of channels exceeds the available buffer space. Output will be truncated!\n");
854 snprintf(
buf, maxlen,
"%d", (chan_found ? 1 : 0));
862 .
name =
"CHANNEL_EXISTS",
878 sprintf(
template,
"${%s}",
data);
905 .
name =
"MASTER_CHANNEL",
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_calloc(num, len)
A wrapper for calloc()
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
After Bridge Execution API.
void ast_bridge_discard_after_goto(struct ast_channel *chan)
Discard channel after bridge goto location.
void ast_bridge_read_after_goto(struct ast_channel *chan, char *buffer, size_t buf_size)
Read after bridge goto if it exists.
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.
Basic bridge subclass API.
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
int ast_bridge_features_ds_set_string(struct ast_channel *chan, const char *features)
Sets the features a channel will use upon being bridged.
static char language[MAX_LANGUAGE]
static char accountcode[AST_MAX_ACCOUNT_CODE]
General Asterisk PBX channel definitions.
const char * ast_channel_linkedid(const struct ast_channel *chan)
const char * ast_channel_name(const struct ast_channel *chan)
char * ast_print_namedgroups(struct ast_str **buf, struct ast_namedgroups *groups)
Print named call groups and named pickup groups.
void ast_channel_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
int ast_channel_get_device_name(struct ast_channel *chan, char *device_name, size_t name_buffer_length)
Get a device name given its channel structure.
struct ast_namedgroups * ast_channel_named_pickupgroups(const struct ast_channel *chan)
const char * ast_channel_data(const struct ast_channel *chan)
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
void ast_channel_tenantid_set(struct ast_channel *chan, const char *value)
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
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_tenantid(const struct ast_channel *chan)
const char * ast_channel_musicclass(const struct ast_channel *chan)
#define ast_channel_lock(chan)
const char * ast_channel_lastexten(const struct ast_channel *chan)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
struct ast_namedgroups * ast_channel_named_callgroups(const struct ast_channel *chan)
ast_group_t ast_channel_pickupgroup(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.
int ast_channel_queryoption(struct ast_channel *channel, int option, void *data, int *datalen, int block)
Checks the value of an option.
int ast_channel_priority(const struct ast_channel *chan)
ast_callid ast_channel_callid(const struct ast_channel *chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
const char * ast_channel_accountcode(const struct ast_channel *chan)
const char * ast_channel_context(const struct ast_channel *chan)
const char * ast_channel_userfield(const struct ast_channel *chan)
char * ast_print_group(char *buf, int buflen, ast_group_t group)
Print call and pickup groups into buffer.
const char * ast_channel_parkinglot(const struct ast_channel *chan)
const char * ast_channel_appl(const struct ast_channel *chan)
const char * ast_channel_peeraccount(const struct ast_channel *chan)
enum ama_flags ast_channel_amaflags(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.
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
const char * ast_channel_hangupsource(const struct ast_channel *chan)
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
struct ast_tone_zone * ast_channel_zone(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.
void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
const char * ast_channel_lastcontext(const struct ast_channel *chan)
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
int ast_channel_hold_state(const struct ast_channel *chan)
void ast_channel_amaflags_set(struct ast_channel *chan, enum ama_flags value)
const char * ast_channel_language(const struct ast_channel *chan)
const char * ast_state2str(enum ast_channel_state state)
Gives the string form of a given channel state.
enum ama_flags ast_channel_string2amaflag(const char *flag)
Convert a string to a detail record AMA flag.
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value)
#define AST_CHAN_WRITE_INFO_T_VERSION
ast_chan_write_info_t version. Must be incremented if structure is changed
struct ast_namedgroups * ast_unref_namedgroups(struct ast_namedgroups *groups)
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
ast_group_t ast_get_group(const char *s)
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
const char * ast_channel_exten(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
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.
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
ast_channel_state
ast_channel states
#define ast_datastore_alloc(info, 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)
static int func_channel_write_real(struct ast_channel *chan, const char *function, char *data, const char *value)
static struct ast_custom_function channels_function
static struct ast_custom_function channel_function
static int func_channels_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t maxlen)
#define locked_copy_string(chan, dest, source, len)
static struct ast_custom_function mchan_function
static int func_chan_exists_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t maxlen)
static int load_module(void)
static int func_channel_write(struct ast_channel *chan, const char *function, char *data, const char *value)
static int func_mchan_write(struct ast_channel *chan, const char *function, char *data, const char *value)
static int unload_module(void)
static struct ast_custom_function chan_exists_function
static const char *const transfercapability_table[0x20]
static int func_channel_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
globally accessible channel datastores
const struct ast_datastore_info secure_call_info
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_OPTION_RELAXDTMF
#define AST_OPTION_RXGAIN
#define AST_OPTION_DIGIT_DETECT
#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_OPTION_FAX_DETECT
#define AST_OPTION_TXGAIN
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 struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
static struct ast_tone_zone * ast_tone_zone_ref(struct ast_tone_zone *tz)
Increase the reference count on an ast_tone_zone.
int ast_max_forwards_get(struct ast_channel *chan)
Get the current max forwards for a particular channel.
int ast_max_forwards_set(struct ast_channel *chan, int starting_count)
Set the starting max forwards for a particular channel.
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Core PBX routines and definitions.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
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.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
void ast_pbx_hangup_handler_push(struct ast_channel *chan, const char *handler)
Push the given hangup handler onto the channel hangup handler stack.
int ast_pbx_hangup_handler_pop(struct ast_channel *chan)
Pop the top of the channel hangup handler stack.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_alloca(init_len)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Structure to handle passing func_channel_write info to channels via setoption.
Main Channel structure associated with a channel.
Data structure associated with a custom dialplan function.
Structure for a data store object.
Support for dynamic strings.
A set of tones for a given locale.
Channel datastore data for max forwards.