51 #define NORMAL_FLAGS (AST_BRIDGE_FLAG_DISSOLVE_HANGUP | AST_BRIDGE_FLAG_DISSOLVE_EMPTY \ 52 | AST_BRIDGE_FLAG_SMART) 54 #define TRANSFER_FLAGS AST_BRIDGE_FLAG_SMART 83 .
type =
"bridge-dtmf-features",
135 size_t buffer_expended = 0;
136 unsigned int cur_feature;
137 static const struct {
148 for (cur_feature = 0; cur_feature <
ARRAY_LEN(associations); cur_feature++) {
150 if (buffer_expended == buffer_size - 1) {
151 buffer[buffer_expended] =
'\0';
154 buffer[buffer_expended++] = associations[cur_feature].letter;
158 buffer[buffer_expended] =
'\0';
166 char missing_features[strlen(features) + 1];
167 size_t number_of_missing_features = 0;
169 for (feature = features; *feature; feature++) {
170 if (!isupper(*feature)) {
171 ast_log(
LOG_ERROR,
"Features string '%s' rejected because it contains non-uppercase feature.\n", features);
176 missing_features[number_of_missing_features++] = *feature;
180 missing_features[number_of_missing_features] =
'\0';
182 if (number_of_missing_features) {
183 ast_log(
LOG_WARNING,
"Features '%s' from features string '%s' can not be applied.\n", missing_features, features);
218 held_copy = *channel_flags;
231 ds_flags = datastore->
data;
253 datastore->
data = ds_flags;
276 return datastore->
data;
292 int bridge_count = 0;
301 if (2 <= bridge_count) {
381 ast_log(
LOG_ERROR,
"Channel %s: Requested DTMF feature %s not available.\n",
437 const void *payload,
size_t payload_size)
480 const char *activated_name;
485 size_t len_activated;
489 len_name = strlen(pvt->
app_name) + 1;
496 len_activated = strlen(activated_name) + 1;
497 len_data =
sizeof(*run_data) + len_name + len_args + len_moh + len_feature + len_activated;
502 run_data->
moh_offset = len_moh ? len_name + len_args : 0;
547 size_t len_name = strlen(app_name) + 1;
548 size_t len_args =
ast_strlen_zero(app_args) ? 0 : strlen(app_args) + 1;
549 size_t len_moh =
ast_strlen_zero(moh_class) ? 0 : strlen(moh_class) + 1;
550 size_t len_feature = strlen(feature_name) + 1;
551 size_t len_data =
sizeof(*hook_data) + len_name + len_args + len_moh + len_feature;
561 hook_data->
moh_offset = len_moh ? len_name + len_args : 0;
563 strcpy(hook_data->
app_name, app_name);
613 if (applicationmap) {
1327 struct timeval start;
1357 ast_debug(1,
"Destroy attended transfer properties %p\n", props);
1429 ast_log(
LOG_ERROR,
"Unable to initialize prop fields - channel %s, context %s\n",
1447 if (transferer_features) {
1467 addr = strchr(tech,
'/');
1469 ast_log(
LOG_ERROR,
"Transferer channel name does not follow typical channel naming format (tech/address)\n");
1475 serial = strrchr(addr,
'-');
1484 ast_debug(1,
"Allocated attended transfer properties %p for transfer from %s\n",
1510 ast_debug(1,
"Shutting down attended transfer %p\n", props);
1539 ast_log(
LOG_ERROR,
"Unable to push event to attended transfer queue. Expect transfer to fail\n");
1628 if (transferer_bridge == transferee_bridge) {
1630 transferer, transferee, transfer_target);
1631 }
else if (transferer_bridge == target_bridge) {
1633 transferer, transfer_target, transferee);
1652 transferee_channel, target_channel);
1654 if (!transfer_msg) {
1655 ast_log(
LOG_ERROR,
"Unable to publish successful attended transfer from %s\n",
1675 transferee_channel, target_channel);
1677 if (!transfer_msg) {
1678 ast_log(
LOG_ERROR,
"Unable to publish successful three-way transfer from %s\n",
1700 if (!transfer_msg) {
1725 if (bridge_channel) {
1784 if (bridge_channel) {
1805 if (bridge_channel) {
1822 if (bridge_channel) {
1880 if (bridge_channel) {
1902 int num_bridge_channels = 0;
1906 for (i = 0; i < num_channels; ++i) {
1910 if (!kick_bridge_channel) {
1918 if (!kick_bridge_channel) {
1922 kick_bridge_channels[num_bridge_channels++] = kick_bridge_channel;
1925 bridge_do_merge(dest, src, kick_bridge_channels, num_bridge_channels, 0);
2023 .state_name =
"Hesitant",
2029 .state_name =
"Rebridge",
2034 .state_name =
"Resume",
2039 .state_name =
"Threeway",
2044 .state_name =
"Consulting",
2049 .state_name =
"Double Checking",
2054 .state_name =
"Complete",
2059 .state_name =
"Blond",
2064 .state_name =
"Blond Non-Final",
2070 .state_name =
"Recalling",
2076 .state_name =
"Wait to Retransfer",
2082 .state_name =
"Retransfer",
2088 .state_name =
"Wait to Recall",
2094 .state_name =
"Fail",
2134 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2136 return props->
state;
2174 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2176 return props->
state;
2198 &transferee_channel, &target_channel);
2258 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2260 return props->
state;
2300 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2302 return props->
state;
2312 &transferee_channel, &target_channel);
2328 &transferee_channel, &target_channel);
2375 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2377 return props->
state;
2563 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2565 return props->
state;
2595 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2597 return props->
state;
2613 snprintf(destination,
sizeof(destination),
"%s@%s", props->
exten, props->
context);
2620 ast_log(
LOG_ERROR,
"Unable to request outbound channel for recall target\n");
2689 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2691 return props->
state;
2721 ast_log(
LOG_WARNING,
"Unexpected stimulus '%s' received in attended transfer state '%s'\n",
2723 return props->
state;
2745 ast_debug(1,
"Transferer on attended transfer %p pressed abort sequence\n", props);
2759 ast_debug(1,
"Transferer on attended transfer %p pressed complete sequence\n", props);
2773 ast_debug(1,
"Transferer on attended transfer %p pressed threeway sequence\n", props);
2787 ast_debug(1,
"Transferer on attended transfer %p pressed swap sequence\n", props);
2801 ast_debug(1,
"Transferer on attended transfer %p hung up\n", props);
2830 ast_debug(1,
"Detected an answer for recall attempt on attended transfer %p\n", props);
2857 const char *abort_dtmf;
2858 const char *complete_dtmf;
2859 const char *threeway_dtmf;
2860 const char *swap_dtmf;
2907 if (self->num_channels == 1) {
2915 if (!transferer_bridge_channel) {
2919 not_transferer =
AST_LIST_FIRST(&self->channels) != transferer_bridge_channel;
2920 ao2_ref(transferer_bridge_channel, -1);
2921 if (not_transferer) {
2951 if (self->num_channels == 0) {
2957 if (self->num_channels == 1) {
2971 if (target_bridge_channel) {
2975 ao2_ref(target_bridge_channel, -1);
3005 struct timeval relative_timeout = { 0, };
3006 struct timeval absolute_timeout;
3007 struct timespec timeout_arg;
3021 timeout_arg.tv_sec = absolute_timeout.tv_sec;
3022 timeout_arg.tv_nsec = absolute_timeout.tv_usec * 1000;
3063 ast_debug(1,
"About to enter state %s for attended transfer %p\n", state_properties[props->
state].
state_name, props);
3066 state_properties[props->
state].
enter(props)) {
3067 ast_log(
LOG_ERROR,
"State %s enter function returned an error for attended transfer %p\n",
3073 ast_debug(1,
"State %s is a terminal state. Ending attended transfer %p\n",
3084 props->
state = state_properties[props->
state].
exit(props, stimulus);
3086 ast_debug(1,
"Told to enter state %s exit on attended transfer %p\n", state_properties[props->
state].
state_name, props);
3105 .disable_inheritance = 1,
3109 target_interface.
data = props;
3134 if (attended_transfer) {
3168 char *invalid_sound;
3205 res =
ast_app_dtget(chan, context, exten, exten_len, exten_len - 1, digit_timeout);
3220 ast_verb(3,
"Channel %s: Dialed '%s@%s' does not exist.\n",
3223 if (attempts < max_attempts) {
3228 memset(exten, 0, exten_len);
3234 }
while (res > 0 && attempts < max_attempts);
3241 return res ? -1 : 0;
3307 ast_verb(3,
"Channel %s: Started DTMF attended transfer.\n",
3311 ast_log(
LOG_ERROR,
"Channel %s: Attended transfer attempted on unsupported bridge type '%s'.\n",
3324 ast_verb(3,
"Channel %s: Bridge '%s' does not permit merging at this time.\n",
3332 attended_transfer ? attended_transfer->
context :
NULL);
3334 ast_log(
LOG_ERROR,
"Channel %s: Unable to allocate control structure for performing attended transfer.\n",
3361 ast_log(
LOG_WARNING,
"Channel %s: Unable to acquire target extension for attended transfer.\n",
3371 snprintf(destination,
sizeof(destination),
"%s@%s", props->
exten, props->
context);
3373 ast_debug(1,
"Channel %s: Attended transfer target '%s'\n",
3379 ast_log(
LOG_ERROR,
"Channel %s: Unable to request outbound channel for attended transfer target.\n",
3391 ast_log(
LOG_ERROR,
"Channel %s: Unable to create bridge for attended transfer target.\n",
3403 ast_log(
LOG_ERROR,
"Channel %s: Unable to attach framehook to transfer target.\n",
3419 ast_log(
LOG_ERROR,
"Channel %s: Unable to place outbound call to transfer target.\n",
3436 ast_log(
LOG_ERROR,
"Channel %s: Unable to place transfer target into bridge.\n",
3447 ast_log(
LOG_ERROR,
"Channel %s: Unable to create monitoring thread for attended transfer.\n",
3476 const char *xfer_context;
3477 char *goto_on_blindxfr;
3479 ast_verb(3,
"Channel %s: Started DTMF blind transfer.\n",
3486 blind_transfer ? blind_transfer->
context :
NULL));
3488 "GOTO_ON_BLINDXFR"),
""));
3492 if (
grab_transfer(bridge_channel->
chan, xfer_exten,
sizeof(xfer_exten), xfer_context)) {
3497 ast_debug(1,
"Channel %s: Blind transfer target '%s@%s'\n",
3501 const char *chan_context;
3502 const char *chan_exten;
3505 ast_debug(1,
"Channel %s: After transfer, transferrer goes to %s\n",
3514 chan_context, chan_exten, chan_priority, goto_on_blindxfr);
3569 ast_log(
LOG_WARNING,
"Unable to set up bridge hooks for channel %s. Features may not work properly\n",
3589 ast_log(
LOG_WARNING,
"Asked to initialize unexpected basic bridge personality type.\n");
static int basic_hangup_hook(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
enum attended_transfer_state(* exit)(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
static int transfer_target_framehook_consume(void *data, enum ast_frame_type type)
Callback function which informs upstream if we are consuming a frame of a specific type...
enum sip_cc_notify_state state
struct attended_transfer_properties::@353 stimulus_queue
const ast_string_field app
static void clear_stimulus_queue(struct attended_transfer_properties *props)
Free backlog of stimuli in the queue.
#define ast_channel_lock(chan)
static char exten[AST_MAX_EXTENSION]
static void attended_transfer_properties_shutdown(struct attended_transfer_properties *props)
Initiate shutdown of attended transfer properties.
Main Channel structure associated with a channel.
static void bridge_basic_change_personality(struct ast_bridge *bridge, enum bridge_basic_personality_type type, void *user_data)
Change basic bridge personality.
static void bridge_basic_destroy(struct ast_bridge *self)
static void play_failsound(struct ast_channel *chan)
Helper method to play a fail sound on a channel in a bridge.
int ast_dial_destroy(struct ast_dial *dial)
Destroys a dialing structure.
Feature configuration relating to transfers.
static int double_checking_enter(struct attended_transfer_properties *props)
struct ast_bridge_methods personality_normal_v_table
struct ast_bridge * ast_bridge_channel_merge_inhibit(struct ast_bridge_channel *bridge_channel, int request)
Adjust the bridge_channel's bridge merge inhibit request count.
#define ast_bridge_lock_both(bridge1, bridge2)
Lock two bridges.
static int set_feature_flag_from_char(struct ast_flags *feature_flags, char feature)
Asterisk main include file. File version handling, generic pbx functions.
struct ast_flags feature_flags
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
int atxfercallbackretries
static void publish_transfer_success(struct attended_transfer_properties *props, struct ast_channel *transferee_channel, struct ast_channel *target_channel)
Send a stasis publication for a successful attended transfer.
const ast_string_field uniqueid
struct ast_bridge_features * features
static void transfer_target_framehook_destroy_cb(void *data)
void * ast_dial_get_user_data(struct ast_dial *dial)
Return the user data on a dial structure.
static int add_transferer_role(struct ast_channel *chan, struct ast_bridge_features_attended_transfer *attended_transfer)
struct ast_party_caller caller
Channel Caller ID information.
char complete[MAXIMUM_DTMF_FEATURE_STRING]
struct ast_bridge_methods personality_atxfer_v_table
struct ast_bridge * bridge_register(struct ast_bridge *bridge)
Register the new bridge with the system.
static int bridge_basic_push(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
Main dialing structure. Contains global options, channels being dialed, and more! ...
const ast_string_field xfersound
Message representing attended transfer.
static int setup_dynamic_feature(void *obj, void *arg, void *data, int flags)
static int setup_bridge_features_dynamic(struct ast_bridge_features *features, struct ast_channel *chan)
unsigned int bridge_flags
struct ao2_container * ast_get_chan_applicationmap(struct ast_channel *chan)
Get the applicationmap for a given channel.
#define ast_pthread_create_detached(a, b, c, d)
static int setup_bridge_features_builtin(struct ast_bridge_features *features, struct ast_channel *chan)
static int wait_to_retransfer_enter(struct attended_transfer_properties *props)
void bridge_do_merge(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, struct ast_bridge_channel **kick_me, unsigned int num_kick, unsigned int optimized)
void ast_party_id_reset(struct ast_party_id *id)
Destroy and initialize the given party id structure.
Structure that contains features information.
const ast_string_field atxferabort
static int dtmf_features_flags_to_string(struct ast_flags *feature_flags, char *buffer, size_t buffer_size)
static int fail_enter(struct attended_transfer_properties *props)
static unsigned char enter[]
static void publish_transfer_threeway(struct attended_transfer_properties *props, struct ast_channel *transferee_channel, struct ast_channel *target_channel)
Send a stasis publication for an attended transfer that ends in a threeway call.
#define ast_channel_unref(c)
Decrease channel reference count.
#define ast_test_flag(p, flag)
void ast_bridge_publish_attended_transfer(struct ast_attended_transfer_message *transfer_msg)
Publish an attended transfer.
static void bridge_merge(struct ast_bridge *dest, struct ast_bridge *src, struct ast_channel **kick_channels, unsigned int num_channels)
Wrapper for bridge_do_merge.
static int rebridge_enter(struct attended_transfer_properties *props)
static void recall_callback(struct ast_dial *dial)
Dial callback when attempting to recall the original transferer channel.
const ast_string_field atxferthreeway
void ast_channel_remove_bridge_role(struct ast_channel *chan, const char *role_name)
Removes a bridge role from a channel.
static const struct attended_transfer_state_properties state_properties[]
attended_transfer_state_flags
Flags that indicate properties of attended transfer states.
int ast_bridge_features_enable(struct ast_bridge_features *features, enum ast_bridge_builtin_feature feature, const char *dtmf, void *config, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
Enable a built in feature on a bridge features structure.
static void hold(struct ast_channel *chan)
Helper method to place a channel in a bridge on hold.
Wait to Retransfer state.
static const struct ast_datastore_info dtmf_features_info
An applicationmap configuration item.
#define ast_set_flag(p, flag)
static int consulting_enter(struct attended_transfer_properties *props)
void(* on_personality_change)(struct ast_bridge *bridge)
const ast_string_field atxfercomplete
ast_framehook_event
These are the types of events that the framehook's event callback can receive.
struct ast_bridge * transferee_bridge
int ast_bridge_channel_write_control_data(struct ast_bridge_channel *bridge_channel, enum ast_control_frame_type control, const void *data, size_t datalen)
Write a control frame into the bridge with data.
const ast_string_field transferer_addr
void ast_bridge_channel_run_app(struct ast_bridge_channel *bridge_channel, const char *app_name, const char *app_args, const char *moh_class)
Run an application on the bridge channel.
struct ast_flags * ast_bridge_features_ds_get(struct ast_channel *chan)
Get DTMF feature flags from the channel.
static void get_transfer_party_non_transferer_bridge(struct ast_bridge *bridge, struct ast_channel **party)
Get a desired transfer party for a bridge the transferer is not in.
static int blond_enter(struct attended_transfer_properties *props)
int ast_call(struct ast_channel *chan, const char *addr, int timeout)
Make a call.
int ast_attended_transfer_message_add_threeway(struct ast_attended_transfer_message *transfer_msg, struct ast_channel *survivor_channel, struct ast_bridge *survivor_bridge)
Add details for an attended transfer that was resolved as a three-way call.
enum bridge_basic_personality_type current
int ast_framehook_detach(struct ast_channel *chan, int framehook_id)
Detach an framehook from a channel.
unsigned int atxferdropcall
enum bridge_channel_state state
struct ast_features_xfer_config * ast_get_chan_features_xfer_config(struct ast_channel *chan)
Get the transfer configuration options for a channel.
static int wait_to_recall_enter(struct attended_transfer_properties *props)
Structure for a data store type.
static int attach_framehook(struct attended_transfer_properties *props, struct ast_channel *channel)
int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
Destroy a bridge.
static enum attended_transfer_state double_checking_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
#define ast_cond_wait(cond, mutex)
static const char * get_transfer_context(struct ast_channel *transferer, const char *context)
static void get_transfer_parties_transferer_bridge(struct ast_bridge *transferer_bridge, struct ast_bridge *other_bridge, struct ast_channel *transferer, struct ast_channel **transferer_peer, struct ast_channel **other_party)
Get the transferee and transfer target when the transferer is in a bridge with one of the desired par...
#define ast_cond_init(cond, attr)
static struct aco_type item
const char * stimulus_strs[]
String representations of the various stimuli.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
bridge_basic_personality_type
unsigned int inhibit_merge
Count of the active temporary requests to inhibit bridge merges. Zero if merges are allowed...
int ast_bridge_channel_write_callback(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_custom_callback_option flags, ast_bridge_custom_callback_fn callback, const void *payload, size_t payload_size)
Write a bridge action custom callback frame into the bridge.
static void remove_attended_transfer_stimulus(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
Structure for a data store object.
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
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.
unsigned int transferdigittimeout
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
static void init_details(struct personality_details *details, enum bridge_basic_personality_type type)
struct ast_bridge_channel * bridge_find_channel(struct ast_bridge *bridge, struct ast_channel *chan)
static void stream_failsound(struct ast_channel *chan)
Helper method to stream a fail sound on a channel.
static enum attended_transfer_state recalling_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
int ast_channel_add_bridge_role(struct ast_channel *chan, const char *role_name)
Adds a bridge role to a channel.
const ast_string_field exten
static void transfer_pull(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct attended_transfer_properties *props)
static int atxfer_complete(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
DTMF hook when transferer presses complete sequence.
const ast_string_field transferer_type
Properties of an attended transfer state.
int ast_bridge_queue_everyone_else(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
Queue the given frame to everyone else.
static int build_dtmf_features(struct ast_flags *flags, const char *features)
static int bridge_features_ds_set_full(struct ast_channel *chan, struct ast_flags *flags, int replace)
static enum attended_transfer_state wait_to_recall_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
void ast_free_ptr(void *ptr)
free() wrapper
#define ast_cond_signal(cond)
int ast_channel_priority(const struct ast_channel *chan)
struct ast_channel * transfer_target
#define ast_verb(level,...)
struct ast_channel * ast_bridge_peer(struct ast_bridge *bridge, struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
unsigned int transferdialattempts
static struct ast_channel * dial_transfer(struct ast_channel *caller, const char *destination)
Helper function that creates an outgoing channel and returns it immediately.
int ast_callid_threadassoc_remove(void)
Removes callid from thread storage of the calling thread.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
struct ast_bridge * bridge
Bridge this channel is participating in.
struct ast_frame_subclass subclass
ast_callid ast_read_threadstorage_callid(void)
extracts the callerid from the thread
struct ast_channel * recall_target
void ast_party_caller_copy(struct ast_party_caller *dest, const struct ast_party_caller *src)
Copy the source caller information to the destination caller.
static int dynamic_dtmf_hook_add(struct ast_bridge_features *features, unsigned int flags, const char *dtmf, const char *feature_name, const char *app_name, const char *app_args, const char *moh_class)
pthread_cond_t ast_cond_t
#define ast_strlen_zero(foo)
struct ast_bridge_methods ast_bridge_base_v_table
Bridge base class virtual method table.
struct ast_channel * ast_request(const char *type, struct ast_format_cap *request_cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requests a channel.
static void play_sound(struct ast_channel *chan, const char *sound)
Helper method to play a sound on a channel in a bridge.
void ast_dial_set_user_data(struct ast_dial *dial, void *user_data)
Set user data on a dial structure.
int ast_channel_set_bridge_role_option(struct ast_channel *channel, const char *role_name, const char *option, const char *value)
Set a role option on a channel.
int ast_callid_threadassoc_add(ast_callid callid)
Adds a known callid to thread storage of the calling thread.
static void blind_transfer_cb(struct ast_channel *new_channel, struct transfer_channel_data *user_data_wrapper, enum ast_transfer_type transfer_type)
int ast_framehook_attach(struct ast_channel *chan, struct ast_framehook_interface *i)
Attach an framehook onto a channel for frame interception.
void ast_dial_set_state_callback(struct ast_dial *dial, ast_dial_state_callback callback)
Set a callback for state changes.
void * ao2_object_get_lockaddr(void *obj)
Return the mutex lock address of an object.
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
static int bridge_personality_atxfer_push(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
const ast_string_field transferretrysound
#define ast_debug(level,...)
Log a DEBUG message.
enum ast_transfer_result result
struct ast_bridge * ast_channel_get_bridge(const struct ast_channel *chan)
Get the bridge associated with a channel.
static int hesitant_enter(struct attended_transfer_properties *props)
#define ast_bridge_channel_lock(bridge_channel)
Lock the bridge_channel.
static enum attended_transfer_state blond_nonfinal_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
enum ast_transfer_result ast_bridge_transfer_blind(int is_external, struct ast_channel *transferer, const char *exten, const char *context, transfer_channel_cb new_channel_cb, void *user_data)
Blind transfer target to the extension and context provided.
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)
struct stimulus_list * next
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
General Asterisk PBX channel definitions.
static int resume_enter(struct attended_transfer_properties *props)
static int dynamic_dtmf_hook_trip(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
#define SCOPED_MUTEX(varname, lock)
scoped lock specialization for mutexes
void ast_bridge_channel_update_linkedids(struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
enum ast_dial_result ast_dial_join(struct ast_dial *dial)
Cancel async thread.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
int ast_bridge_features_ds_append(struct ast_channel *chan, struct ast_flags *flags)
Append basic bridge DTMF feature flags on the channel.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
enum attended_transfer_state state
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
static int threeway_enter(struct attended_transfer_properties *props)
void ast_bridging_init_basic(void)
int ast_bridge_features_ds_set(struct ast_channel *chan, struct ast_flags *flags)
Set basic bridge DTMF feature flags datastore on the channel.
unsigned int atxferloopdelay
int ast_attended_transfer_message_add_merge(struct ast_attended_transfer_message *transfer_msg, struct ast_bridge *final_bridge)
Add details for a bridge merge to an attended transfer message.
static void ringing(struct ast_channel *chan)
Helper method to send a ringing indication to a channel in a bridge.
void ast_bridge_merge_inhibit(struct ast_bridge *bridge, int request)
Adjust the bridge merge inhibit request count.
#define AST_MAX_EXTENSION
#define AST_STRING_FIELD(name)
Declare a string field.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define ast_channel_cleanup(c)
Cleanup a channel reference.
#define ao2_ref(o, delta)
static void copy_caller_data(struct ast_channel *dest, struct ast_channel *caller)
int ast_softhangup(struct ast_channel *chan, int reason)
Softly hangup up a channel.
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
static void bridge_ringing(struct ast_bridge *bridge)
Helper method to send a ringing indication to all channels in a bridge.
#define ast_strdupa(s)
duplicate a string in memory from the stack
static enum attended_transfer_state wait_to_retransfer_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
struct ast_flags transferer_features
static int complete_enter(struct attended_transfer_properties *props)
static int grab_transfer(struct ast_channel *chan, char *exten, size_t exten_len, const char *context)
Helper function that presents dialtone and grabs extension.
#define SCOPED_LOCK(varname, lock, lockfunc, unlockfunc)
Scoped Locks.
A set of macros to manage forward-linked lists.
#define ast_malloc(len)
A wrapper for malloc()
static void bridge_hold(struct ast_bridge *bridge)
Helper method to send a hold frame to all channels in a bridge.
void ast_bridge_discard_after_goto(struct ast_channel *chan)
Discard channel after bridge goto location.
struct ast_bridge * bridge_alloc(size_t size, const struct ast_bridge_methods *v_table)
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Details for specific basic bridge personalities.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
void ast_bridge_basic_set_flags(struct ast_bridge *bridge, unsigned int flags)
Set feature flags on a basic bridge.
void ast_channel_req_accountcodes(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
Setup new channel accountcodes from the requestor channel after ast_request().
const char * ast_channel_exten(const struct ast_channel *chan)
enum ast_dial_result ast_dial_state(struct ast_dial *dial)
Return state of dial.
Core PBX routines and definitions.
enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async)
Execute dialing synchronously or asynchronously.
static enum attended_transfer_state retransfer_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
attended_transfer_superstate
Attended transfer superstates.
const ast_string_field name
struct ast_bridge * bridge_base_init(struct ast_bridge *self, uint32_t capabilities, unsigned int flags, const char *creator, const char *name, const char *id)
Initialize the base class of the bridge.
char context[AST_MAX_CONTEXT]
#define ast_test_suite_event_notify(s, f,...)
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
ast_frame_type
Frame types.
#define ast_bridge_channel_unlock(bridge_channel)
Unlock the bridge_channel.
const struct ast_bridge_methods * v_table
static struct ast_bridge * bridge_basic_personality_alloc(struct ast_bridge *bridge)
static int atxfer_threeway(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
DTMF hook when transferer presses threeway sequence.
int ast_channel_has_role(struct ast_channel *channel, const char *role_name)
Check if a role exists on a channel.
struct ast_bridge * target_bridge
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
char context[AST_MAX_CONTEXT]
Structure that contains information about a bridge.
static struct ast_frame * transfer_target_framehook_cb(struct ast_channel *chan, struct ast_frame *frame, enum ast_framehook_event event, void *data)
Frame hook for transfer target channel.
static int retransfer_enter(struct attended_transfer_properties *props)
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
static int atxfer_abort(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
DTMF hook when transferer presses abort sequence.
static void stimulate_attended_transfer(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
unsigned int activate_on_self
static void * attended_transfer_monitor_thread(void *data)
The main loop for the attended transfer monitor thread.
#define AST_FRAMEHOOK_INTERFACE_VERSION
int ast_bridge_hangup_hook(struct ast_bridge_features *features, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
Attach a hangup hook to a bridge features structure.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static enum attended_transfer_state hesitant_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
unsigned int atxfernoanswertimeout
#define ao2_callback_data(container, flags, cb_fn, arg, data)
static void remove_hooks_on_personality_change(struct ast_bridge *bridge)
Remove appropriate hooks when basic bridge personality changes.
int ast_bridge_features_register(enum ast_bridge_builtin_feature feature, ast_bridge_hook_callback callback, const char *dtmf)
Register a handler for a built in feature.
int ast_get_builtin_feature(struct ast_channel *chan, const char *feature, char *buf, size_t len)
Get the DTMF code for a builtin feature.
static void attended_transfer_properties_destructor(void *obj)
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
Connected Line/Party information.
int ast_dial_append(struct ast_dial *dial, const char *tech, const char *device, const struct ast_assigned_ids *assignedids)
Append a channel.
struct ast_bridge_methods ast_bridge_basic_v_table
Bridge basic class virtual method table.
const char * app_name(struct ast_app *app)
#define ast_cond_destroy(cond)
#define ao2_alloc(data_size, destructor_fn)
#define AST_TRANSFERER_ROLE_NAME
void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state, int cause)
Set bridge channel state to leave bridge (if not leaving already).
static enum attended_transfer_state consulting_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
static void publish_transfer_fail(struct attended_transfer_properties *props)
Send a stasis publication for a failed attended transfer.
int(* enter)(struct attended_transfer_properties *props)
const ast_string_field atxferswap
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
char threeway[MAXIMUM_DTMF_FEATURE_STRING]
structure that organizes different personalities for basic bridges.
attended_transfer_stimulus
Stimuli that can cause transfer state changes.
ast_bridge_builtin_feature
Built in DTMF features.
Bridge virtual methods table definition.
#define ast_channel_unlock(chan)
#define ast_bridge_unlock(bridge)
Unlock the bridge.
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
#define ast_calloc(num, len)
A wrapper for calloc()
struct ast_dial * ast_dial_create(void)
New dialing structure.
static int atxfer_transferer_hangup(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
Hangup hook for transferer channel.
struct ast_channel * ast_dial_get_channel(struct ast_dial *dial, int num)
Get the dialing channel, if prerun has been executed.
static struct attended_transfer_properties * attended_transfer_properties_alloc(struct ast_channel *transferer, const char *context)
Allocate and initialize attended transfer properties.
static int atxfer_swap(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
DTMF hook when transferer presses swap sequence.
int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *digits)
stream file until digit If the file name is non-empty, try to play it.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
static int feature_blind_transfer(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
Internal built in feature for blind transfers.
static void on_personality_change_normal(struct ast_bridge *bridge)
void ast_bridge_set_transfer_variables(struct ast_channel *chan, const char *value, int is_attended)
Set the relevant transfer variables for a single channel.
static int add_normal_hooks(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
static void recall_pull(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct attended_transfer_properties *props)
char * ast_get_chan_features_xferfailsound(struct ast_channel *chan)
Get the transfer configuration option xferfailsound.
struct ast_channel * swap
struct ast_bridge_methods * v_table
Basic bridge subclass API.
static int recalling_enter(struct attended_transfer_properties *props)
void ast_bridge_features_remove(struct ast_bridge_features *features, enum ast_bridge_hook_remove_flags flags)
Remove marked bridge channel feature hooks.
static int builtin_feature_get_exten(struct ast_channel *chan, const char *feature_name, char *buf, size_t len)
Structure used to handle boolean flags.
int ast_bridge_dtmf_hook(struct ast_bridge_features *features, const char *dtmf, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
Attach a DTMF hook to a bridge features structure.
#define ast_clear_flag(p, flag)
int ast_bridge_features_ds_set_string(struct ast_channel *chan, const char *features)
Sets the features a channel will use upon being bridged.
const ast_string_field moh_class
static void bridge_basic_pull(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel)
struct ast_bridge_channel * ast_channel_get_bridge_channel(struct ast_channel *chan)
Get a reference to the channel's bridge pointer.
void ast_channel_callid_set(struct ast_channel *chan, ast_callid value)
static int replace(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
struct ast_channel * ast_dial_answered_steal(struct ast_dial *dial)
Steal the channel that answered.
enum attended_transfer_stimulus stimulus
Structure that contains configuration information for the attended transfer built in feature...
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_bridge_lock(bridge)
Lock the bridge.
static int blond_nonfinal_enter(struct attended_transfer_properties *props)
int ast_bridge_channel_write_hold(struct ast_bridge_channel *bridge_channel, const char *moh_class)
Write a hold frame into the bridge.
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
void ast_bridge_channel_update_accountcodes(struct ast_bridge_channel *joining, struct ast_bridge_channel *leaving)
struct ast_bridge_channels_list channels
static void dynamic_dtmf_hook_callback(struct ast_bridge_channel *bridge_channel, const void *payload, size_t payload_size)
struct ast_party_connected_line original_transferer_colp
static void get_transfer_parties(struct ast_channel *transferer, struct ast_bridge *transferee_bridge, struct ast_bridge *target_bridge, struct ast_channel **transferee, struct ast_channel **transfer_target)
determine transferee and transfer target for an attended transfer
struct ast_channel * chan
Structure that contains information regarding a channel in a bridge.
void ast_party_connected_line_copy(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
Copy the source connected line information to the destination connected line.
int bridge_do_move(struct ast_bridge *dst_bridge, struct ast_bridge_channel *bridge_channel, int attempt_recovery, unsigned int optimized)
After Bridge Execution API.
#define ast_channel_ref(c)
Increase channel reference count.
void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel)
Lock the bridge associated with the bridge channel.
void ast_connected_line_copy_from_caller(struct ast_party_connected_line *dest, const struct ast_party_caller *src)
Copy the caller information to the connected line information.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
const char * ast_channel_name(const struct ast_channel *chan)
char abort[MAXIMUM_DTMF_FEATURE_STRING]
static int bridge_basic_setup_features(struct ast_bridge_channel *bridge_channel)
static int bridge_personality_normal_push(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
int ast_bridge_channel_queue_playfile(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class)
Queue a bridge action play file frame onto the bridge channel.
static enum attended_transfer_state calling_target_exit(struct attended_transfer_properties *props, enum attended_transfer_stimulus stimulus)
int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect, size_t size, int maxlen, int timeout)
Present a dialtone and collect a certain length extension.
#define AST_FEATURE_MAX_LEN
static void unhold(struct ast_channel *chan)
Helper method to take a channel in a bridge off hold.
enum attended_transfer_state_flags flags
AO2 object that wraps data for transfer_channel_cb.
Data structure associated with a single frame of data.
const ast_string_field context
const char * ast_channel_get_role_option(struct ast_channel *channel, const char *role_name, const char *option)
Retrieve the value of a requested role option from a channel.
static void bridge_move(struct ast_bridge *dest, struct ast_bridge *src, struct ast_channel *channel, struct ast_channel *swap)
Wrapper for bridge_do_move.
const char * ast_channel_context(const struct ast_channel *chan)
ast_bridge_pull_channel_fn pull
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.
ast_bridge_destructor_fn destroy
#define ast_datastore_alloc(info, uid)
ast_bridge_push_channel_fn push
union ast_frame::@263 data
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
enum ast_frame_type frametype
static int builtin_features_helper(struct ast_bridge_features *features, struct ast_channel *chan, struct ast_flags *flags, unsigned int feature_flag, const char *feature_name, enum ast_bridge_builtin_feature feature_bridge)
int atxfernoanswertimeout
static int feature_attended_transfer(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
Internal built in feature for attended transfers.
static char context[AST_MAX_CONTEXT]
Call Parking and Pickup API Includes code and algorithms from the Zapata library. ...
struct personality_details details[BRIDGE_BASIC_PERSONALITY_END]
Structure that contains configuration information for the blind transfer built in feature...
const char * ast_channel_macrocontext(const struct ast_channel *chan)
int ast_bridge_channel_write_unhold(struct ast_bridge_channel *bridge_channel)
Write an unhold frame into the bridge.
struct ast_attended_transfer_message * ast_attended_transfer_message_create(int is_external, struct ast_channel *to_transferee, struct ast_bridge *transferee_bridge, struct ast_channel *to_transfer_target, struct ast_bridge *target_bridge, struct ast_channel *transferee, struct ast_channel *transfer_target)
Create an Attended transfer message to be published.
const ast_string_field xfersound
static void bridge_unhold(struct ast_bridge *bridge)
Helper method to send an unhold frame to all channels in a bridge.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
struct ast_channel * transferer
char dtmf[AST_FEATURE_MAX_LEN]
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct ast_party_id priv
Private connected party ID.
unsigned int atxfercallbackretries
ast_callid ast_channel_callid(const struct ast_channel *chan)
#define ast_cond_timedwait(cond, mutex, time)
unsigned int num_channels
static void bridge_personality_atxfer_pull(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel)
int ast_stopstream(struct ast_channel *c)
Stops a stream.
static void common_recall_channel_setup(struct ast_channel *recall, struct ast_channel *transferer)
const ast_string_field transferinvalidsound
static int calling_target_enter(struct attended_transfer_properties *props)
char swap[MAXIMUM_DTMF_FEATURE_STRING]
enum attended_transfer_superstate superstate
const ast_string_field app_data
static enum attended_transfer_stimulus wait_for_stimulus(struct attended_transfer_properties *props)
static void personality_destructor(void *obj)
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
struct ast_bridge * ast_bridge_basic_new(void)
Create a new basic class bridge.
Collection of data related to an attended transfer attempt.
int ast_dial_prerun(struct ast_dial *dial, struct ast_channel *chan, struct ast_format_cap *cap)
Request all appended channels, but do not dial.