Channel Bridging API. More...
#include "asterisk/bridging_features.h"
Go to the source code of this file.
Data Structures | |
struct | ast_bridge |
Structure that contains information about a bridge. More... | |
struct | ast_bridge_channel |
Structure that contains information regarding a channel in a bridge. More... | |
Enumerations | |
enum | ast_bridge_capability { AST_BRIDGE_CAPABILITY_1TO1MIX = (1 << 1), AST_BRIDGE_CAPABILITY_MULTIMIX = (1 << 2), AST_BRIDGE_CAPABILITY_NATIVE = (1 << 3), AST_BRIDGE_CAPABILITY_MULTITHREADED = (1 << 4), AST_BRIDGE_CAPABILITY_THREAD = (1 << 5), AST_BRIDGE_CAPABILITY_VIDEO = (1 << 6), AST_BRIDGE_CAPABILITY_OPTIMIZE = (1 << 7) } |
Capabilities for a bridge technology. More... | |
enum | ast_bridge_channel_state { AST_BRIDGE_CHANNEL_STATE_WAIT = 0, AST_BRIDGE_CHANNEL_STATE_END, AST_BRIDGE_CHANNEL_STATE_HANGUP, AST_BRIDGE_CHANNEL_STATE_DEPART, AST_BRIDGE_CHANNEL_STATE_FEATURE, AST_BRIDGE_CHANNEL_STATE_DTMF } |
State information about a bridged channel. More... | |
enum | ast_bridge_write_result { AST_BRIDGE_WRITE_SUCCESS = 0, AST_BRIDGE_WRITE_FAILED, AST_BRIDGE_WRITE_UNSUPPORTED } |
Return values for bridge technology write function. More... | |
Functions | |
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_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... | |
int | ast_bridge_unsuspend (struct ast_bridge *bridge, struct ast_channel *chan) |
Unsuspend a channel from a bridge. More... | |
Channel Bridging API.
Definition in file bridging.h.
Capabilities for a bridge technology.
Definition at line 68 of file bridging.h.
State information about a bridged channel.
Definition at line 86 of file bridging.h.
Return values for bridge technology write function.
Definition at line 102 of file bridging.h.
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_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().
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().