Asterisk - The Open Source Telephony Project
21.4.1
|
Bridging Channel API. More...
#include "asterisk.h"
#include <signal.h>
#include "asterisk/heap.h"
#include "asterisk/alertpipe.h"
#include "asterisk/astobj2.h"
#include "asterisk/stringfields.h"
#include "asterisk/app.h"
#include "asterisk/pbx.h"
#include "asterisk/channel.h"
#include "asterisk/timing.h"
#include "asterisk/bridge.h"
#include "asterisk/bridge_channel.h"
#include "asterisk/bridge_after.h"
#include "asterisk/bridge_channel_internal.h"
#include "asterisk/bridge_internal.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/musiconhold.h"
#include "asterisk/features_config.h"
#include "asterisk/parking.h"
#include "asterisk/causes.h"
#include "asterisk/test.h"
#include "asterisk/sem.h"
#include "asterisk/stream.h"
#include "asterisk/message.h"
#include "asterisk/core_local.h"
Go to the source code of this file.
Data Structures | |
struct | blind_transfer_data |
Data specifying where a blind transfer is going to. More... | |
struct | bridge_custom_callback |
struct | bridge_park |
struct | bridge_playfile |
struct | bridge_run_app |
struct | bridge_sync |
Synchronous bridge action object. More... | |
struct | sync_payload |
Frame payload for synchronous bridge actions. More... | |
struct | sync_structs |
List holding active synchronous action objects. More... | |
Macros | |
#define | PLAYBACK_TIMEOUT (600 * 1000) |
Failsafe for synchronous bridge action waiting. More... | |
Typedefs | |
typedef 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. More... | |
Functions | |
static void | after_bridge_move_channel (struct ast_channel *chan_bridged, void *data) |
static void | after_bridge_move_channel_fail (enum ast_bridge_after_cb_reason reason, void *data) |
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. More... | |
void | ast_bridge_channel_feature_digit_add (struct ast_bridge_channel *bridge_channel, int digit) |
Add a DTMF digit to the collected digits. More... | |
struct ast_channel * | ast_bridge_channel_get_chan (struct ast_bridge_channel *bridge_channel) |
Get a ref to the bridge_channel's ast_channel. More... | |
void | ast_bridge_channel_kick (struct ast_bridge_channel *bridge_channel, int cause) |
Kick the channel out of the bridge. More... | |
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). More... | |
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). More... | |
void | ast_bridge_channel_lock_bridge (struct ast_bridge_channel *bridge_channel) |
Lock the bridge associated with the bridge channel. More... | |
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. More... | |
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. More... | |
struct ast_bridge_channel * | ast_bridge_channel_peer (struct ast_bridge_channel *bridge_channel) |
Get the peer bridge channel of a two party bridge. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int | ast_bridge_channel_queue_frame (struct ast_bridge_channel *bridge_channel, struct ast_frame *fr) |
Write a frame to the specified bridge_channel. More... | |
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. More... | |
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. More... | |
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_join. More... | |
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. More... | |
void | ast_bridge_channel_stream_map (struct ast_bridge_channel *bridge_channel) |
Maps a channel's stream topology to and from the bridge. More... | |
void | ast_bridge_channel_update_accountcodes (struct ast_bridge_channel *joining, struct ast_bridge_channel *leaving) |
void | ast_bridge_channel_update_linkedids (struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap) |
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. More... | |
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. More... | |
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. More... | |
int | ast_bridge_channel_write_hold (struct ast_bridge_channel *bridge_channel, const char *moh_class) |
Write a hold frame into the bridge. More... | |
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. More... | |
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. More... | |
int | ast_bridge_channel_write_unhold (struct ast_bridge_channel *bridge_channel) |
Write an unhold frame into the bridge. More... | |
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. More... | |
static void | bridge_channel_attended_transfer (struct ast_bridge_channel *bridge_channel, const char *target_chan_name) |
static void | bridge_channel_blind_transfer (struct ast_bridge_channel *bridge_channel, struct blind_transfer_data *blind_data) |
static void | bridge_channel_cancel_owed_events (struct ast_bridge_channel *bridge_channel) |
static void | bridge_channel_destroy (void *obj) |
static void | bridge_channel_dissolve_check (struct ast_bridge_channel *bridge_channel) |
static void | bridge_channel_do_callback (struct ast_bridge_channel *bridge_channel, struct bridge_custom_callback *data) |
static void | bridge_channel_dtmf_stream (struct ast_bridge_channel *bridge_channel, const char *dtmf) |
static void | bridge_channel_event_join_leave (struct ast_bridge_channel *bridge_channel, enum ast_bridge_hook_type type) |
static int | bridge_channel_feature_digit_add (struct ast_bridge_channel *bridge_channel, int digit, size_t dtmf_len) |
static unsigned int | bridge_channel_feature_digit_timeout (struct ast_bridge_channel *bridge_channel) |
static int | bridge_channel_feature_timeout (struct ast_bridge_channel *bridge_channel) |
static void | bridge_channel_handle_action (struct ast_bridge_channel *bridge_channel, enum bridge_channel_action_type action, void *data) |
static void | bridge_channel_handle_control (struct ast_bridge_channel *bridge_channel, struct ast_frame *fr) |
static void | bridge_channel_handle_feature_timeout (struct ast_bridge_channel *bridge_channel) |
static void | bridge_channel_handle_interval (struct ast_bridge_channel *bridge_channel) |
static void | bridge_channel_handle_write (struct ast_bridge_channel *bridge_channel) |
struct ast_bridge_channel * | bridge_channel_internal_alloc (struct ast_bridge *bridge) |
int | bridge_channel_internal_allows_optimization (struct ast_bridge_channel *bridge_channel) |
int | bridge_channel_internal_join (struct ast_bridge_channel *bridge_channel) |
void | bridge_channel_internal_pull (struct ast_bridge_channel *bridge_channel) |
int | bridge_channel_internal_push (struct ast_bridge_channel *bridge_channel) |
int | bridge_channel_internal_push_full (struct ast_bridge_channel *bridge_channel, int optimized) |
int | bridge_channel_internal_queue_attended_transfer (struct ast_channel *transferee, struct ast_channel *unbridged_chan) |
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) |
void | bridge_channel_internal_suspend_nolock (struct ast_bridge_channel *bridge_channel) |
void | bridge_channel_internal_unsuspend_nolock (struct ast_bridge_channel *bridge_channel) |
static int | bridge_channel_next_interval (struct ast_bridge_channel *bridge_channel) |
static int | bridge_channel_next_timeout (struct ast_bridge_channel *bridge_channel) |
static void | bridge_channel_park (struct ast_bridge_channel *bridge_channel, struct bridge_park *payload) |
static void | bridge_channel_playfile (struct ast_bridge_channel *bridge_channel, struct bridge_playfile *payload) |
static void | bridge_channel_poke (struct ast_bridge_channel *bridge_channel) |
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) |
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) |
void | bridge_channel_queue_deferred_frames (struct ast_bridge_channel *bridge_channel) |
static void | bridge_channel_run_app (struct ast_bridge_channel *bridge_channel, struct bridge_run_app *data) |
void | bridge_channel_settle_owed_events (struct ast_bridge *orig_bridge, struct ast_bridge_channel *bridge_channel) |
static void | bridge_channel_suspend (struct ast_bridge_channel *bridge_channel) |
static void | bridge_channel_talking (struct ast_bridge_channel *bridge_channel, int talking) |
static void | bridge_channel_unsuspend (struct ast_bridge_channel *bridge_channel) |
static void | bridge_channel_update_accountcodes_joining (struct ast_bridge_channel *joining, struct ast_bridge_channel *swap) |
static void | bridge_channel_update_accountcodes_leaving (struct ast_bridge_channel *leaving) |
static void | bridge_channel_wait (struct ast_bridge_channel *bridge_channel) |
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) |
static int | bridge_channel_write_dtmf_stream (struct ast_bridge_channel *bridge_channel, const char *dtmf) |
static int | bridge_channel_write_frame (struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) |
static void | bridge_frame_free (struct ast_frame *frame) |
static struct ast_frame * | bridge_handle_dtmf (struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) |
static void | bridge_handle_trip (struct ast_bridge_channel *bridge_channel) |
static void | bridge_sync_cleanup (struct bridge_sync *sync_struct) |
Clean up a synchronization bridge object. More... | |
static void | bridge_sync_init (struct bridge_sync *sync_struct, unsigned int id) |
Initialize a synchronous bridge object. More... | |
static void | bridge_sync_signal (struct bridge_sync *sync_struct) |
Signal that waiting for a synchronous bridge action is no longer necessary. More... | |
static void | bridge_sync_wait (struct bridge_sync *sync_struct) |
Wait for a synchronous bridge action to complete. More... | |
static void | channel_fill_empty_accountcode (struct ast_channel *dest, struct ast_channel *src) |
static void | channel_fill_empty_peeraccount (struct ast_channel *dest, struct ast_channel *src) |
static int | channel_set_cause (struct ast_channel *chan, int cause) |
static void | channel_set_empty_accountcodes (struct ast_channel *c0, struct ast_channel *c1) |
static void | channel_update_peeraccount (struct ast_channel *dest, struct ast_channel *src) |
static void | channel_update_peeraccounts (struct ast_channel *c0, struct ast_channel *c1) |
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) |
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) |
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) |
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 int | run_app_helper (struct ast_channel *chan, const char *app_name, const char *app_args) |
static void | sendtext_safe (struct ast_channel *chan, const struct ast_frame *f) |
static void | testsuite_notify_feature_success (struct ast_channel *chan, const char *dtmf) |
Variables | |
static const char * | controls [] |
static int | sync_ids |
Counter used for assigning synchronous bridge action IDs. | |
static struct sync_structs | sync_structs = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
Bridging Channel API.
Definition in file bridge_channel.c.
#define PLAYBACK_TIMEOUT (600 * 1000) |
Failsafe for synchronous bridge action waiting.
When waiting for a synchronous bridge action to complete, if there is a frame resource leak somewhere, it is possible that we will never get notified that the synchronous action completed.
If a significant amount of time passes, then we will abandon waiting for the synchrnous bridge action to complete.
This constant represents the number of milliseconds we will wait for the bridge action to complete.
Definition at line 179 of file bridge_channel.c.
Referenced by bridge_sync_wait().
typedef 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.
bridge_channel | Which channel work with. |
action | Type of bridge action frame. |
data | Frame payload data to pass. |
datalen | Frame payload data length to pass. |
0 | on success. |
-1 | on error. |
Definition at line 74 of file bridge_channel.c.
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.
bridge_channel | Channel that received a DTMF digit. |
digit | DTMF digit to add to collected digits or 0 for timeout event. |
Definition at line 1695 of file bridge_channel.c.
References ao2_ref, ao2_unlink, ast_bridge_channel_kick(), ast_bridge_channel_lock_bridge(), ast_bridge_unlock, AST_CONTROL_SRCUPDATE, ast_debug, ast_indicate(), ast_samp2tv(), ast_test_suite_event_notify, ast_tvadd(), ast_tvnow(), ast_bridge_channel::bridge, ast_bridge_hook::callback, ast_bridge_channel::chan, ast_bridge_hook_dtmf_parms::code, ast_bridge_channel::collected, ast_bridge_hook_dtmf::dtmf, ast_bridge_channel::dtmf_hook_state, ast_bridge_features::dtmf_hooks, ast_bridge_features::dtmf_passthrough, ast_bridge_channel::features, ast_bridge_hook_dtmf::generic, ast_bridge_hook::hook_pvt, ast_bridge_channel::interdigit_timeout, OBJ_SEARCH_PARTIAL_KEY, and ast_bridge_channel::suspended.
void ast_bridge_channel_feature_digit_add | ( | struct ast_bridge_channel * | bridge_channel, |
int | digit | ||
) |
Add a DTMF digit to the collected digits.
bridge_channel | Channel that received a DTMF digit. |
digit | DTMF digit to add to collected digits |
Definition at line 1687 of file bridge_channel.c.
References ast_bridge_channel::collected, and ast_bridge_channel::dtmf_hook_state.
Referenced by play_file().
struct ast_channel* ast_bridge_channel_get_chan | ( | struct ast_bridge_channel * | bridge_channel | ) |
Get a ref to the bridge_channel's ast_channel.
bridge_channel | The bridge channel |
ref'd | ast_channel on success |
NULL | otherwise |
Definition at line 212 of file bridge_channel.c.
References ao2_bump, and ast_bridge_channel::chan.
Referenced by ast_bridge_channel_write_unhold().
void ast_bridge_channel_kick | ( | struct ast_bridge_channel * | bridge_channel, |
int | cause | ||
) |
Kick the channel out of the bridge.
bridge_channel | Which channel is being kicked or hungup. |
cause | Cause of channel being kicked. If cause <= 0 then use cause on channel if cause still <= 0 use AST_CAUSE_NORMAL_CLEARING. |
Definition at line 592 of file bridge_channel.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_ref, ao2_unlink, ast_bridge_channel_leave_bridge(), ast_bridge_channel_lock, ast_bridge_channel_unlock, ast_debug, BRIDGE_CHANNEL_STATE_END, BRIDGE_CHANNEL_STATE_WAIT, ast_bridge_hook::callback, ast_bridge_channel::chan, ast_bridge_channel::features, ast_bridge_hook::hook_pvt, ast_bridge_features::other_hooks, ast_bridge_channel::state, and ast_bridge_hook::type.
Referenced by ast_bridge_channel_feature_digit(), and ast_bridge_channel_run_app().
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).
bridge_channel | Channel to change the state on |
new_state | The new state to place the channel into |
cause | Cause of channel leaving bridge. If cause <= 0 then use cause on channel if cause still <= 0 use AST_CAUSE_NORMAL_CLEARING. |
Example usage:
This places the channel pointed to by bridge_channel into the state BRIDGE_CHANNEL_STATE_END if it was BRIDGE_CHANNEL_STATE_WAIT before.
Definition at line 315 of file bridge_channel.c.
References ast_bridge_channel_leave_bridge_nolock(), ast_bridge_channel_lock, and ast_bridge_channel_unlock.
Referenced by ast_bridge_channel_kick(), ast_bridge_depart(), ast_bridge_remove(), bridge_agent_hold_push(), feature_hangup(), and say_parking_space().
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).
bridge_channel | Channel to change the state on |
new_state | The new state to place the channel into |
cause | Cause of channel leaving bridge. If cause <= 0 then use cause on channel if cause still <= 0 use AST_CAUSE_NORMAL_CLEARING. |
Example usage:
This places the channel pointed to by bridge_channel into the state BRIDGE_CHANNEL_STATE_END if it was BRIDGE_CHANNEL_STATE_WAIT before.
Definition at line 293 of file bridge_channel.c.
References ast_bridge_vars_set(), ast_debug, BRIDGE_CHANNEL_STATE_WAIT, ast_bridge_channel::chan, and ast_bridge_channel::state.
Referenced by ast_bridge_channel_leave_bridge().
void ast_bridge_channel_lock_bridge | ( | struct ast_bridge_channel * | bridge_channel | ) |
Lock the bridge associated with the bridge channel.
bridge_channel | Channel that wants to lock the bridge. |
This is an upstream lock operation. The defined locking order is bridge then bridge_channel.
Definition at line 223 of file bridge_channel.c.
References ao2_ref, ast_bridge_channel_lock, ast_bridge_channel_unlock, ast_bridge_lock, ast_bridge_unlock, and ast_bridge_channel::bridge.
Referenced by ast_bridge_channel_feature_digit(), ast_bridge_channel_merge_inhibit(), ast_bridge_notify_masquerade(), and check_binaural_position_change().
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.
bridge_channel | What to operate on. |
request | Inhibit request increment. (Positive to add requests. Negative to remove requests.) |
bridge | adjusted merge inhibit with reference count. |
Definition at line 370 of file bridge_channel.c.
References ao2_ref, ast_bridge_channel_lock_bridge(), ast_bridge_unlock, and ast_bridge_channel::bridge.
Referenced by feature_attended_transfer().
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.
bridge_channel | The bridge channel that has either started or stopped talking. |
started_talking | set to 1 when this indicates the channel has started talking set to 0 when this indicates the channel has stopped talking. |
0 | on success. |
-1 | on error. |
Definition at line 245 of file bridge_channel.c.
References ast_bridge_channel_queue_frame(), AST_FRAME_BRIDGE_ACTION, BRIDGE_CHANNEL_ACTION_TALKING_START, BRIDGE_CHANNEL_ACTION_TALKING_STOP, and ast_frame::frametype.
struct ast_bridge_channel* ast_bridge_channel_peer | ( | struct ast_bridge_channel * | bridge_channel | ) |
Get the peer bridge channel of a two party bridge.
bridge_channel | What to get the peer of. |
peer | on success. |
NULL | no peer channel. |
Definition at line 322 of file bridge_channel.c.
References AST_LIST_TRAVERSE, ast_bridge_channel::bridge, ast_bridge::channels, ast_bridge_channel::in_bridge, and ast_bridge::num_channels.
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.
bridge_channel | Which channel to play the file on |
custom_play | Call this function to play the playfile. (NULL if normal sound file to play) |
playfile | Sound filename to play. |
moh_class | MOH class to request bridge peers to hear while file is played. NULL if no MOH. Empty if default MOH class. |
Definition at line 1262 of file bridge_channel.c.
References ast_bridge_channel_write_hold(), ast_bridge_channel_write_unhold(), AST_DIGIT_NONE, AST_FLAG_MOH, ast_moh_start(), ast_strdupa, ast_stream_and_wait(), and ast_bridge_channel::chan.
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.
bridge_channel | Which channel to put the frame onto |
app_name | Dialplan application name. |
app_args | Arguments for the application. (NULL or empty for no arguments) |
moh_class | MOH class to request bridge peers to hear while application is running. NULL if no MOH. Empty if default MOH class. |
0 | on success. |
-1 | on error. |
Definition at line 1256 of file bridge_channel.c.
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.
bridge_channel | Which channel to put the frame onto. |
flags | Custom callback option flags. |
callback | Custom callback run on a bridge channel. |
payload | Data to pass to the callback. (NULL if none). |
payload_size | Size of the payload if payload is non-NULL. A number otherwise. |
0 | on success. |
-1 | on error. |
Definition at line 1429 of file bridge_channel.c.
Referenced by ast_bridge_kick().
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.
bridge_channel | Which channel to queue the frame onto. |
control | Type of control frame. |
data | Frame payload data to pass. |
datalen | Frame payload data length to pass. |
0 | on success. |
-1 | on error. |
Definition at line 1104 of file bridge_channel.c.
References ast_bridge_channel_queue_frame(), AST_FRAME_CONTROL, ast_frame::datalen, and ast_frame::frametype.
int ast_bridge_channel_queue_frame | ( | struct ast_bridge_channel * | bridge_channel, |
struct ast_frame * | fr | ||
) |
Write a frame to the specified bridge_channel.
bridge_channel | Channel to queue the frame. |
fr | Frame to write. |
0 | on success. |
-1 | on error. |
Definition at line 1005 of file bridge_channel.c.
References ast_bridge_channel::alert_pipe, ast_alertpipe_write(), ast_bridge_channel_lock, ast_bridge_channel_unlock, AST_FRAME_DTMF_BEGIN, AST_FRAME_DTMF_END, AST_FRAME_IMAGE, AST_FRAME_NULL, AST_FRAME_RTCP, AST_FRAME_TEXT, AST_FRAME_TEXT_DATA, AST_FRAME_VIDEO, AST_FRAME_VOICE, ast_frdup, ast_is_deferrable_frame(), AST_LIST_INSERT_TAIL, ast_msg_data_get_attribute(), AST_VECTOR_GET, AST_VECTOR_SIZE, BRIDGE_CHANNEL_STATE_WAIT, ast_bridge_channel::chan, ast_frame::data, ast_frame::datalen, ast_bridge_channel::features, ast_frame::frametype, ast_bridge_channel::state, ast_frame::stream_num, ast_bridge_channel::suspended, ast_bridge_features::text_messaging, ast_bridge_channel::to_channel, and ast_bridge_channel::wr_queue.
Referenced by ast_bridge_channel_notify_talking(), ast_bridge_channel_queue_control_data(), ast_bridge_queue_everyone_else(), and softmix_mixing_loop().
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.
bridge_channel | Which channel to put the frame onto. |
custom_play | Call this function to play the playfile. (NULL if normal sound file to play) |
playfile | Sound filename to play. |
moh_class | MOH class to request bridge peers to hear while file is played. NULL if no MOH. Empty if default MOH class. |
0 | on success. |
-1 | on error. |
Definition at line 1343 of file bridge_channel.c.
Referenced by ast_bridge_add_channel(), and play_sound().
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.
bridge_channel | Which channel to put the frame onto. |
custom_play | Call this function to play the playfile. (NULL if normal sound file to play) |
playfile | Sound filename to play. |
moh_class | MOH class to request bridge peers to hear while file is played. NULL if no MOH. Empty if default MOH class. |
This function will block until the queued frame has been destroyed. This will happen either if an error occurs or if the queued playback finishes.
0 | The playback was successfully queued. |
-1 | The playback could not be queued. |
Definition at line 1349 of file bridge_channel.c.
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_join.
bridge_channel | Channel to restore |
Definition at line 338 of file bridge_channel.c.
References ast_debug, ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_format_get_name(), ast_set_read_format(), ast_set_write_format(), ast_bridge_channel::chan, ast_bridge_channel::read_format, and ast_bridge_channel::write_format.
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.
bridge_channel | Which channel to run the application on. |
app_name | Dialplan application name. |
app_args | Arguments for the application. (NULL tolerant) |
moh_class | MOH class to request bridge peers to hear while application is running. NULL if no MOH. Empty if default MOH class. |
Definition at line 1184 of file bridge_channel.c.
References ast_bridge_channel_kick(), ast_bridge_channel_write_hold(), ast_bridge_channel_write_unhold(), ast_bridge_channel::chan, and S_OR.
void ast_bridge_channel_stream_map | ( | struct ast_bridge_channel * | bridge_channel | ) |
Maps a channel's stream topology to and from the bridge.
When a channel joins a bridge or its associated stream topology is updated, each stream in the topology needs to be mapped according to its media type to the bridge. Calling this method creates a mapping of each stream on the channel indexed to the bridge's supported media types and vice versa (i.e. bridge's media types indexed to channel streams).
The first channel to join the bridge creates the initial order for the bridge's media types (e.g. a one to one mapping is made). Subsequently added channels are mapped to that order adding more media types if/when the newly added channel has more streams and/or media types specified by the bridge.
bridge_channel | Channel to map |
Definition at line 3119 of file bridge_channel.c.
References ast_bridge_channel_lock, ast_bridge_channel_unlock, ast_channel_get_stream_topology(), ast_stream_topology_map(), ast_bridge_channel::bridge, ast_bridge_channel::chan, ast_bridge::media_types, ast_bridge_channel::to_bridge, and ast_bridge_channel::to_channel.
Referenced by softmix_bridge_stream_topology_changed().
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.
bridge_channel | Which channel is putting the frame into the bridge |
app_name | Dialplan application name. |
app_args | Arguments for the application. (NULL or empty for no arguments) |
moh_class | MOH class to request bridge peers to hear while application is running. NULL if no MOH. Empty if default MOH class. |
0 | on success. |
-1 | on error. |
Definition at line 1250 of file bridge_channel.c.
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.
bridge_channel | Which channel is putting the frame into the bridge |
flags | Custom callback option flags. |
callback | Custom callback run on a bridge channel. |
payload | Data to pass to the callback. (NULL if none). |
payload_size | Size of the payload if payload is non-NULL. A number otherwise. |
0 | on success. |
-1 | on error. |
Definition at line 1421 of file bridge_channel.c.
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.
bridge_channel | Which channel is putting the frame into the bridge. |
control | Type of control frame. |
data | Frame payload data to pass. |
datalen | Frame payload data length to pass. |
0 | on success. |
-1 | on error. |
Definition at line 1116 of file bridge_channel.c.
References AST_FRAME_CONTROL, ast_frame::datalen, and ast_frame::frametype.
Referenced by ast_bridge_channel_write_hold(), ast_bridge_channel_write_unhold(), and ringing().
int ast_bridge_channel_write_hold | ( | struct ast_bridge_channel * | bridge_channel, |
const char * | moh_class | ||
) |
Write a hold frame into the bridge.
bridge_channel | Which channel is putting the hold into the bridge. |
moh_class | The suggested music class for the other end to use. |
0 | on success. |
-1 | on error. |
Definition at line 1128 of file bridge_channel.c.
References ast_bridge_channel_write_control_data(), ast_channel_hold_type(), ast_channel_publish_cached_blob(), AST_CONTROL_HOLD, ast_json_pack(), ast_json_unref(), and ast_bridge_channel::chan.
Referenced by ast_bridge_channel_playfile(), ast_bridge_channel_run_app(), feature_attended_transfer(), feature_blind_transfer(), and hold().
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.
bridge_channel | Bridge channel performing the parking |
parkee_uuid | Unique id of the channel we want to park |
parker_uuid | Unique id of the channel parking the call |
app_data | string indicating data used for park application (NULL allowed) |
0 | on success. |
-1 | on error. |
Definition at line 1492 of file bridge_channel.c.
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.
bridge_channel | Which channel is putting the frame into the bridge |
custom_play | Call this function to play the playfile. (NULL if normal sound file to play) |
playfile | Sound filename to play. |
moh_class | MOH class to request bridge peers to hear while file is played. NULL if no MOH. Empty if default MOH class. |
0 | on success. |
-1 | on error. |
Definition at line 1337 of file bridge_channel.c.
Referenced by ast_bridge_transfer_attended().
int ast_bridge_channel_write_unhold | ( | struct ast_bridge_channel * | bridge_channel | ) |
Write an unhold frame into the bridge.
bridge_channel | Which channel is putting the hold into the bridge. |
0 | on success. |
-1 | on error. |
Definition at line 1154 of file bridge_channel.c.
References ao2_ref, ast_bridge_channel_get_chan(), ast_bridge_channel_write_control_data(), ast_channel_publish_cached_blob(), ast_channel_unhold_type(), and AST_CONTROL_UNHOLD.
Referenced by ast_bridge_channel_playfile(), ast_bridge_channel_run_app(), ast_bridge_transfer_attended(), ast_bridge_transfer_blind(), feature_attended_transfer(), feature_blind_transfer(), and unhold().
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.
bridge | What bridge to distribute frame. |
bridge_channel | Channel to optionally not pass frame to. (NULL to pass to everyone) |
frame | Frame to pass. |
0 | Frame written to at least one channel. |
-1 | Frame written to no channels. |
Definition at line 1083 of file bridge_channel.c.
References ast_bridge_channel_queue_frame(), AST_FRAME_NULL, AST_LIST_TRAVERSE, ast_bridge::channels, and ast_frame::frametype.
Referenced by bridge_hold(), bridge_ringing(), and bridge_unhold().
|
static |
Clean up a synchronization bridge object.
This frees fields within the synchronization object and removes it from the list of active synchronization objects.
Since synchronization objects are stack-allocated, it is vital that this is called before the synchronization object goes out of scope.
sync_struct | Synchronization object to clean up. |
Definition at line 148 of file bridge_channel.c.
References AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_sem_destroy(), bridge_sync::id, bridge_sync::list, and bridge_sync::sem.
|
static |
Initialize a synchronous bridge object.
This both initializes the structure and adds it to the list of synchronization structures.
sync_struct | The synchronization object to initialize. |
id | ID to assign to the synchronization object. |
Definition at line 125 of file bridge_channel.c.
References AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_sem_init(), and bridge_sync::id.
|
static |
Signal that waiting for a synchronous bridge action is no longer necessary.
This may occur for several reasons
sync_struct | Synchronization object corresponding to the bridge action. |
Definition at line 207 of file bridge_channel.c.
References ast_sem_post(), and bridge_sync::sem.
|
static |
Wait for a synchronous bridge action to complete.
sync_struct | Synchronization object corresponding to the bridge action. |
Definition at line 186 of file bridge_channel.c.
References ast_samp2tv(), ast_sem_timedwait(), ast_tvadd(), ast_tvnow(), PLAYBACK_TIMEOUT, and bridge_sync::sem.