126 memset(sync_struct, 0,
sizeof(*sync_struct));
127 sync_struct->
id =
id;
153 if (iter->
id == sync_struct->
id) {
178 #define PLAYBACK_TIMEOUT (600 * 1000) 188 struct timespec timeout_spec = {
189 .tv_sec = timeout_val.tv_sec,
190 .tv_nsec = timeout_val.tv_usec * 1000,
229 bridge = bridge_channel->
bridge;
235 if (bridge == bridge_channel->
bridge) {
248 .subclass.integer = started_talking
261 if (!pthread_equal(pthread_self(), bridge_channel->
thread)) {
298 ast_debug(1,
"Setting %p(%s) state from:%u to:%u\n",
309 bridge_channel->
state = new_state;
328 if (other != bridge_channel) {
346 ast_debug(1,
"Bridge is returning %p(%s) to read format %s\n",
350 ast_debug(1,
"Bridge failed to return %p(%s) to read format %s\n",
356 ast_debug(1,
"Bridge is returning %p(%s) to write format %s\n",
360 ast_debug(1,
"Bridge failed to return %p(%s) to write format %s\n",
374 bridge = bridge_channel->
bridge;
392 oldest_linkedid_chan, other->
chan);
424 ast_debug(1,
"Setting channel %s peeraccount with channel %s accountcode '%s'.\n",
447 ast_debug(1,
"Setting channel %s accountcode with channel %s peeraccount '%s'.\n",
492 ast_debug(1,
"Changing channel %s peeraccount '%s' to match channel %s accountcode '%s'.\n",
533 unsigned int swap_in_bridge = 0;
534 unsigned int will_be_two_party;
548 will_be_two_party = (1 == bridge->
num_channels - swap_in_bridge);
557 if (will_be_two_party) {
628 ast_debug(1,
"Hangup hook %p is being removed from %p(%s)\n",
653 int unmapped_stream_num;
706 unmapped_stream_num = -1;
744 t38_parameters = frame->
data.
ptr;
798 .src =
"Bridge channel owed DTMF",
805 ast_log(
LOG_DTMF,
"DTMF end '%c' simulated to bridge %s because %s left. Duration %ld ms.\n",
818 .data.ptr = &t38_parameters,
819 .datalen =
sizeof(t38_parameters),
820 .
src =
"Bridge channel owed T.38 terminate",
823 ast_debug(1,
"T.38 terminate simulated to bridge %s because %s left.\n",
943 .subclass.integer = action,
945 .data.ptr = (
void *) data,
970 int sync_payload_len =
sizeof(*sync_payload) + datalen;
974 .subclass.integer = action,
982 memcpy(sync_payload->
data, data, datalen);
984 frame.
datalen = sync_payload_len;
1015 .subclass.integer = action,
1017 .data.ptr = (
void *) data,
1031 if (sync->
id == sync_payload->
id) {
1115 ast_log(
LOG_ERROR,
"We couldn't write alert pipe for %p(%s)... something is VERY wrong\n",
1125 int not_written = -1;
1133 if (cur == bridge_channel) {
1147 .subclass.integer = control,
1149 .data.ptr = (
void *) data,
1159 .subclass.integer = control,
1161 .data.ptr = (
void *) data,
1174 datalen = strlen(moh_class) + 1;
1177 "musicclass", moh_class);
1187 moh_class, datalen);
1215 if (!strcasecmp(
"Gosub", app_name)) {
1217 }
else if (!strcasecmp(
"Macro", app_name)) {
1228 if (substituted_args) {
1233 ast_log(
LOG_WARNING,
"Could not substitute application argument variables for %s\n", app_name);
1234 res =
pbx_exec(chan, app, app_args);
1289 size_t len_name = strlen(app_name) + 1;
1290 size_t len_args =
ast_strlen_zero(app_args) ? 0 : strlen(app_args) + 1;
1291 size_t len_moh = !moh_class ? 0 : strlen(moh_class) + 1;
1292 size_t len_data =
sizeof(*app_data) + len_name + len_args + len_moh;
1295 app_data = alloca(len_data);
1297 app_data->
moh_offset = len_moh ? len_name + len_args : 0;
1298 strcpy(app_data->
app_name, app_name);
1312 bridge_channel, app_name, app_args, moh_class);
1318 bridge_channel, app_name, app_args, moh_class);
1327 custom_play(bridge_channel, playfile);
1340 const char *latest_musicclass;
1382 size_t len_name = strlen(playfile) + 1;
1383 size_t len_moh = !moh_class ? 0 : strlen(moh_class) + 1;
1384 size_t len_payload =
sizeof(*payload) + len_name + len_moh;
1389 payload->
moh_offset = len_moh ? len_name : 0;
1390 strcpy(payload->
playfile, playfile);
1401 bridge_channel, custom_play, playfile, moh_class);
1407 bridge_channel, custom_play, playfile, moh_class);
1414 bridge_channel, custom_play, playfile, moh_class);
1463 size_t len_data =
sizeof(*cb_data) + (payload ?
payload_size : 0);
1472 cb_data = alloca(len_data);
1478 memcpy(cb_data->
payload, payload, payload_size);
1489 bridge_channel, flags, callback, payload, payload_size);
1497 bridge_channel, flags, callback, payload, payload_size);
1504 char parkee_uuid[0];
1533 const char *parkee_uuid,
1534 const char *parker_uuid,
1538 size_t len_parkee_uuid = strlen(parkee_uuid) + 1;
1539 size_t len_parker_uuid = strlen(parker_uuid) + 1;
1540 size_t len_app_data = !app_data ? 0 : strlen(app_data) + 1;
1541 size_t len_payload =
sizeof(*payload) + len_parker_uuid + len_parkee_uuid + len_app_data;
1543 payload = alloca(len_payload);
1544 payload->
app_data_offset = len_app_data ? len_parkee_uuid + len_parker_uuid : 0;
1558 bridge_channel, parkee_uuid, parker_uuid, app_data);
1574 struct timeval start;
1575 int chan_suspended = 0;
1582 unsigned int execution_time;
1585 ast_debug(1,
"Hook %p on %p(%s) wants to happen in the future, stopping our traversal\n",
1599 ast_debug(1,
"Executing hook %p on %p(%s)\n",
1613 ast_debug(1,
"Removed interval hook %p from %p(%s)\n",
1623 ast_debug(1,
"Updating interval hook %p with interval %u on %p(%s)\n",
1649 if (chan_suspended) {
1677 #ifdef TEST_FRAMEWORK 1678 char *feature =
"unknown";
1688 if (!strcmp(dtmf, featuremap->
blindxfer)) {
1689 feature =
"blindxfer";
1690 }
else if (!strcmp(dtmf, featuremap->
atxfer)) {
1692 }
else if (!strcmp(dtmf, featuremap->
disconnect)) {
1693 feature =
"disconnect";
1694 }
else if (!strcmp(dtmf, featuremap->
automon)) {
1695 feature =
"automon";
1696 }
else if (!strcmp(dtmf, featuremap->
automixmon)) {
1697 feature =
"automixmon";
1698 }
else if (!strcmp(dtmf, featuremap->
parkcall)) {
1699 feature =
"parkcall";
1704 feature =
"atxferthreeway";
1712 "Result: success\r\n" 1713 "Feature: %s", feature);
1725 ast_debug(1,
"DTMF feature string on %p(%s) is now '%s'\n",
1735 unsigned int digit_timeout;
1751 return digit_timeout;
1768 struct sanity_check_of_dtmf_size {
1773 if (!dtmf_len && !digit) {
1787 ast_debug(1,
"No DTMF feature hooks on %p(%s) match '%s'\n",
1791 }
else if (dtmf_len != strlen(hook->
dtmf.
code)) {
1792 unsigned int digit_timeout;
1801 int already_suspended;
1803 ast_debug(1,
"DTMF feature hook %p matched DTMF string '%s' on %p(%s)\n",
1814 already_suspended = bridge_channel->
suspended;
1815 if (!already_suspended) {
1824 ast_debug(1,
"DTMF hook %p is being removed from %p(%s)\n",
1832 if (!already_suspended) {
1859 ast_debug(1,
"DTMF feature string collection on %p(%s) timed out\n",
1915 remove_me = talk_cb(bridge_channel, hook->
hook_pvt, talking);
1917 ast_debug(1,
"Talk detection hook %p is being removed from %p(%s)\n",
1928 ast_debug(1,
"Playing DTMF stream '%s' out to %p(%s)\n",
1947 unsigned char connected_line_data[1024];
1975 sizeof(connected_line_data), &connected_target,
NULL)) != -1) {
1979 frame_size = payload_size +
sizeof(*frame_payload);
1983 memcpy(frame_payload->payload, connected_line_data, payload_size);
2028 const char *target_chan_name)
2041 chan_bridged = bridge_channel->
chan;
2151 switch (bridge_channel->
state) {
2187 ast_debug(1,
"Bridge %s: pulling %p(%s)\n",
2190 ast_verb(3,
"Channel %s left '%s' %s-bridge <%s>\n",
2198 ast_debug(1,
"Bridge %s: %p(%s) is leaving %s technology\n",
2246 ast_debug(1,
"Bridge %s: pushing %p(%s) by swapping with %p(%s)\n",
2250 ast_debug(1,
"Bridge %s: pushing %p(%s)\n",
2258 || bridge->
v_table->
push(bridge, bridge_channel, swap)) {
2259 ast_debug(1,
"Bridge %s: pushing %p(%s) into bridge failed\n",
2292 ast_verb(3,
"Channel %s %s%s%s '%s' %s-bridge <%s>\n",
2294 swap ?
"swapped with " :
"joined",
2296 swap ?
" into" :
"",
2336 chan = bridge_channel->
chan;
2361 switch (ntohs(aoh->option)) {
2369 fr->
datalen -
sizeof(*aoh), 0);
2507 ast_debug(1,
"Sending TEXT frame to '%s': %*.s\n",
2513 ast_debug(1,
"Sending TEXT_DATA frame from '%s' to '%s:%s': %s\n",
2569 switch (frametype) {
2581 #ifdef TEST_FRAMEWORK 2661 bridge_channel->
bridge, bridge_channel);
2680 bridge_channel->
bridge, bridge_channel);
2789 if (ms < 0 || (0 <= ms_interval && ms_interval < ms)) {
2819 ast_debug(1,
"Bridge %s: %p(%s) is going into a signal wait\n",
2843 }
else if (ms == 0) {
2847 }
else if (-1 < outfd) {
2881 if (hook->
type == type) {
2890 if (hook->
type == type) {
2905 uint8_t indicate_src_change = 0;
2909 ast_debug(1,
"Bridge %s: %p(%s) is joining\n",
2929 ast_debug(1,
"Bridge %s: %p(%s) failed to join Bridge\n",
2939 if (channel_features) {
2952 swap = bridge_channel->
swap;
2975 indicate_src_change = 1;
2985 if (indicate_src_change) {
3013 ao2_t_cleanup(swap,
"Bridge push with swap failed or exited immediately");
3017 ast_debug(1,
"Channel %s simulating UNHOLD for bridge end.\n",
3035 ast_debug(1,
"Channel %s simulating T.38 terminate for bridge end.\n",
3038 &t38_parameters,
sizeof(t38_parameters));
3073 if (!transferee_bridge_channel) {
3077 if (new_channel_cb) {
3098 if (!transferee_bridge_channel) {
3103 sizeof(unbridged_chan_name));
3107 sizeof(unbridged_chan_name));
3122 if (bridge_channel->
callid) {
3123 bridge_channel->
callid = 0;
3126 if (bridge_channel->
bridge) {
3156 if (!bridge_channel) {
3171 return bridge_channel;
static void bridge_channel_handle_control(struct ast_bridge_channel *bridge_channel, struct ast_frame *fr)
struct stasis_message_type * ast_channel_hold_type(void)
Message type for when a channel is placed on hold.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_bridge_publish_leave(struct ast_bridge *bridge, struct ast_channel *chan)
Publish a bridge channel leave event.
ast_bridge_custom_play_fn custom_play
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, const char *digits, int between, unsigned int duration)
Send a string of DTMF digits to a channel.
#define PLAYBACK_TIMEOUT
Failsafe for synchronous bridge action waiting.
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
#define ast_channel_lock(chan)
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
enum bridge_channel_thread_state activity
The bridge channel thread activity.
int ast_connected_line_build_data(unsigned char *data, size_t datalen, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Build the connected line information data frame.
#define ast_frdup(fr)
Copies a frame.
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.
#define ao2_t_cleanup(obj, tag)
int ast_channel_hold_state(const struct ast_channel *chan)
Feature configuration relating to transfers.
struct ast_bridge_channel::@233 dtmf_hook_state
void ast_bridge_channel_clear_roles(struct ast_bridge_channel *bridge_channel)
Clear all roles from a bridge_channel's role list.
int ast_sem_destroy(struct ast_sem *sem)
Destroy a semaphore.
Asterisk main include file. File version handling, generic pbx functions.
struct ast_flags feature_flags
struct ast_bridge_channel::@230 wr_queue
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
static int bridge_channel_write_frame(struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
const ast_string_field uniqueid
int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int is_caller, int frame)
Run a connected line interception macro and update a channel's connected line information.
static void bridge_channel_blind_transfer(struct ast_bridge_channel *bridge_channel, struct blind_transfer_data *blind_data)
struct ast_bridge_features * features
const char * ast_bridge_after_cb_reason_string(enum ast_bridge_after_cb_reason reason)
Get a string representation of an after bridge callback reason.
static void bridge_channel_do_callback(struct ast_bridge_channel *bridge_channel, struct bridge_custom_callback *data)
int(* ast_bridge_talking_indicate_callback)(struct ast_bridge_channel *bridge_channel, void *hook_pvt, int talking)
Talking indicator callback.
struct stasis_message_type * ast_channel_unhold_type(void)
Message type for when a channel is removed from hold.
int ast_channel_is_multistream(struct ast_channel *chan)
Determine if a channel is multi-stream capable.
static int bridge_channel_write_action_data(struct ast_bridge_channel *bridge_channel, enum bridge_channel_action_type action, const void *data, size_t datalen)
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
int bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel)
int(* ast_bridge_channel_post_action_data)(struct ast_bridge_channel *bridge_channel, enum bridge_channel_action_type action, const void *data, size_t datalen)
Used to queue an action frame onto a bridge channel and write an action frame into a bridge...
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
unsigned int option_dtmfminduration
struct ast_stream_topology * ast_channel_get_stream_topology(const struct ast_channel *chan)
Retrieve the topology of streams on a channel.
bridge_channel_state
State information about a bridged channel.
static void bridge_channel_wait(struct ast_bridge_channel *bridge_channel)
void bridge_channel_internal_suspend_nolock(struct ast_bridge_channel *bridge_channel)
void ast_bridge_vars_set(struct ast_channel *chan, const char *name, const char *pvtid)
Sets BRIDGECHANNEL and BRIDGEPVTCALLID for a channel.
static void bridge_channel_update_accountcodes_leaving(struct ast_bridge_channel *leaving)
void ast_party_id_reset(struct ast_party_id *id)
Destroy and initialize the given party id structure.
Structure that contains features information.
int bridge_channel_internal_push(struct ast_bridge_channel *bridge_channel)
#define ast_channel_unref(c)
Decrease channel reference count.
#define ast_set2_flag(p, value, flag)
#define ast_test_flag(p, flag)
char ast_channel_sending_dtmf_digit(const struct ast_channel *chan)
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
void(* suspend)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
Suspend a channel on a bridging technology instance for a bridge.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
void ast_channel_publish_cached_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Publish a channel blob message using the latest snapshot from the cache.
void ast_channel_publish_dial(struct ast_channel *caller, struct ast_channel *peer, const char *dialstring, const char *dialstatus)
Publish in the ast_channel_topic or ast_channel_topic_all topics a stasis message for the channels in...
#define ast_heap_unlock(h)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
const ast_string_field atxferthreeway
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).
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
Configuration for the builtin features.
int ast_sem_post(struct ast_sem *sem)
Increments the semaphore, unblocking a waiter if necessary.
int ast_check_hangup_locked(struct ast_channel *chan)
int(* stream_topology_request_change)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
Callback for when a request has been made to change a stream topology on a channel.
static void channel_fill_empty_accountcode(struct ast_channel *dest, struct ast_channel *src)
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static void channel_set_empty_accountcodes(struct ast_channel *c0, struct ast_channel *c1)
unsigned int reconfigured
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
int ast_sem_timedwait(struct ast_sem *sem, const struct timespec *abs_timeout)
Decrements the semaphore, waiting until abs_timeout.
static int bridge_channel_next_interval(struct ast_bridge_channel *bridge_channel)
static int payload_helper_playfile(ast_bridge_channel_post_action_data post_it, struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class)
static void sendtext_safe(struct ast_channel *chan, const struct ast_frame *f)
static int run_app_helper(struct ast_channel *chan, const char *app_name, const char *app_args)
void ast_bridge_channel_restore_formats(struct ast_bridge_channel *bridge_channel)
Restore the formats of a bridge channel's channel to how they were before bridge_channel_internal_joi...
enum bridge_channel_state state
static void channel_update_peeraccount(struct ast_channel *dest, struct ast_channel *src)
struct ast_bridge_hook generic
static void bridge_sync_wait(struct bridge_sync *sync_struct)
Wait for a synchronous bridge action to complete.
void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag)
struct ast_features_xfer_config * ast_get_chan_features_xfer_config(struct ast_channel *chan)
Get the transfer configuration options for a channel.
static void bridge_sync_init(struct bridge_sync *sync_struct, unsigned int id)
initialize a synchronous bridge object.
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
struct ast_channel * ast_bridge_channel_get_chan(struct ast_bridge_channel *bridge_channel)
Get a ref to the bridge_channel's ast_channel.
enum ast_control_t38 request_response
int ast_bridge_channel_write_app(struct ast_bridge_channel *bridge_channel, const char *app_name, const char *app_args, const char *moh_class)
Write a bridge action run application frame into the bridge.
struct ast_bridge_channel * bridge_channel_internal_alloc(struct ast_bridge *bridge)
struct ast_frame * ast_read_stream(struct ast_channel *chan)
Reads a frame, but does not filter to just the default streams.
static void bridge_channel_event_join_leave(struct ast_bridge_channel *bridge_channel, enum ast_bridge_hook_type type)
Structure used to transport a message through the frame core.
ast_channel_state
ast_channel states
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
void(* stream_topology_changed)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
Callback for when a stream topology changes on the channel.
void(* ast_bridge_custom_callback_fn)(struct ast_bridge_channel *bridge_channel, const void *payload, size_t payload_size)
Custom callback run on a bridge channel.
struct ao2_container * dtmf_hooks
static void bridge_channel_dissolve_check(struct ast_bridge_channel *bridge_channel)
static void bridge_channel_run_app(struct ast_bridge_channel *bridge_channel, struct bridge_run_app *data)
static int bridge_channel_queue_action_data(struct ast_bridge_channel *bridge_channel, enum bridge_channel_action_type action, const void *data, size_t datalen)
int bridge_channel_internal_queue_blind_transfer(struct ast_channel *transferee, const char *exten, const char *context, transfer_channel_cb new_channel_cb, void *user_data)
#define ast_cond_wait(cond, mutex)
#define ast_cond_init(cond, attr)
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
void ast_bridge_channel_feature_digit(struct ast_bridge_channel *bridge_channel, int digit)
Add a DTMF digit to the collected digits to match against DTMF features.
ast_control_frame_type
Internal control frame subtype field values.
General features configuration items.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
static void bridge_channel_talking(struct ast_bridge_channel *bridge_channel, int talking)
struct ast_bridge * ast_channel_internal_bridge(const struct ast_channel *chan)
int ast_bridge_channel_queue_frame(struct ast_bridge_channel *bridge_channel, struct ast_frame *fr)
Write a frame to the specified bridge_channel.
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
unsigned int featuredigittimeout
struct ast_bridge_channel * ast_bridge_channel_peer(struct ast_bridge_channel *bridge_channel)
Get the peer bridge channel of a two party bridge.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
int ast_sendtext_data(struct ast_channel *chan, struct ast_msg_data *msg)
Sends text to a channel in an ast_msg_data structure wrapper with ast_sendtext as fallback...
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
static void bridge_handle_trip(struct ast_bridge_channel *bridge_channel)
struct ast_bridge_channel * bridge_find_channel(struct ast_bridge *bridge, struct ast_channel *chan)
static const char * controls[]
struct ast_bridge_channel::@236 stream_map
int ast_bridge_channel_queue_app(struct ast_bridge_channel *bridge_channel, const char *app_name, const char *app_args, const char *moh_class)
Queue a bridge action run application frame onto the bridge channel.
static int payload_helper_park(ast_bridge_channel_post_action_data post_it, struct ast_bridge_channel *bridge_channel, const char *parkee_uuid, const char *parker_uuid, const char *app_data)
int ast_channel_move(struct ast_channel *dest, struct ast_channel *source)
Move a channel from its current location to a new location.
Out-of-call text message support.
int ast_bridge_channel_establish_roles(struct ast_bridge_channel *bridge_channel)
Clone the roles from a bridge_channel's attached ast_channel onto the bridge_channel's role list...
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
char collected[MAXIMUM_DTMF_FEATURE_STRING]
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
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.
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.
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.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
const char * ast_channel_call_forward(const struct ast_channel *chan)
#define ast_cond_signal(cond)
struct ast_channel * ast_waitfor_nandfds(struct ast_channel **chan, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
Waits for activity on a group of channels.
ast_bridge_custom_callback_fn callback
int ast_bridge_set_after_callback(struct ast_channel *chan, ast_bridge_after_cb callback, ast_bridge_after_cb_failed failed, void *data)
Setup an after bridge callback for when the channel leaves the bridging system.
#define ast_verb(level,...)
void ast_bridge_channel_stream_map(struct ast_bridge_channel *bridge_channel)
Maps a channel's stream topology to and from the bridge.
int ast_write_stream(struct ast_channel *chan, int stream_num, struct ast_frame *frame)
Write a frame to a stream This function writes the given frame to the indicated stream on the channel...
int ast_bridge_channel_queue_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)
Queue a bridge action custom callback frame onto the bridge channel.
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
static void bridge_channel_dtmf_stream(struct ast_bridge_channel *bridge_channel, const char *dtmf)
Internal function that plays back DTMF on a bridge channel.
struct ast_vector_int to_bridge
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
Frame payload for synchronous bridge actions.
void ast_alertpipe_close(int alert_pipe[2])
Close an alert pipe.
#define ast_strlen_zero(foo)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
ast_bridge_after_cb_reason
const ast_string_field atxfer
ssize_t ast_alertpipe_write(int alert_pipe[2])
Write an event to an alert pipe.
Data specifying where a blind transfer is going to.
void * ao2_object_get_lockaddr(void *obj)
Return the mutex lock address of an object.
struct ast_features_general_config * ast_get_chan_features_general_config(struct ast_channel *chan)
Get the general configuration options for a channel.
struct ast_bridge_technology * technology
struct ast_flags feature_flags
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
unsigned int text_messaging
void ast_bridge_remove_video_src(struct ast_bridge *bridge, struct ast_channel *chan)
remove a channel as a source of video for the bridge.
int ast_bridge_channel_write_unhold(struct ast_bridge_channel *bridge_channel)
Write an unhold frame into the bridge.
#define ast_debug(level,...)
Log a DEBUG message.
int ast_bridge_channel_notify_talking(struct ast_bridge_channel *bridge_channel, int started_talking)
Lets the bridging indicate when a bridge channel has stopped or started talking.
void(* leave)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
Remove a channel from a bridging technology instance for a bridge.
The arg parameter is a partial search key similar to OBJ_SEARCH_KEY.
#define ast_heap_push(h, elm)
#define ast_bridge_channel_lock(bridge_channel)
Lock the bridge_channel.
void ast_bridge_channel_leave_bridge_nolock(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 void bridge_channel_handle_interval(struct ast_bridge_channel *bridge_channel)
void ast_channel_queue_connected_line_update(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Queue a connected line update frame on a channel.
enum ast_bridge_hook_type type
const char * ast_channel_latest_musicclass(const struct ast_channel *chan)
General Asterisk PBX channel definitions.
const char * ast_channel_accountcode(const struct ast_channel *chan)
void ast_jb_enable_for_channel(struct ast_channel *chan)
Sets a jitterbuffer frame hook on the channel based on the channel's stored jitterbuffer configuratio...
void ast_bridge_channel_kick(struct ast_bridge_channel *bridge_channel, int cause)
Kick the channel out of the bridge.
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define AST_OPTION_RELAXDTMF
void ast_channel_internal_bridge_set(struct ast_channel *chan, struct ast_bridge *value)
int(* write)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
Write a frame into the bridging technology instance for a bridge.
void bridge_reconfigured(struct ast_bridge *bridge, unsigned int colp_update)
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
static int channel_set_cause(struct ast_channel *chan, int cause)
void(* ast_bridge_custom_play_fn)(struct ast_bridge_channel *bridge_channel, const char *playfile)
Custom interpretation of the playfile name.
#define AST_MAX_EXTENSION
#define AST_RWLIST_TRAVERSE
#define AST_CAUSE_NORMAL_CLEARING
int ast_channel_redirecting_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *redirecting_info, int is_frame)
Run a redirecting interception subroutine and update a channel's redirecting information.
static unsigned int bridge_channel_feature_digit_timeout(struct ast_bridge_channel *bridge_channel)
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define ao2_ref(o, delta)
int ast_softhangup(struct ast_channel *chan, int reason)
Softly hangup up a channel.
struct timeval ast_samp2tv(unsigned int _nsamp, unsigned int _rate)
Returns a timeval corresponding to the duration of n samples at rate r. Useful to convert samples to ...
Private Bridging Channel API.
struct ast_frame * ast_read_stream_noaudio(struct ast_channel *chan)
Reads a frame, but does not filter to just the default streams, returning AST_FRAME_NULL frame if aud...
struct ast_bridge_hook_dtmf_parms dtmf
void ast_bridge_channel_update_linkedids(struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
#define ast_strdupa(s)
duplicate a string in memory from the stack
int ast_alertpipe_init(int alert_pipe[2])
Initialize an alert pipe.
void bridge_channel_queue_deferred_frames(struct ast_bridge_channel *bridge_channel)
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.
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
struct timeval interdigit_timeout
static void bridge_channel_destroy(void *obj)
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
int ast_app_exec_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char *macro_args)
Run a macro on a channel, placing an optional second channel into autoservice.
int ast_channel_is_t38_active(struct ast_channel *chan)
This function will check if T.38 is active on the channel.
static int sync_ids
Counter used for assigning synchronous bridge action IDs.
Core PBX routines and definitions.
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
int ast_channel_is_leaving_bridge(struct ast_channel *chan)
Determine if a channel is leaving a bridge, but not hung up.
struct ast_heap * interval_hooks
static void bridge_channel_suspend(struct ast_bridge_channel *bridge_channel)
void ast_bridge_channel_feature_digit_add(struct ast_bridge_channel *bridge_channel, int digit)
Add a DTMF digit to the collected digits.
struct ast_format * write_format
int bridge_channel_internal_push_full(struct ast_bridge_channel *bridge_channel, int optimized)
#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.
void ast_bridge_features_merge(struct ast_bridge_features *into, const struct ast_bridge_features *from)
Merge one ast_bridge_features into another.
#define ast_bridge_channel_unlock(bridge_channel)
Unlock the bridge_channel.
const struct ast_bridge_methods * v_table
static void after_bridge_move_channel_fail(enum ast_bridge_after_cb_reason reason, void *data)
unsigned int dtmf_passthrough
struct ast_vector_int to_channel
#define AST_OPTION_DIGIT_DETECT
Structure that contains information about a bridge.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
ast_alert_status_t ast_alertpipe_read(int alert_pipe[2])
Read an event from an alert pipe.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
void bridge_merge_inhibit_nolock(struct ast_bridge *bridge, int request)
#define ao2_unlink(container, obj)
List holding active synchronous action objects.
int ast_channel_connected_line_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *connected_info, int frame)
Run a connected line interception subroutine and update a channel's connected line information...
ast_bridge_hook_callback callback
void bridge_channel_internal_pull(struct ast_bridge_channel *bridge_channel)
const char * ast_msg_data_get_attribute(struct ast_msg_data *msg, enum ast_msg_data_attribute_type attribute_type)
Get attribute from ast_msg_data.
static int payload_helper_app(ast_bridge_channel_post_action_data post_it, struct ast_bridge_channel *bridge_channel, const char *app_name, const char *app_args, const char *moh_class)
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
Connected Line/Party information.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
struct sla_ringing_trunk * first
static void after_bridge_move_channel(struct ast_channel *chan_bridged, void *data)
#define ast_strndup(str, len)
A wrapper for strndup()
enum ast_frame_read_action action
const char * app_name(struct ast_app *app)
#define ao2_iterator_next(iter)
#define ast_cond_destroy(cond)
#define ao2_alloc(data_size, destructor_fn)
#define AST_LIST_LAST(head)
Returns the last entry contained in a list.
struct ast_format * read_format
void ast_bridge_publish_enter(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap)
Publish a bridge channel enter event.
struct ast_bridge_channel::@232 owed
static void bridge_channel_poke(struct ast_bridge_channel *bridge_channel)
void ast_channel_publish_dial_forward(struct ast_channel *caller, struct ast_channel *peer, struct ast_channel *forwarded, const char *dialstring, const char *dialstatus, const char *forward)
Publish in the ast_channel_topic or ast_channel_topic_all topics a stasis message for the channels in...
int ast_bridge_channel_write_playfile(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class)
Write a bridge action play file frame into the bridge.
const char * ast_channel_peeraccount(const struct ast_channel *chan)
#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.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
struct ast_bridge_features * ast_channel_feature_hooks_get(struct ast_channel *chan)
Gets the channel-attached features a channel has access to upon being bridged.
int ast_parking_provider_registered(void)
Check whether a parking provider is registered.
#define ast_channel_unlock(chan)
#define ast_bridge_unlock(bridge)
Unlock the bridge.
static void bridge_channel_attended_transfer(struct ast_bridge_channel *bridge_channel, const char *target_chan_name)
static void channel_fill_empty_peeraccount(struct ast_channel *dest, struct ast_channel *src)
unsigned int inhibit_colp
int bridge_channel_internal_queue_attended_transfer(struct ast_channel *transferee, struct ast_channel *unbridged_chan)
struct ast_bridge_channel::@231 deferred_queue
struct bridge_sync::@354 list
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.
#define AST_OPTION_AUDIO_MODE
struct ast_bridge_hook_timer_parms timer
int ast_sem_init(struct ast_sem *sem, int pshared, unsigned int value)
Initialize a semaphore.
int ast_bridge_channel_write_park(struct ast_bridge_channel *bridge_channel, const char *parkee_uuid, const char *parker_uuid, const char *app_data)
Have a bridge channel park a channel in the bridge.
int ast_parking_park_bridge_channel(struct ast_bridge_channel *parkee, const char *parkee_uuid, const char *parker_uuid, const char *app_data)
Perform a direct park on a channel in a bridge.
void ast_channel_end_dtmf(struct ast_channel *chan, char digit, struct timeval start, const char *why)
Simulate a DTMF end on a broken bridge channel.
#define ao2_find(container, arg, flags)
static int request(void *obj)
struct ast_channel * swap
void ast_bridge_features_remove(struct ast_bridge_features *features, enum ast_bridge_hook_remove_flags flags)
Remove marked bridge channel feature hooks.
static void bridge_channel_cancel_owed_events(struct ast_bridge_channel *bridge_channel)
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.
struct ast_bridge_hook generic
#define ast_clear_flag(p, flag)
void bridge_channel_internal_unsuspend_nolock(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.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
static void bridge_channel_handle_write(struct ast_bridge_channel *bridge_channel)
const ast_string_field automon
#define ast_bridge_lock(bridge)
Lock the bridge.
struct ast_frame ast_null_frame
struct timeval ast_channel_sending_dtmf_tv(const struct ast_channel *chan)
void ast_channel_internal_copy_linkedid(struct ast_channel *dest, struct ast_channel *source)
Copy the full linkedid channel id structure from one channel to another.
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
struct ast_bridge_channels_list channels
#define AST_RWLIST_INSERT_TAIL
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
void bridge_dissolve(struct ast_bridge *bridge, int cause)
struct ast_channel * chan
void * ast_heap_remove(struct ast_heap *h, void *elm)
Remove a specific element from a heap.
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.
#define AST_OPTION_FAX_DETECT
const ast_string_field blindxfer
After Bridge Execution API.
#define ast_channel_ref(c)
Increase channel reference count.
void bridge_channel_impart_signal(struct ast_channel *chan)
Signal imparting threads to wake up.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
static void bridge_channel_park(struct ast_bridge_channel *bridge_channel, struct bridge_park *payload)
int ast_channel_hangupcause(const struct ast_channel *chan)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
bridge_channel_action_type
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...
ast_app: A registered application
struct ao2_container * other_hooks
int ast_bridge_channel_write_hold(struct ast_bridge_channel *bridge_channel, const char *moh_class)
Write a hold frame into the bridge.
const char * ast_channel_name(const struct ast_channel *chan)
static void testsuite_notify_feature_success(struct ast_channel *chan, const char *dtmf)
void ast_bridge_channel_update_accountcodes(struct ast_bridge_channel *joining, struct ast_bridge_channel *leaving)
static int payload_helper_cb(ast_bridge_channel_post_action_data post_it, 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)
char exten[AST_MAX_EXTENSION]
static int bridge_channel_write_dtmf_stream(struct ast_bridge_channel *bridge_channel, const char *dtmf)
static int bridge_channel_queue_action_data_sync(struct ast_bridge_channel *bridge_channel, enum bridge_channel_action_type action, const void *data, size_t datalen)
int ast_async_goto(struct ast_channel *chan, const char *context, const char *exten, int priority)
Set the channel to next execute the specified dialplan location.
int ast_answer(struct ast_channel *chan)
Answer a channel.
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame with payload.
struct ast_vector_int media_types
int ast_is_deferrable_frame(const struct ast_frame *frame)
Should we keep this frame for later?
char context[AST_MAX_CONTEXT]
int ast_bridge_channel_queue_playfile_sync(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class)
Synchronously queue a bridge action play file frame onto the bridge channel.
void * ast_heap_peek(struct ast_heap *h, unsigned int index)
Peek at an element on a heap.
#define AST_OPTION_FLAG_REQUEST
Data structure associated with a single frame of data.
int ast_app_exec_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const char *sub_args, int ignore_hangup)
Run a subroutine on a channel, placing an optional second channel into autoservice.
Internal Asterisk hangup causes.
Abstract JSON element (object, array, string, int, ...).
static void bridge_sync_cleanup(struct bridge_sync *sync_struct)
Clean up a syncrhonization bridge object.
int ast_channel_unbridged(struct ast_channel *chan)
This function will check if the bridge needs to be re-evaluated due to external changes.
#define AST_OPTION_TONE_VERIFY
static void bridge_channel_update_accountcodes_joining(struct ast_bridge_channel *joining, struct ast_bridge_channel *swap)
Synchronous bridge action object.
void ast_bridge_channel_playfile(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class)
Play a file on the bridge channel.
void(* transfer_channel_cb)(struct ast_channel *chan, struct transfer_channel_data *user_data, enum ast_transfer_type transfer_type)
Callback function type called during blind transfers.
ast_bridge_pull_channel_fn pull
ast_bridge_push_channel_fn push
union ast_frame::@263 data
unsigned int interval_sequence
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
void ast_stream_topology_map(const struct ast_stream_topology *topology, struct ast_vector_int *types, struct ast_vector_int *v0, struct ast_vector_int *v1)
Map a given topology's streams to the given types.
enum ast_frame_type frametype
static void bridge_sync_signal(struct bridge_sync *sync_struct)
Signal that waiting for a synchronous bridge action is no longer necessary.
static void bridge_frame_free(struct ast_frame *frame)
static void bridge_channel_playfile(struct ast_bridge_channel *bridge_channel, struct bridge_playfile *payload)
static char context[AST_MAX_CONTEXT]
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
int ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to the head of a channel's frame queue.
struct ast_app * pbx_findapp(const char *app)
Look up an application.
void(* unsuspend)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
Unsuspend a channel on a bridging technology instance for a bridge.
int ast_bridge_channel_queue_control_data(struct ast_bridge_channel *bridge_channel, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame onto the bridge channel with data.
#define DEBUG_ATLEAST(level)
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
struct ast_party_connected_line * ast_channel_connected_indicated(struct ast_channel *chan)
ast_bridge_channel_custom_callback_option
void bridge_channel_settle_owed_events(struct ast_bridge *orig_bridge, struct ast_bridge_channel *bridge_channel)
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
struct ast_featuremap_config * ast_get_chan_featuremap_config(struct ast_channel *chan)
Get the featuremap configuration options for a channel.
static void bridge_channel_handle_action(struct ast_bridge_channel *bridge_channel, enum bridge_channel_action_type action, void *data)
static void channel_update_peeraccounts(struct ast_channel *c0, struct ast_channel *c1)
const ast_string_field parkcall
const ast_string_field automixmon
void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel)
Lock the bridge associated with the bridge channel.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct ast_party_id priv
Private connected party ID.
char code[MAXIMUM_DTMF_FEATURE_STRING]
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
Structure that is the essence of a feature hook.
unsigned int num_channels
static void bridge_channel_unsuspend(struct ast_bridge_channel *bridge_channel)
static void bridge_channel_handle_feature_timeout(struct ast_bridge_channel *bridge_channel)
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
const ast_string_field disconnect
Timing source management.
#define ast_heap_wrlock(h)
void ast_channel_set_unbridged(struct ast_channel *chan, int value)
Sets the unbridged flag and queues a NULL frame on the channel to trigger a check by bridge_channel_w...
int ast_channel_redirecting_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *redirecting_info, int is_caller, int is_frame)
Run a redirecting interception macro and update a channel's redirecting information.
static int bridge_channel_feature_timeout(struct ast_bridge_channel *bridge_channel)
static int bridge_channel_next_timeout(struct ast_bridge_channel *bridge_channel)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
struct ast_channel * ast_channel_internal_oldest_linkedid(struct ast_channel *a, struct ast_channel *b)
Determine which channel has an older linkedid.
static int bridge_channel_feature_digit_add(struct ast_bridge_channel *bridge_channel, int digit, size_t dtmf_len)
int ast_sendtext(struct ast_channel *chan, const char *text)
Sends text to a channel.
static struct ast_frame * bridge_handle_dtmf(struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
Internal function to handle DTMF from a channel.
int bridge_channel_internal_allows_optimization(struct ast_bridge_channel *bridge_channel)