49 #include <netinet/in.h> 266 if (!(df_copy =
ast_calloc(1,
sizeof(*df)))) {
270 memcpy(df_copy, df,
sizeof(*df));
276 .
type =
"dial-features",
310 dialfeatures =
ast_calloc(1,
sizeof(*dialfeatures));
319 datastore->
data = dialfeatures;
352 if (!applicationmap) {
366 ast_log(
LOG_NOTICE,
"CHAN: name: %s; appl: %s; data: %s; contxt: %s; exten: %s; pri: %d;\n",
369 ast_log(
LOG_NOTICE,
"CHAN: acctcode: %s; dialcontext: %s; amaflags: %x; maccontxt: %s; macexten: %s; macpri: %d;\n",
391 for (feature = features; *feature; feature++) {
394 if (isupper(*feature)) {
400 switch (tolower(*feature)) {
489 const char *monitor_args =
NULL;
513 pbx_exec(monitor_chan, monitor_app, monitor_args);
596 int abandon_call = 0;
599 ast_log(
LOG_ERROR,
"Could not construct caller duration limits. Bridge canceled.\n");
605 ast_log(
LOG_ERROR,
"Could not construct callee duration limits. Bridge canceled.\n");
625 ast_log(
LOG_ERROR,
"Could not set duration limits on one or more sides of the call. Bridge canceled.\n");
644 if (res || !peer_features) {
732 }
if (!strcasecmp(playtone_val,
"channel1")) {
734 }
else if (!strcasecmp(playtone_val,
"channel2") ||
ast_true(playtone_val)) {
736 }
else if (!strcasecmp(playtone_val,
"both")) {
764 const char *chana_exten;
765 const char *chana_context;
767 const char *chanb_exten;
768 const char *chanb_context;
781 ast_debug(1,
"Performing Bridge action on %s and %s\n", channela, channelb);
786 snprintf(buf,
sizeof(buf),
"Channel1 does not exist: %s", channela);
802 snprintf(buf,
sizeof(buf),
"Channel2 does not exist: %s", channelb);
824 snprintf(buf,
sizeof(buf),
"Unable to add Channel1 to bridge: %s",
ast_channel_name(chana));
832 snprintf(buf,
sizeof(buf),
"Unable to add Channel2 to bridge: %s",
ast_channel_name(chanb));
887 char *
parse,
struct timeval *calldurationlimit)
890 char *limit_str, *warning_str, *warnfreq_str;
892 int play_to_caller = 0, play_to_callee = 0;
895 limit_str =
strsep(&stringp,
":");
896 warning_str =
strsep(&stringp,
":");
897 warnfreq_str =
strsep(&stringp,
":");
939 play_to_caller = var ?
ast_true(var) : 1;
942 play_to_callee = var ?
ast_true(var) : 0;
944 if (!play_to_caller && !play_to_callee)
965 calldurationlimit->tv_sec = 0;
966 calldurationlimit->tv_usec = 0;
970 calldurationlimit->tv_sec = config->
timelimit / 1000;
971 calldurationlimit->tv_usec = (config->
timelimit % 1000) * 1000;
972 ast_verb(3,
"Setting call duration limit to %.3lf seconds.\n",
973 calldurationlimit->tv_sec + calldurationlimit->tv_usec / 1000000.0);
980 ast_verb(4,
"Limit Data for this call:\n");
983 ast_verb(4,
"play_to_caller = %s\n", play_to_caller ?
"yes" :
"no");
984 ast_verb(4,
"play_to_callee = %s\n", play_to_callee ?
"yes" :
"no");
1010 char *tmp_data =
NULL;
1014 struct timeval calldurationlimit = { 0, };
1018 int bridge_add_failed;
1039 strlen(
args.dest_chan));
1041 if (!current_dest_chan) {
1042 ast_verb(4,
"Bridge failed because channel '%s' does not exist\n",
1043 args.dest_chan ?:
"");
1049 if (chan == current_dest_chan) {
1058 &&
ast_bridge_timelimit(chan, &bconfig, opt_args[OPT_ARG_DURATION_LIMIT], &calldurationlimit)) {
1103 if (!peer_features) {
1108 if (
pre_bridge_setup(chan, current_dest_chan, &bconfig, &chan_features, peer_features)) {
1128 if (bridge_add_failed) {
1185 .requires =
"extconfig",
static void bridge_config_set_limits_warning_values(struct ast_bridge_config *config, struct ast_bridge_features_limits *limits)
struct ast_flags peer_features
#define ast_channel_lock(chan)
static void * dial_features_duplicate(void *data)
Main Channel structure associated with a channel.
static const struct ast_datastore_info dial_features_info
void ast_bridge_features_cleanup(struct ast_bridge_features *features)
Clean up the contents of a bridge features structure.
Feature configuration relating to transfers.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
static void bridge_check_monitor(struct ast_channel *chan, struct ast_channel *peer)
struct ast_channel * peer
int load_features_config(void)
struct ast_cdr * ast_channel_cdr(const struct ast_channel *chan)
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
struct ast_channel * chan
struct ast_flags features_callee
int ast_bridge_features_set_limits(struct ast_bridge_features *features, struct ast_bridge_features_limits *limits, enum ast_bridge_hook_remove_flags remove_flags)
Limit the amount of time a channel may stay in the bridge and optionally play warning messages as tim...
int ast_max_forwards_reset(struct ast_channel *chan)
Reset the max forwards on a channel to its starting value.
struct ao2_container * ast_get_chan_applicationmap(struct ast_channel *chan)
Get the applicationmap for a given channel.
static int bridge_exec(struct ast_channel *chan, const char *data)
Bridge channels.
struct ast_stream_topology * answer_topology
Structure that contains features information.
#define ast_channel_unref(c)
Decrease channel reference count.
#define ast_test_flag(p, flag)
Support for translation of data formats. translate.c.
static int playtone(struct ast_channel *chan, int tone, int len)
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
static void add_features_datastores(struct ast_channel *caller, struct ast_channel *callee, struct ast_bridge_config *config)
#define ast_set_flag(p, flag)
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
int ast_bridge_features_init(struct ast_bridge_features *features)
Initialize bridge features structure.
int ast_raw_answer_with_stream_topology(struct ast_channel *chan, struct ast_stream_topology *topology)
Answer a channel passing in a stream topology.
globally accessible channel datastores
struct ast_features_xfer_config * ast_get_chan_features_xfer_config(struct ast_channel *chan)
Get the transfer configuration options for a channel.
Structure for a data store type.
ast_channel_state
ast_channel states
int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
Destroy a bridge.
struct ast_flags my_features
static void set_config_flags(struct ast_channel *chan, struct ast_bridge_config *config)
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
#define ast_copy_flags(dest, src, flagz)
#define ast_strdup(str)
A wrapper for strdup()
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.
static int load_module(void)
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
#define ast_manager_register_xml_core(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
static enum play_tone_action parse_playtone(const char *playtone_val)
int ast_unregister_application(const char *app)
Unregister an application.
int ast_bridge_call_with_flags(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, unsigned int flags)
Bridge a call, and add additional flags to the bridge.
void ast_free_ptr(void *ptr)
free() wrapper
int ast_channel_priority(const struct ast_channel *chan)
void ast_bridge_features_limits_destroy(struct ast_bridge_features_limits *limits)
Destructor function for ast_bridge_features_limits.
#define ast_verb(level,...)
void ast_bridge_features_destroy(struct ast_bridge_features *features)
Destroy an allocated bridge features struct.
const char * ast_channel_linkedid(const struct ast_channel *chan)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
static const struct ast_app_option bridge_exec_options[128]
static int pre_bridge_setup(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, struct ast_bridge_features *chan_features, struct ast_bridge_features *peer_features)
struct ast_channel * ast_channel_get_by_name_prefix(const char *name, size_t name_len)
Find a channel by a name prefix.
const char * astman_get_header(const struct message *m, char *var)
Get header from mananger transaction.
#define ast_strlen_zero(foo)
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config)
bridge the call and set CDR
Configuration File Parser.
int reload_features_config(void)
#define ast_debug(level,...)
Log a DEBUG message.
int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, enum ast_bridge_impart_flags flags) attribute_warn_unused_result
Impart a channel to a bridge (non-blocking)
General Asterisk PBX channel definitions.
const char * ast_channel_accountcode(const struct ast_channel *chan)
void ast_bridge_set_after_goto(struct ast_channel *chan, const char *context, const char *exten, int priority)
Set channel to goto specific location after the bridge.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
static int unload_module(void)
int ast_channel_macropriority(const struct ast_channel *chan)
int ast_channel_visible_indication(const struct ast_channel *chan)
void ast_bridge_basic_set_flags(struct ast_bridge *bridge, unsigned int flags)
Set feature flags on a basic bridge.
void * end_bridge_callback_data
#define ast_channel_cleanup(c)
Cleanup a channel reference.
structure to hold extensions
In case you didn't read that giant block of text above the mansession_session struct, the struct mansession is named this solely to keep the API the same in Asterisk. This structure really represents data that is different from Manager action to Manager action. The mansession_session pointer contained within points to session-specific data.
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define AST_BRIDGE_DTMF_CHANNEL_1
Report DTMF on channel 1.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
const char * ast_channel_exten(const struct ast_channel *chan)
Core PBX routines and definitions.
struct ast_flags features_caller
const char * ast_channel_uniqueid(const struct ast_channel *chan)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
Structure that contains information about a bridge.
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".
int ast_bridge_add_channel(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_bridge_features *features, int play_tone, const char *xfersound)
Add an arbitrary channel to a bridge.
int ast_bridge_features_limits_construct(struct ast_bridge_features_limits *limits)
Constructor function for ast_bridge_features_limits.
Structure that contains configuration information for the limits feature.
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
struct ast_channel * ast_channel_masq(const struct ast_channel *chan)
#define AST_FEATURE_DTMF_MASK
const char * ast_channel_appl(const struct ast_channel *chan)
const char * ast_channel_dialcontext(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
static void parse(struct mgcp_request *req)
#define ast_calloc(num, len)
A wrapper for calloc()
static int add_features_datastore(struct ast_channel *chan, const struct ast_flags *my_features, const struct ast_flags *peer_features)
Module could not be loaded properly.
Prototypes for public functions only of internal interest,.
void unload_features_config(void)
#define DATASTORE_INHERIT_FOREVER
Basic bridge subclass API.
void ast_autoservice_chan_hangup_peer(struct ast_channel *chan, struct ast_channel *peer)
Put chan into autoservice while hanging up peer.
static int action_bridge(struct mansession *s, const struct message *m)
Bridge channels together.
Structure used to handle boolean flags.
#define ast_clear_flag(p, flag)
int ast_bridge_join(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, struct ast_bridge_tech_optimizations *tech_args, enum ast_bridge_join_flags flags)
Join a channel to a bridge (blocking)
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
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)
struct ast_bridge_features * ast_bridge_features_new(void)
Allocate a new bridge features struct.
void(* end_bridge_callback)(void *)
int ast_bridge_timelimit(struct ast_channel *chan, struct ast_bridge_config *config, char *parse, struct timeval *calldurationlimit)
parse L option and read associated channel variables to set warning, warning frequency, and timelimit
int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
struct ast_bridge * ast_bridge_basic_new(void)
Create a new basic class bridge.
int ast_bridge_features_ds_append(struct ast_channel *chan, struct ast_flags *flags)
Append basic bridge DTMF feature flags on the channel.
char * strsep(char **str, const char *delims)
After Bridge Execution API.
static void bridge_config_set_limits(struct ast_bridge_config *config, struct ast_bridge_features_limits *caller_limits, struct ast_bridge_features_limits *callee_limits)
Standard Command Line Interface.
#define SCOPE_TRACE(level,...)
Print a trace message with details when a scope is entered or existed.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
ast_app: A registered application
const char * ast_channel_name(const struct ast_channel *chan)
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"...
Internal Asterisk hangup causes.
int ast_register_application2(const char *app, int(*execute)(struct ast_channel *, const char *), const char *synopsis, const char *description, void *mod)
Register an application.
static void set_bridge_features_on_config(struct ast_bridge_config *config, const char *features)
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)
const char * warning_sound
static char context[AST_MAX_CONTEXT]
Call Parking and Pickup API Includes code and algorithms from the Zapata library. ...
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
void ast_channel_log(char *title, struct ast_channel *chan)
const char * ast_channel_macrocontext(const struct ast_channel *chan)
struct ast_app * pbx_findapp(const char *app)
Look up an application.
Say numbers and dates (maybe words one day too)
const ast_string_field xfersound
#define ASTERISK_GPL_KEY
The text the key() function should return.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
Asterisk module definitions.
unsigned int return_to_pbx
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.
#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_channel * ast_channel_masqr(const struct ast_channel *chan)
int ast_bridge_setup_after_goto(struct ast_channel *chan)
Setup any after bridge goto location to begin execution.
const char * ast_channel_macroexten(const struct ast_channel *chan)
static void bridge_failed_peer_goto(struct ast_channel *chan, struct ast_channel *peer)
#define AST_BRIDGE_DTMF_CHANNEL_0
Report DTMF on channel 0.
#define AST_APP_ARG(name)
Define an application argument.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.