Channel Bridging API. More...
#include "asterisk.h"
#include <signal.h>
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/options.h"
#include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "asterisk/linkedlists.h"
#include "asterisk/bridging.h"
#include "asterisk/bridging_technology.h"
#include "asterisk/app.h"
#include "asterisk/file.h"
#include "asterisk/module.h"
#include "asterisk/astobj2.h"
Go to the source code of this file.
Data Structures | |
struct | bridge_technologies |
Macros | |
#define | BRIDGE_ARRAY_GROW 32 |
#define | BRIDGE_ARRAY_START 128 |
Functions | |
int | __ast_bridge_technology_register (struct ast_bridge_technology *technology, struct ast_module *module) |
Register a bridge technology for use. More... | |
void | ast_bridge_change_state (struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_state new_state) |
Change the state of a bridged channel. More... | |
int | ast_bridge_check (enum ast_bridge_capability capabilities) |
See if it is possible to create a bridge. More... | |
int | ast_bridge_depart (struct ast_bridge *bridge, struct ast_channel *chan) |
Depart a channel from a bridge. More... | |
int | ast_bridge_destroy (struct ast_bridge *bridge) |
Destroy a bridge. More... | |
int | ast_bridge_dtmf_stream (struct ast_bridge *bridge, const char *dtmf, struct ast_channel *chan) |
Play a DTMF stream into a bridge, optionally not to a given channel. More... | |
int | ast_bridge_features_cleanup (struct ast_bridge_features *features) |
Clean up the contents of a bridge features structure. More... | |
int | ast_bridge_features_enable (struct ast_bridge_features *features, enum ast_bridge_builtin_feature feature, const char *dtmf, void *config) |
Enable a built in feature on a bridge features structure. More... | |
int | ast_bridge_features_hook (struct ast_bridge_features *features, const char *dtmf, ast_bridge_features_hook_callback callback, void *hook_pvt) |
Attach a custom hook to a bridge features structure. More... | |
int | ast_bridge_features_init (struct ast_bridge_features *features) |
Initialize bridge features structure. More... | |
int | ast_bridge_features_register (enum ast_bridge_builtin_feature feature, ast_bridge_features_hook_callback callback, const char *dtmf) |
Register a handler for a built in feature. More... | |
int | ast_bridge_features_set_flag (struct ast_bridge_features *features, enum ast_bridge_feature_flags flag) |
Set a flag on a bridge features structure. More... | |
int | ast_bridge_features_unregister (enum ast_bridge_builtin_feature feature) |
Unregister a handler for a built in feature. More... | |
void | ast_bridge_handle_trip (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_channel *chan, int outfd) |
Feed notification that a frame is waiting on a channel into the bridging core. More... | |
int | ast_bridge_impart (struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features) |
Impart (non-blocking) a channel on a bridge. More... | |
enum ast_bridge_channel_state | ast_bridge_join (struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features) |
Join (blocking) a channel to a bridge. More... | |
int | ast_bridge_merge (struct ast_bridge *bridge0, struct ast_bridge *bridge1) |
Merge two bridges together. More... | |
struct ast_bridge * | ast_bridge_new (enum ast_bridge_capability capabilities, int flags) |
Create a new bridge. More... | |
int | ast_bridge_remove (struct ast_bridge *bridge, struct ast_channel *chan) |
Remove a channel from a bridge. More... | |
int | ast_bridge_suspend (struct ast_bridge *bridge, struct ast_channel *chan) |
Suspend a channel temporarily from a bridge. More... | |
void | ast_bridge_technology_suspend (struct ast_bridge_technology *technology) |
Suspend a bridge technology from consideration. More... | |
int | ast_bridge_technology_unregister (struct ast_bridge_technology *technology) |
Unregister a bridge technology from use. More... | |
void | ast_bridge_technology_unsuspend (struct ast_bridge_technology *technology) |
Unsuspend a bridge technology. More... | |
int | ast_bridge_unsuspend (struct ast_bridge *bridge, struct ast_channel *chan) |
Unsuspend a channel from a bridge. More... | |
static void | bridge_array_add (struct ast_bridge *bridge, struct ast_channel *chan) |
Helper function to add a channel to the bridge array. More... | |
static void | bridge_array_remove (struct ast_bridge *bridge, struct ast_channel *chan) |
Helper function to remove a channel from the bridge array. More... | |
static void | bridge_channel_dtmf_stream (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Internal function that plays back DTMF on a bridge channel. More... | |
static void | bridge_channel_feature (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Internal function that executes a feature on a bridge channel. More... | |
static enum ast_bridge_channel_state | bridge_channel_join (struct ast_bridge_channel *bridge_channel) |
Join a channel to a bridge and handle anything the bridge may want us to do. More... | |
static enum ast_bridge_channel_state | bridge_channel_join_multithreaded (struct ast_bridge_channel *bridge_channel) |
Run in a multithreaded model. Each joined channel does writing/reading in their own thread. TODO: Improve. More... | |
static enum ast_bridge_channel_state | bridge_channel_join_singlethreaded (struct ast_bridge_channel *bridge_channel) |
Run in a singlethreaded model. Each joined channel yields itself to the main bridge thread. TODO: Improve. More... | |
static void | bridge_channel_suspend (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Internal function that suspends a channel from a bridge. More... | |
static void * | bridge_channel_thread (void *data) |
Thread responsible for imparted bridged channels. More... | |
static void | bridge_channel_unsuspend (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Internal function that unsuspends a channel from a bridge. More... | |
static void | bridge_check_dissolve (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
Internal function to see whether a bridge should dissolve, and if so do it. More... | |
static int | bridge_drop_control_frame (int subclass) |
Internal function used to determine whether a control frame should be dropped or not. More... | |
static struct ast_frame * | bridge_handle_dtmf (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame) |
Internal function to handle DTMF from a channel. More... | |
static int | bridge_make_compatible (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel) |
static void | bridge_poke (struct ast_bridge *bridge) |
Helper function to poke the bridge thread. More... | |
static void * | bridge_thread (void *data) |
Bridge thread function. More... | |
static void | destroy_bridge (void *obj) |
static struct ast_bridge_technology * | find_best_technology (enum ast_bridge_capability capabilities) |
Helper function used to find the "best" bridge technology given a specified capabilities. More... | |
static struct ast_bridge_channel * | find_bridge_channel (struct ast_bridge *bridge, struct ast_channel *chan) |
Helper function to find a bridge channel given a channel. More... | |
static int | generic_thread_loop (struct ast_bridge *bridge) |
Generic thread loop, TODO: Rethink this/improve it. More... | |
static int | smart_bridge_operation (struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, int count) |
Perform the smart bridge operation. Basically sees if a new bridge technology should be used instead of the current one. More... | |
Variables | |
static struct bridge_technologies | bridge_technologies = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, 1 } , } |
static char | builtin_features_dtmf [AST_BRIDGE_BUILTIN_END][MAXIMUM_DTMF_FEATURE_STRING] |
static void * | builtin_features_handlers [AST_BRIDGE_BUILTIN_END] |
Channel Bridging API.
Definition in file bridging.c.
#define BRIDGE_ARRAY_GROW 32 |
Definition at line 55 of file bridging.c.
Referenced by bridge_array_add().
#define BRIDGE_ARRAY_START 128 |
Definition at line 52 of file bridging.c.
Referenced by ast_bridge_new().
int __ast_bridge_technology_register | ( | struct ast_bridge_technology * | technology, |
struct ast_module * | mod | ||
) |
Register a bridge technology for use.
technology | The bridge technology to register |
mod | The module that is registering the bridge technology |
0 | on success |
-1 | on failure |
Example usage:
This registers a bridge technology declared as the structure simple_bridge_tech with the bridging core and makes it available for use when creating bridges.
Definition at line 63 of file bridging.c.
References ast_log(), AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero(), ast_verbose(), ast_bridge_technology::capabilities, LOG_WARNING, ast_bridge_technology::mod, ast_bridge_technology::name, option_verbose, VERBOSE_PREFIX_2, and ast_bridge_technology::write.
void ast_bridge_change_state | ( | struct ast_bridge_channel * | bridge_channel, |
enum ast_bridge_channel_state | new_state | ||
) |
Change the state of a bridged channel.
bridge_channel | Channel to change the state on |
new_state | The new state to place the channel into |
Example usage:
This places the channel pointed to by bridge_channel into the state AST_BRIDGE_CHANNEL_STATE_WAIT.
Definition at line 122 of file bridging.c.
References ast_cond_signal, ast_mutex_lock, ast_mutex_unlock, ast_bridge_channel::cond, ast_bridge_channel::lock, ast_bridge_channel::state, and ast_bridge_channel::thread.
Referenced by ast_bridge_depart(), ast_bridge_destroy(), ast_bridge_dtmf_stream(), ast_bridge_handle_trip(), ast_bridge_remove(), attended_abort_transfer(), attended_threeway_transfer(), bridge_channel_dtmf_stream(), bridge_channel_feature(), bridge_channel_join(), bridge_check_dissolve(), bridge_handle_dtmf(), feature_attended_transfer(), feature_blind_transfer(), and feature_hangup().
int ast_bridge_check | ( | enum ast_bridge_capability | capabilities | ) |
See if it is possible to create a bridge.
capabilities | The capabilities that the bridge will use |
1 | if possible |
0 | if not possible |
Example usage:
This sees if it is possible to create a bridge capable of bridging two channels together.
Definition at line 502 of file bridging.c.
References ast_module_unref(), find_best_technology(), and ast_bridge_technology::mod.
int ast_bridge_depart | ( | struct ast_bridge * | bridge, |
struct ast_channel * | chan | ||
) |
Depart a channel from a bridge.
bridge | Bridge to depart from |
chan | Channel to depart |
0 | on success |
-1 | on failure |
Example usage:
This removes the channel pointed to by the chan pointer from the bridge pointed to by the bridge pointer and gives control to the calling thread. This does not hang up the channel.
Definition at line 1077 of file bridging.c.
References ao2_lock, ao2_unlock, ast_bridge_change_state(), AST_BRIDGE_CHANNEL_STATE_DEPART, find_bridge_channel(), ast_bridge_channel::thread, and thread.
Referenced by feature_attended_transfer(), and play_sound_file().
int ast_bridge_destroy | ( | struct ast_bridge * | bridge | ) |
Destroy a bridge.
bridge | Bridge to destroy |
0 | on success |
-1 | on failure |
Example usage:
This destroys a bridge that was previously created using ast_bridge_new.
Definition at line 515 of file bridging.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_bridge_change_state(), AST_BRIDGE_CHANNEL_STATE_END, ast_debug, AST_LIST_TRAVERSE, AST_PTHREADT_NULL, bridge_poke(), ast_bridge::stop, ast_bridge::thread, and thread.
Referenced by ast_bridge_new(), destroy_conference_bridge(), and feature_attended_transfer().
int ast_bridge_dtmf_stream | ( | struct ast_bridge * | bridge, |
const char * | dtmf, | ||
struct ast_channel * | chan | ||
) |
Play a DTMF stream into a bridge, optionally not to a given channel.
bridge | Bridge to play stream into |
dtmf | DTMF to play |
chan | Channel to optionally not play to |
0 | on success |
-1 | on failure |
Example usage:
This sends the DTMF digits '0123456789' to all channels in the bridge pointed to by the bridge pointer. Optionally a channel may be excluded by passing it's channel pointer using the chan parameter.
Definition at line 1345 of file bridging.c.
References ao2_lock, ao2_unlock, ast_bridge_change_state(), AST_BRIDGE_CHANNEL_STATE_DTMF, ast_copy_string(), AST_LIST_TRAVERSE, ast_bridge_channel::chan, and ast_bridge_channel::dtmf_stream_q.
Referenced by bridge_channel_feature().
int ast_bridge_features_cleanup | ( | struct ast_bridge_features * | features | ) |
Clean up the contents of a bridge features structure.
features | Bridge features structure |
0 | on success |
-1 | on failure |
Example usage:
This cleans up the feature structure 'features'.
Definition at line 1333 of file bridging.c.
References ast_free, and AST_LIST_REMOVE_HEAD.
Referenced by confbridge_exec(), destroy_bridge(), and feature_attended_transfer().
int ast_bridge_features_enable | ( | struct ast_bridge_features * | features, |
enum ast_bridge_builtin_feature | feature, | ||
const char * | dtmf, | ||
void * | config | ||
) |
Enable a built in feature on a bridge features structure.
features | Bridge features structure |
feature | Feature to enable |
dtmf | Optionally the DTMF stream to trigger the feature, if not specified it will be the default |
config | Configuration structure unique to the built in type |
0 | on success |
-1 | on failure |
Example usage:
This enables the attended transfer DTMF option using the default DTMF string. An alternate string may be provided using the dtmf parameter. Internally this is simply setting up a hook to a built in feature callback function.
Definition at line 1295 of file bridging.c.
References ast_bridge_features_hook(), ast_debug, and ast_strlen_zero().
Referenced by feature_attended_transfer().
int ast_bridge_features_hook | ( | struct ast_bridge_features * | features, |
const char * | dtmf, | ||
ast_bridge_features_hook_callback | callback, | ||
void * | hook_pvt | ||
) |
Attach a custom hook to a bridge features structure.
features | Bridge features structure |
dtmf | DTMF string to be activated upon |
callback | Function to execute upon activation |
hook_pvt | Unique data |
0 | on success |
-1 | on failure |
Example usage:
This makes the bridging core call pound_callback if a channel that has this feature structure inputs the DTMF string '#'. A pointer to useful data may be provided to the hook_pvt parameter.
Definition at line 1274 of file bridging.c.
References ast_calloc, ast_copy_string(), AST_LIST_INSERT_TAIL, ast_bridge_features_hook::callback, ast_bridge_features_hook::dtmf, ast_bridge_features_hook::hook_pvt, and ast_bridge_features::usable.
Referenced by ast_bridge_features_enable(), confbridge_exec(), and feature_attended_transfer().
int ast_bridge_features_init | ( | struct ast_bridge_features * | features | ) |
Initialize bridge features structure.
features | Bridge featues structure |
0 | on success |
-1 | on failure |
Example usage:
This initializes the feature structure 'features' to have nothing enabled.
Definition at line 1322 of file bridging.c.
References AST_LIST_HEAD_INIT_NOLOCK.
Referenced by confbridge_exec(), and feature_attended_transfer().
int ast_bridge_features_register | ( | enum ast_bridge_builtin_feature | feature, |
ast_bridge_features_hook_callback | callback, | ||
const char * | dtmf | ||
) |
Register a handler for a built in feature.
feature | The feature that the handler will be responsible for |
callback | The callback function that will handle it |
dtmf | Default DTMF string used to activate the feature |
0 | on success |
-1 | on failure |
Example usage:
This registers the function bridge_builtin_attended_transfer as the function responsible for the built in attended transfer feature.
Definition at line 1248 of file bridging.c.
References ast_copy_string(), and ast_strlen_zero().
Referenced by load_module().
int ast_bridge_features_set_flag | ( | struct ast_bridge_features * | features, |
enum ast_bridge_feature_flags | flag | ||
) |
Set a flag on a bridge features structure.
features | Bridge features structure |
flag | Flag to enable |
0 | on success |
-1 | on failure |
Example usage:
This sets the AST_BRIDGE_FLAG_DISSOLVE feature to be enabled on the features structure 'features'.
Definition at line 1315 of file bridging.c.
References ast_set_flag, ast_bridge_features::feature_flags, and ast_bridge_features::usable.
Referenced by feature_attended_transfer().
int ast_bridge_features_unregister | ( | enum ast_bridge_builtin_feature | feature | ) |
Unregister a handler for a built in feature.
feature | The feature to unregister |
0 | on success |
-1 | on failure |
Example usage:
This unregisters the function that is handling the built in attended transfer feature.
Definition at line 1263 of file bridging.c.
void ast_bridge_handle_trip | ( | struct ast_bridge * | bridge, |
struct ast_bridge_channel * | bridge_channel, | ||
struct ast_channel * | chan, | ||
int | outfd | ||
) |
Feed notification that a frame is waiting on a channel into the bridging core.
bridge | The bridge that the notification should influence |
bridge_channel | Bridge channel the notification was received on (if known) |
chan | Channel the notification was received on (if known) |
outfd | File descriptor that the notification was received on (if known) |
Example usage:
This tells the bridging core that a frame has been received on the channel pointed to by chan and that it should be read and handled.
Definition at line 277 of file bridging.c.
References ast_bridge_change_state(), AST_BRIDGE_CHANNEL_STATE_END, AST_CONTROL_HANGUP, ast_debug, AST_FRAME_CONTROL, AST_FRAME_DTMF_BEGIN, ast_frfree, ast_read(), ast_read_noaudio(), bridge_drop_control_frame(), bridge_handle_dtmf(), ast_bridge_technology::fd, ast_bridge_channel::features, ast_bridge::features, find_bridge_channel(), ast_frame::frametype, ast_frame_subclass::integer, ast_bridge_features::mute, ast_bridge_technology::poke, ast_frame::subclass, ast_bridge::technology, and ast_bridge_technology::write.
Referenced by bridge_channel_join_multithreaded(), generic_thread_loop(), and multiplexed_thread_function().
int ast_bridge_impart | ( | struct ast_bridge * | bridge, |
struct ast_channel * | chan, | ||
struct ast_channel * | swap, | ||
struct ast_bridge_features * | features | ||
) |
Impart (non-blocking) a channel on a bridge.
bridge | Bridge to impart on |
chan | Channel to impart |
swap | Channel to swap out if swapping |
features | Bridge features structure |
0 | on success |
-1 | on failure |
Example usage:
This adds a channel pointed to by the chan pointer to the bridge pointed to by the bridge pointer. This function will return immediately and will not wait until the channel is no longer part of the bridge.
If this channel will be replacing another channel the other channel can be specified in the swap parameter. The other channel will be thrown out of the bridge in an atomic fashion.
If channel specific features are enabled a pointer to the features structure can be specified in the features parameter.
Definition at line 1043 of file bridging.c.
References ao2_ref, ast_calloc, ast_cond_destroy, ast_cond_init, ast_free, ast_mutex_destroy, ast_mutex_init, ast_pthread_create, ast_bridge_channel::bridge, bridge_channel_thread(), ast_bridge_channel::chan, ast_bridge_channel::cond, ast_bridge_channel::features, ast_bridge_channel::lock, ast_bridge_channel::swap, and ast_bridge_channel::thread.
Referenced by bridge_call(), feature_attended_transfer(), feature_blind_transfer(), and play_sound_file().
enum ast_bridge_channel_state ast_bridge_join | ( | struct ast_bridge * | bridge, |
struct ast_channel * | chan, | ||
struct ast_channel * | swap, | ||
struct ast_bridge_features * | features | ||
) |
Join (blocking) a channel to a bridge.
bridge | Bridge to join |
chan | Channel to join |
swap | Channel to swap out if swapping |
features | Bridge features structure |
state | that channel exited the bridge with |
Example usage:
This adds a channel pointed to by the chan pointer to the bridge pointed to by the bridge pointer. This function will not return until the channel has been removed from the bridge, swapped out for another channel, or has hung up.
If this channel will be replacing another channel the other channel can be specified in the swap parameter. The other channel will be thrown out of the bridge in an atomic fashion.
If channel specific features are enabled a pointer to the features structure can be specified in the features parameter.
Definition at line 993 of file bridging.c.
References ao2_ref, ast_cond_destroy, ast_cond_init, ast_mutex_destroy, ast_mutex_init, ast_bridge_channel::bridge, ast_channel::bridge, bridge_channel_join(), ast_bridge_channel::chan, ast_bridge_channel::cond, ast_bridge_channel::features, ast_bridge::features, ast_bridge_channel::lock, state, and ast_bridge_channel::swap.
Referenced by confbridge_exec(), and feature_attended_transfer().
int ast_bridge_merge | ( | struct ast_bridge * | bridge0, |
struct ast_bridge * | bridge1 | ||
) |
Merge two bridges together.
bridge0 | First bridge |
bridge1 | Second bridge |
0 | on success |
-1 | on failure |
Example usage:
This merges the bridge pointed to by bridge1 with the bridge pointed to by bridge0. In reality all of the channels in bridge1 are simply moved to bridge0.
Definition at line 1119 of file bridging.c.
References ao2_lock, ao2_ref, ao2_unlock, AST_BRIDGE_CAPABILITY_MULTIMIX, AST_BRIDGE_FLAG_SMART, ast_cond_signal, ast_debug, AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_HEAD, ast_mutex_lock, ast_mutex_unlock, AST_PTHREADT_STOP, ast_test_flag, ast_bridge_channel::bridge, bridge_array_add(), bridge_array_remove(), bridge_make_compatible(), ast_bridge_technology::capabilities, ast_bridge_channel::chan, ast_bridge_channel::cond, ast_bridge::feature_flags, ast_bridge_technology::join, ast_bridge_technology::leave, ast_bridge_channel::lock, ast_bridge_technology::name, ast_bridge::num, smart_bridge_operation(), ast_bridge::technology, ast_bridge_channel::thread, and ast_bridge::thread.
struct ast_bridge* ast_bridge_new | ( | enum ast_bridge_capability | capabilities, |
int | flags | ||
) |
Create a new bridge.
capabilities | The capabilities that we require to be used on the bridge |
flags | Flags that will alter the behavior of the bridge |
a | pointer to a new bridge on success |
NULL | on failure |
Example usage:
This creates a simple two party bridge that will be destroyed once one of the channels hangs up.
Definition at line 449 of file bridging.c.
References ao2_alloc, ao2_ref, ast_bridge::array, ast_bridge::array_size, AST_BRIDGE_CAPABILITY_1TO1MIX, AST_BRIDGE_CAPABILITY_MULTIMIX, ast_bridge_destroy(), AST_BRIDGE_FLAG_SMART, ast_bridge_new(), ast_calloc, ast_debug, AST_PTHREADT_NULL, ast_set_flag, BRIDGE_ARRAY_START, ast_bridge_technology::create, destroy_bridge(), ast_bridge::feature_flags, find_best_technology(), ast_bridge_technology::name, ast_bridge::technology, and ast_bridge::thread.
Referenced by ast_bridge_new(), feature_attended_transfer(), and join_conference_bridge().
int ast_bridge_remove | ( | struct ast_bridge * | bridge, |
struct ast_channel * | chan | ||
) |
Remove a channel from a bridge.
bridge | Bridge that the channel is to be removed from |
chan | Channel to remove |
0 | on success |
-1 | on failure |
Example usage:
This removes the channel pointed to by the chan pointer from the bridge pointed to by the bridge pointer and requests that it be hung up. Control over the channel will NOT be given to the calling thread.
Definition at line 1100 of file bridging.c.
References ao2_lock, ao2_unlock, ast_bridge_change_state(), AST_BRIDGE_CHANNEL_STATE_HANGUP, and find_bridge_channel().
Referenced by menu_callback().
int ast_bridge_suspend | ( | struct ast_bridge * | bridge, |
struct ast_channel * | chan | ||
) |
Suspend a channel temporarily from a bridge.
bridge | Bridge to suspend the channel from |
chan | Channel to suspend |
0 | on success |
-1 | on failure |
Example usage:
This suspends the channel pointed to by chan from the bridge pointed to by bridge temporarily. Control of the channel is given to the calling thread. This differs from ast_bridge_depart as the channel will not be removed from the bridge.
Definition at line 1200 of file bridging.c.
References ao2_lock, ao2_unlock, bridge_channel_suspend(), and find_bridge_channel().
Referenced by leave_conference_bridge(), post_join_marked(), and post_join_unmarked().
void ast_bridge_technology_suspend | ( | struct ast_bridge_technology * | technology | ) |
Suspend a bridge technology from consideration.
technology | The bridge technology to suspend |
Example usage:
This suspends the bridge technology simple_bridge_tech from being considered when creating a new bridge. Existing bridges using the bridge technology are not affected.
Definition at line 1236 of file bridging.c.
References ast_bridge_technology::suspended.
int ast_bridge_technology_unregister | ( | struct ast_bridge_technology * | technology | ) |
Unregister a bridge technology from use.
technology | The bridge technology to unregister |
0 | on success |
-1 | on failure |
Example usage:
This unregisters a bridge technlogy declared as the structure simple_bridge_tech with the bridging core. It will no longer be considered when creating a new bridge.
Definition at line 99 of file bridging.c.
References AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verbose(), ast_bridge_technology::name, option_verbose, and VERBOSE_PREFIX_2.
Referenced by unload_module().
void ast_bridge_technology_unsuspend | ( | struct ast_bridge_technology * | technology | ) |
Unsuspend a bridge technology.
technology | The bridge technology to unsuspend |
Example usage:
This makes the bridge technology simple_bridge_tech considered when creating a new bridge again.
Definition at line 1242 of file bridging.c.
References ast_bridge_technology::suspended.
int ast_bridge_unsuspend | ( | struct ast_bridge * | bridge, |
struct ast_channel * | chan | ||
) |
Unsuspend a channel from a bridge.
bridge | Bridge to unsuspend the channel from |
chan | Channel to unsuspend |
0 | on success |
-1 | on failure |
Example usage:
This unsuspends the channel pointed to by chan from the bridge pointed to by bridge. The bridge will go back to handling the channel once this function returns.
Definition at line 1218 of file bridging.c.
References ao2_lock, ao2_unlock, bridge_channel_unsuspend(), and find_bridge_channel().
Referenced by leave_conference_bridge(), post_join_marked(), and post_join_unmarked().
|
static |
Helper function to add a channel to the bridge array.
Definition at line 153 of file bridging.c.
References ast_bridge::array, ast_bridge::array_num, ast_bridge::array_size, ast_debug, ast_log(), ast_realloc, BRIDGE_ARRAY_GROW, bridge_poke(), LOG_ERROR, ast_channel::name, and ast_bridge::waiting.
Referenced by ast_bridge_merge(), bridge_channel_join(), and bridge_channel_unsuspend().
|
static |
Helper function to remove a channel from the bridge array.
Definition at line 184 of file bridging.c.
References ast_bridge::array, ast_bridge::array_num, ast_debug, bridge_poke(), and ast_bridge::waiting.
Referenced by ast_bridge_merge(), bridge_channel_join(), and bridge_channel_suspend().
|
static |
Internal function that plays back DTMF on a bridge channel.
Definition at line 857 of file bridging.c.
References ast_bridge_change_state(), AST_BRIDGE_CHANNEL_STATE_WAIT, ast_copy_string(), ast_debug, ast_dtmf_stream(), ast_bridge_channel::chan, and ast_bridge_channel::dtmf_stream_q.
Referenced by bridge_channel_join().
|
static |
Internal function that executes a feature on a bridge channel.
Definition at line 791 of file bridging.c.
References ast_bridge_change_state(), AST_BRIDGE_CHANNEL_STATE_WAIT, ast_bridge_dtmf_stream(), ast_clear_flag, ast_debug, AST_FLAG_END_DTMF_ONLY, AST_LIST_TRAVERSE, ast_set_flag, ast_waitfordigit(), ast_bridge_features_hook::callback, ast_bridge_channel::chan, ast_bridge_features_hook::dtmf, ast_bridge_channel::features, ast_bridge::features, ast_bridge_features_hook::hook_pvt, and MAXIMUM_DTMF_FEATURE_STRING.
Referenced by bridge_channel_join().
|
static |
Join a channel to a bridge and handle anything the bridge may want us to do.
Definition at line 873 of file bridging.c.
References ao2_lock, ao2_ref, ao2_unlock, AST_BRIDGE_CAPABILITY_MULTITHREADED, AST_BRIDGE_CAPABILITY_THREAD, ast_bridge_change_state(), AST_BRIDGE_CHANNEL_STATE_DTMF, AST_BRIDGE_CHANNEL_STATE_END, AST_BRIDGE_CHANNEL_STATE_FEATURE, AST_BRIDGE_CHANNEL_STATE_HANGUP, AST_BRIDGE_CHANNEL_STATE_WAIT, AST_BRIDGE_FLAG_SMART, ast_debug, ast_getformatname(), AST_LIST_INSERT_TAIL, AST_LIST_REMOVE, ast_pthread_create, AST_PTHREADT_NULL, ast_set_read_format(), ast_set_write_format(), ast_test_flag, ast_bridge_channel::bridge, ast_channel::bridge, bridge_array_add(), bridge_array_remove(), bridge_channel_dtmf_stream(), bridge_channel_feature(), bridge_channel_join_multithreaded(), bridge_channel_join_singlethreaded(), bridge_channel_suspend(), bridge_channel_unsuspend(), bridge_check_dissolve(), bridge_make_compatible(), bridge_thread(), ast_bridge_technology::capabilities, ast_bridge_channel::chan, ast_bridge::feature_flags, find_bridge_channel(), ast_bridge_technology::join, ast_bridge_technology::leave, ast_bridge_technology::name, ast_bridge::num, ast_channel::readformat, smart_bridge_operation(), ast_bridge_channel::state, state, ast_bridge::stop, ast_bridge_channel::swap, ast_bridge::technology, ast_bridge_channel::thread, ast_bridge::thread, and ast_channel::writeformat.
Referenced by ast_bridge_join(), and bridge_channel_thread().
|
static |
Run in a multithreaded model. Each joined channel does writing/reading in their own thread. TODO: Improve.
Definition at line 711 of file bridging.c.
References ao2_lock, ao2_unlock, ast_bridge_handle_trip(), ast_cond_wait, ast_debug, ast_mutex_lock, ast_mutex_unlock, ast_waitfor_nandfds(), ast_bridge_channel::bridge, ast_bridge_channel::chan, ast_bridge_channel::cond, ast_bridge_technology::fd, ast_bridge_channel::fds, ast_bridge_channel::lock, ast_bridge_channel::state, ast_bridge_channel::suspended, and ast_bridge::technology.
Referenced by bridge_channel_join().
|
static |
Run in a singlethreaded model. Each joined channel yields itself to the main bridge thread. TODO: Improve.
Definition at line 748 of file bridging.c.
References ao2_lock, ao2_unlock, AST_BRIDGE_CHANNEL_STATE_WAIT, ast_cond_wait, ast_debug, ast_mutex_lock, ast_mutex_unlock, ast_bridge_channel::bridge, ast_bridge_channel::cond, ast_bridge_channel::lock, and ast_bridge_channel::state.
Referenced by bridge_channel_join().
|
static |
Internal function that suspends a channel from a bridge.
Definition at line 763 of file bridging.c.
References bridge_array_remove(), ast_bridge_channel::chan, ast_bridge_technology::suspend, ast_bridge_channel::suspended, and ast_bridge::technology.
Referenced by ast_bridge_suspend(), and bridge_channel_join().
|
static |
Thread responsible for imparted bridged channels.
Definition at line 1021 of file bridging.c.
References ao2_ref, AST_BRIDGE_CHANNEL_STATE_END, AST_BRIDGE_CHANNEL_STATE_HANGUP, ast_cond_destroy, ast_free, ast_hangup(), ast_mutex_destroy, ast_bridge_channel::bridge, bridge_channel_join(), ast_bridge_channel::chan, ast_bridge_channel::cond, ast_bridge_channel::lock, and state.
Referenced by ast_bridge_impart().
|
static |
Internal function that unsuspends a channel from a bridge.
Definition at line 777 of file bridging.c.
References bridge_array_add(), ast_bridge_channel::chan, ast_bridge_channel::suspended, ast_bridge::technology, and ast_bridge_technology::unsuspend.
Referenced by ast_bridge_unsuspend(), and bridge_channel_join().
|
static |
Internal function to see whether a bridge should dissolve, and if so do it.
Definition at line 222 of file bridging.c.
References ast_bridge_change_state(), AST_BRIDGE_CHANNEL_STATE_DEPART, AST_BRIDGE_CHANNEL_STATE_END, AST_BRIDGE_CHANNEL_STATE_HANGUP, AST_BRIDGE_FLAG_DISSOLVE, ast_debug, AST_LIST_TRAVERSE, ast_test_flag, ast_bridge_features::feature_flags, ast_bridge::feature_flags, ast_bridge_channel::features, ast_bridge_channel::state, and ast_bridge_features::usable.
Referenced by bridge_channel_join().
|
static |
Internal function used to determine whether a control frame should be dropped or not.
Definition at line 266 of file bridging.c.
References AST_CONTROL_ANSWER.
Referenced by ast_bridge_handle_trip().
|
static |
Internal function to handle DTMF from a channel.
Definition at line 242 of file bridging.c.
References ast_bridge_change_state(), AST_BRIDGE_CHANNEL_STATE_FEATURE, ast_frfree, AST_LIST_TRAVERSE, ast_bridge_features_hook::dtmf, ast_bridge_channel::features, ast_bridge::features, ast_frame_subclass::integer, ast_frame::subclass, and ast_bridge_features::usable.
Referenced by ast_bridge_handle_trip().
|
static |
Definition at line 544 of file bridging.c.
References ast_best_codec(), ast_debug, ast_getformatname(), ast_getformatname_multiple(), ast_log(), ast_set_read_format(), ast_set_write_format(), ast_bridge_channel::chan, ast_bridge_technology::formats, LOG_WARNING, ast_bridge_technology::name, ast_channel::name, option_debug, ast_channel::readformat, ast_bridge::technology, and ast_channel::writeformat.
Referenced by ast_bridge_merge(), bridge_channel_join(), and smart_bridge_operation().
|
static |
Helper function to poke the bridge thread.
Definition at line 139 of file bridging.c.
References AST_PTHREADT_NULL, AST_PTHREADT_STOP, and ast_bridge::thread.
Referenced by ast_bridge_destroy(), bridge_array_add(), bridge_array_remove(), and smart_bridge_operation().
|
static |
Bridge thread function.
Definition at line 354 of file bridging.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_bridge::array_num, ast_debug, AST_PTHREADT_NULL, generic_thread_loop(), ast_bridge::refresh, ast_bridge::stop, ast_bridge::technology, ast_bridge_technology::thread, and ast_bridge::thread.
Referenced by bridge_channel_join(), and smart_bridge_operation().
|
static |
Definition at line 421 of file bridging.c.
References ast_bridge::array, ast_bridge_features_cleanup(), ast_debug, ast_free, ast_module_unref(), ast_bridge_technology::destroy, ast_bridge::features, ast_bridge_technology::mod, ast_bridge_technology::name, and ast_bridge::technology.
Referenced by ast_bridge_new().
|
static |
Helper function used to find the "best" bridge technology given a specified capabilities.
Definition at line 386 of file bridging.c.
References ast_debug, ast_module_ref(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_bridge_technology::capabilities, ast_bridge_technology::name, ast_bridge_technology::preference, and ast_bridge_technology::suspended.
Referenced by ast_bridge_check(), ast_bridge_new(), and smart_bridge_operation().
|
static |
Helper function to find a bridge channel given a channel.
Definition at line 208 of file bridging.c.
References AST_LIST_TRAVERSE, and ast_bridge_channel::chan.
Referenced by ast_bridge_depart(), ast_bridge_handle_trip(), ast_bridge_remove(), ast_bridge_suspend(), ast_bridge_unsuspend(), and bridge_channel_join().
|
static |
Generic thread loop, TODO: Rethink this/improve it.
Definition at line 326 of file bridging.c.
References ao2_lock, ao2_unlock, ast_bridge::array, ast_bridge::array_num, ast_bridge_handle_trip(), ast_waitfor_n(), first, ast_bridge::refresh, ast_bridge::stop, and ast_bridge::waiting.
Referenced by bridge_thread().
|
static |
Perform the smart bridge operation. Basically sees if a new bridge technology should be used instead of the current one.
Definition at line 593 of file bridging.c.
References ao2_lock, ao2_unlock, AST_BRIDGE_CAPABILITY_1TO1MIX, AST_BRIDGE_CAPABILITY_MULTIMIX, AST_BRIDGE_CAPABILITY_THREAD, ast_cond_signal, ast_debug, AST_LIST_TRAVERSE, ast_module_unref(), ast_mutex_lock, ast_mutex_unlock, AST_PTHREADT_NULL, bridge_make_compatible(), bridge_poke(), ast_bridge::bridge_pvt, bridge_thread(), ast_bridge_technology::capabilities, ast_bridge_channel::cond, ast_bridge_technology::create, find_best_technology(), ast_bridge_technology::join, ast_bridge_channel::lock, ast_bridge_technology::name, ast_bridge::refresh, ast_bridge::stop, ast_bridge::technology, ast_bridge_channel::thread, and ast_bridge::thread.
Referenced by ast_bridge_merge(), and bridge_channel_join().
|
static |
|
static |
Default DTMF keys for built in features
Definition at line 58 of file bridging.c.
|
static |
Function handlers for the built in features
Definition at line 61 of file bridging.c.