Asterisk - The Open Source Telephony Project GIT-master-7e7a603
Functions
bridge_internal.h File Reference

Private Bridging API. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct ast_bridgebridge_alloc (size_t size, const struct ast_bridge_methods *v_table)
 
struct ast_bridgebridge_base_init (struct ast_bridge *self, uint32_t capabilities, unsigned int flags, const char *creator, const char *name, const char *id)
 Initialize the base class of the bridge. More...
 
void bridge_dissolve (struct ast_bridge *bridge, int cause)
 
void bridge_do_merge (struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, struct ast_bridge_channel **kick_me, unsigned int num_kick, unsigned int optimized)
 
int bridge_do_move (struct ast_bridge *dst_bridge, struct ast_bridge_channel *bridge_channel, int attempt_recovery, unsigned int optimized)
 
struct ast_bridge_channelbridge_find_channel (struct ast_bridge *bridge, struct ast_channel *chan)
 
void bridge_merge_inhibit_nolock (struct ast_bridge *bridge, int request)
 
void bridge_reconfigured (struct ast_bridge *bridge, unsigned int colp_update)
 
struct ast_bridgebridge_register (struct ast_bridge *bridge)
 Register the new bridge with the system. More...
 

Detailed Description

Private Bridging API.

Functions in this file are intended to be used by the Bridging API, bridge mixing technologies, and bridge sub-classes. Users of bridges that do not fit those three categories should not use the API defined in this file.

Author
Mark Michelson mmich.nosp@m.elso.nosp@m.n@dig.nosp@m.ium..nosp@m.com

See Also:

Definition in file bridge_internal.h.

Function Documentation

◆ bridge_alloc()

struct ast_bridge * bridge_alloc ( size_t  size,
const struct ast_bridge_methods v_table 
)

Definition at line 706 of file bridge.c.

707{
708 struct ast_bridge *bridge;
709
710 /* Check v_table that all methods are present. */
711 if (!v_table
712 || !v_table->name
713 || !v_table->destroy
715 || !v_table->push
716 || !v_table->pull
719 ast_log(LOG_ERROR, "Virtual method table for bridge class %s not complete.\n",
720 v_table && v_table->name ? v_table->name : "<unknown>");
721 ast_assert(0);
722 return NULL;
723 }
724
725 bridge = ao2_alloc(size, destroy_bridge);
726 if (!bridge) {
727 return NULL;
728 }
729
730 if (ast_string_field_init(bridge, 80)) {
731 ao2_cleanup(bridge);
732 return NULL;
733 }
734
735 bridge->v_table = v_table;
736
738
739 return bridge;
740}
#define ast_log
Definition: astobj2.c:42
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:409
static void destroy_bridge(void *obj)
Definition: bridge.c:640
@ AST_MEDIA_TYPE_END
Definition: codec.h:36
#define LOG_ERROR
#define NULL
Definition: resample.c:96
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
Definition: stringfields.h:359
ast_bridge_dissolving_fn dissolving
Definition: bridge.h:263
ast_bridge_push_channel_fn push
Definition: bridge.h:265
const char * name
Definition: bridge.h:259
ast_bridge_notify_masquerade_fn notify_masquerade
Definition: bridge.h:269
ast_bridge_destructor_fn destroy
Definition: bridge.h:261
ast_bridge_merge_priority_fn get_merge_priority
Definition: bridge.h:271
ast_bridge_pull_channel_fn pull
Definition: bridge.h:267
Structure that contains information about a bridge.
Definition: bridge.h:349
struct ast_vector_int media_types
Definition: bridge.h:404
const struct ast_bridge_methods * v_table
Definition: bridge.h:351
#define ast_assert(a)
Definition: utils.h:739
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
Definition: vector.h:113

References ao2_alloc, ao2_cleanup, ast_assert, ast_log, AST_MEDIA_TYPE_END, ast_string_field_init, AST_VECTOR_INIT, ast_bridge_methods::destroy, destroy_bridge(), ast_bridge_methods::dissolving, ast_bridge_methods::get_merge_priority, LOG_ERROR, ast_bridge::media_types, ast_bridge_methods::name, ast_bridge_methods::notify_masquerade, NULL, ast_bridge_methods::pull, ast_bridge_methods::push, and ast_bridge::v_table.

Referenced by ast_bridge_base_new(), ast_bridge_basic_new(), bridge_agent_hold_new(), bridge_parking_new(), and bridge_stasis_new().

◆ bridge_base_init()

struct ast_bridge * bridge_base_init ( struct ast_bridge self,
uint32_t  capabilities,
unsigned int  flags,
const char *  creator,
const char *  name,
const char *  id 
)

Initialize the base class of the bridge.

Parameters
selfBridge to operate upon. (Tolerates a NULL pointer)
capabilitiesThe capabilities that we require to be used on the bridge
flagsFlags that will alter the behavior of the bridge
creatorEntity that created the bridge (optional)
nameName given to the bridge by its creator (optional, requires named creator)
idUnique ID given to the bridge by its creator (optional)
Returns
self on success
Return values
NULLon failure, self is already destroyed

Example usage:

struct ast_bridge *bridge;
bridge = bridge_alloc(sizeof(*bridge), &ast_bridge_base_v_table);
struct ast_bridge_methods ast_bridge_base_v_table
Bridge base class virtual method table.
Definition: bridge.c:923
@ AST_BRIDGE_CAPABILITY_1TO1MIX
Definition: bridge.h:92
@ AST_BRIDGE_FLAG_DISSOLVE_HANGUP
struct ast_bridge * bridge_base_init(struct ast_bridge *self, uint32_t capabilities, unsigned int flags, const char *creator, const char *name, const char *id)
Initialize the base class of the bridge.
Definition: bridge.c:742
struct ast_bridge * bridge_alloc(size_t size, const struct ast_bridge_methods *v_table)
Definition: bridge.c:706

This creates a no frills two party bridge that will be destroyed once one of the channels hangs up.

Definition at line 742 of file bridge.c.

743{
744 char uuid_hold[AST_UUID_STR_LEN];
745
746 if (!self) {
747 return NULL;
748 }
749
750 if (!ast_strlen_zero(id)) {
751 ast_string_field_set(self, uniqueid, id);
752 } else {
754 ast_string_field_set(self, uniqueid, uuid_hold);
755 }
756 ast_string_field_set(self, creator, creator);
757 if (!ast_strlen_zero(creator)) {
759 }
760
761 ast_set_flag(&self->feature_flags, flags);
762 self->allowed_capabilities = capabilities;
763
764 if (!(flags & AST_BRIDGE_FLAG_INVISIBLE)) {
765 if (bridge_topics_init(self) != 0) {
766 ast_log(LOG_WARNING, "Bridge %s: Could not initialize topics\n",
767 self->uniqueid);
768 ao2_ref(self, -1);
769 return NULL;
770 }
771 }
772
773 /* Use our helper function to find the "best" bridge technology. */
774 self->technology = find_best_technology(capabilities, self);
775 if (!self->technology) {
776 ast_log(LOG_WARNING, "Bridge %s: Could not create class %s. No technology to support it.\n",
777 self->uniqueid, self->v_table->name);
778 ao2_ref(self, -1);
779 return NULL;
780 }
781
782 /* Pass off the bridge to the technology to manipulate if needed */
783 ast_debug(1, "Bridge %s: calling %s technology constructor\n",
784 self->uniqueid, self->technology->name);
785 if (self->technology->create && self->technology->create(self)) {
786 ast_log(LOG_WARNING, "Bridge %s: failed to setup bridge technology %s\n",
787 self->uniqueid, self->technology->name);
788 ao2_ref(self, -1);
789 return NULL;
790 }
791 ast_debug(1, "Bridge %s: calling %s technology start\n",
792 self->uniqueid, self->technology->name);
793 if (self->technology->start && self->technology->start(self)) {
794 ast_log(LOG_WARNING, "Bridge %s: failed to start bridge technology %s\n",
795 self->uniqueid, self->technology->name);
796 ao2_ref(self, -1);
797 return NULL;
798 }
799
800 if (!(flags & AST_BRIDGE_FLAG_INVISIBLE)) {
801 if (!ast_bridge_topic(self)) {
802 ao2_ref(self, -1);
803 return NULL;
804 }
805 }
806
807 self->creationtime = ast_tvnow();
808
809 return self;
810}
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
static struct ast_bridge_technology * find_best_technology(uint32_t capabilities, struct ast_bridge *bridge)
Helper function used to find the "best" bridge technology given specified capabilities.
Definition: bridge.c:499
@ AST_BRIDGE_FLAG_INVISIBLE
static const char name[]
Definition: format_mp3.c:68
#define ast_debug(level,...)
Log a DEBUG message.
#define LOG_WARNING
int bridge_topics_init(struct ast_bridge *bridge)
struct stasis_topic * ast_bridge_topic(struct ast_bridge *bridge)
A topic which publishes the events for a particular bridge.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
Definition: stringfields.h:521
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
int(* start)(struct ast_bridge *bridge)
Request a bridge technology instance start operations.
int(* create)(struct ast_bridge *bridge)
Create a bridge technology instance for a bridge.
struct timeval creationtime
Definition: bridge.h:408
const ast_string_field uniqueid
Definition: bridge.h:401
struct ast_bridge_technology * technology
Definition: bridge.h:355
struct ast_flags feature_flags
Definition: bridge.h:369
uint32_t allowed_capabilities
Definition: bridge.h:371
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:159
#define ast_set_flag(p, flag)
Definition: utils.h:70
#define AST_UUID_STR_LEN
Definition: uuid.h:27
char * ast_uuid_generate_str(char *buf, size_t size)
Generate a UUID string.
Definition: uuid.c:141

References ast_bridge::allowed_capabilities, ao2_ref, AST_BRIDGE_FLAG_INVISIBLE, ast_bridge_topic(), ast_debug, ast_log, ast_set_flag, ast_string_field_set, ast_strlen_zero(), ast_tvnow(), ast_uuid_generate_str(), AST_UUID_STR_LEN, bridge_topics_init(), ast_bridge_technology::create, ast_bridge::creationtime, ast_bridge::creator, ast_bridge::feature_flags, find_best_technology(), LOG_WARNING, name, ast_bridge_methods::name, ast_bridge_technology::name, NULL, ast_bridge_technology::start, ast_bridge::technology, ast_bridge::uniqueid, and ast_bridge::v_table.

Referenced by ast_bridge_base_new(), ast_bridge_basic_new(), bridge_agent_hold_new(), bridge_parking_new(), and bridge_stasis_new().

◆ bridge_dissolve()

void bridge_dissolve ( struct ast_bridge bridge,
int  cause 
)

Definition at line 315 of file bridge.c.

316{
317 struct ast_bridge_channel *bridge_channel;
318 struct ast_frame action = {
321 };
322
323 if (bridge->dissolved) {
324 return;
325 }
326 bridge->dissolved = 1;
327
328 if (cause <= 0) {
330 }
331 bridge->cause = cause;
332
333 ast_debug(1, "Bridge %s: dissolving bridge with cause %d(%s)\n",
334 bridge->uniqueid, cause, ast_cause2str(cause));
335
336 AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) {
337 ast_bridge_channel_leave_bridge(bridge_channel,
339 }
340
341 /* Must defer dissolving bridge because it is already locked. */
342 ast_bridge_queue_action(bridge, &action);
343}
int ast_bridge_queue_action(struct ast_bridge *bridge, struct ast_frame *action)
Put an action onto the specified bridge.
Definition: bridge.c:303
@ BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE
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_ACTION_DEFERRED_DISSOLVING
#define AST_CAUSE_NORMAL_CLEARING
Definition: causes.h:106
const char * ast_cause2str(int cause) attribute_pure
Gives the string form of a given cause code.
Definition: channel.c:612
@ AST_FRAME_BRIDGE_ACTION
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
Structure that contains information regarding a channel in a bridge.
struct ast_bridge_channels_list channels
Definition: bridge.h:363
unsigned int dissolved
Definition: bridge.h:390
int cause
Definition: bridge.h:386
Data structure associated with a single frame of data.
enum ast_frame_type frametype
Definition: search.h:40

References ast_bridge_channel_leave_bridge(), ast_bridge_queue_action(), ast_cause2str(), AST_CAUSE_NORMAL_CLEARING, ast_debug, AST_FRAME_BRIDGE_ACTION, AST_LIST_TRAVERSE, BRIDGE_CHANNEL_ACTION_DEFERRED_DISSOLVING, BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE, ast_bridge::cause, ast_bridge::channels, ast_bridge::dissolved, ast_frame::frametype, and ast_bridge::uniqueid.

Referenced by ast_bridge_destroy(), bridge_channel_dissolve_check(), bridge_dissolve_check_stolen(), and bridge_reconfigured().

◆ bridge_do_merge()

void bridge_do_merge ( struct ast_bridge dst_bridge,
struct ast_bridge src_bridge,
struct ast_bridge_channel **  kick_me,
unsigned int  num_kick,
unsigned int  optimized 
)

Definition at line 2048 of file bridge.c.

2050{
2051 struct ast_bridge_channel *bridge_channel;
2052 unsigned int idx;
2053
2054 ast_debug(1, "Merging bridge %s into bridge %s\n",
2055 src_bridge->uniqueid, dst_bridge->uniqueid);
2056
2057 ast_bridge_publish_merge(dst_bridge, src_bridge);
2058
2059 /*
2060 * Move channels from src_bridge over to dst_bridge.
2061 *
2062 * We must use AST_LIST_TRAVERSE_SAFE_BEGIN() because
2063 * bridge_channel_internal_pull() alters the list we are traversing.
2064 */
2065 AST_LIST_TRAVERSE_SAFE_BEGIN(&src_bridge->channels, bridge_channel, entry) {
2066 if (bridge_channel->state != BRIDGE_CHANNEL_STATE_WAIT) {
2067 /*
2068 * The channel is already leaving let it leave normally because
2069 * pulling it may delete hooks that should run for this channel.
2070 */
2071 continue;
2072 }
2073 if (ast_test_flag(&bridge_channel->features->feature_flags,
2075 continue;
2076 }
2077
2078 if (kick_me) {
2079 for (idx = 0; idx < num_kick; ++idx) {
2080 if (bridge_channel == kick_me[idx]) {
2081 ast_bridge_channel_leave_bridge(bridge_channel,
2083 break;
2084 }
2085 }
2086 }
2087 bridge_channel_internal_pull(bridge_channel);
2088 if (bridge_channel->state != BRIDGE_CHANNEL_STATE_WAIT) {
2089 /*
2090 * The channel died as a result of being pulled or it was
2091 * kicked. Leave it pointing to the original bridge.
2092 */
2093 continue;
2094 }
2095
2096 bridge_channel_moving(bridge_channel, bridge_channel->bridge, dst_bridge);
2097
2098 /* Point to new bridge.*/
2099 bridge_channel_change_bridge(bridge_channel, dst_bridge);
2100
2101 if (bridge_channel_internal_push(bridge_channel)) {
2102 ast_bridge_features_remove(bridge_channel->features,
2104 ast_bridge_channel_leave_bridge(bridge_channel,
2106 }
2107 }
2109
2110 if (kick_me) {
2111 /*
2112 * Now we can kick any channels in the dst_bridge without
2113 * potentially dissolving the bridge.
2114 */
2115 for (idx = 0; idx < num_kick; ++idx) {
2116 bridge_channel = kick_me[idx];
2117 ast_bridge_channel_lock(bridge_channel);
2118 if (bridge_channel->state == BRIDGE_CHANNEL_STATE_WAIT) {
2121 bridge_channel_internal_pull(bridge_channel);
2122 }
2123 ast_bridge_channel_unlock(bridge_channel);
2124 }
2125 }
2126
2127 bridge_reconfigured(dst_bridge, !optimized);
2128 bridge_reconfigured(src_bridge, !optimized);
2129
2130 ast_debug(1, "Merged bridge %s into bridge %s\n",
2131 src_bridge->uniqueid, dst_bridge->uniqueid);
2132}
void ast_bridge_features_remove(struct ast_bridge_features *features, enum ast_bridge_hook_remove_flags remove_flags)
Remove marked bridge channel feature hooks.
Definition: bridge.c:3501
void bridge_reconfigured(struct ast_bridge *bridge, unsigned int colp_update)
Definition: bridge.c:1403
static void bridge_channel_change_bridge(struct ast_bridge_channel *bridge_channel, struct ast_bridge *new_bridge)
Definition: bridge.c:2007
static void bridge_channel_moving(struct ast_bridge_channel *bridge_channel, struct ast_bridge *src, struct ast_bridge *dst)
Definition: bridge.c:2022
#define ast_bridge_channel_unlock(bridge_channel)
Unlock the bridge_channel.
#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).
@ BRIDGE_CHANNEL_STATE_WAIT
int bridge_channel_internal_push(struct ast_bridge_channel *bridge_channel)
void bridge_channel_internal_pull(struct ast_bridge_channel *bridge_channel)
@ AST_BRIDGE_HOOK_REMOVE_ON_PULL
@ AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:615
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:529
void ast_bridge_publish_merge(struct ast_bridge *to, struct ast_bridge *from)
Publish a bridge merge.
struct ast_bridge * bridge
Bridge this channel is participating in.
struct ast_bridge_features * features
enum bridge_channel_state state
struct ast_flags feature_flags
#define ast_test_flag(p, flag)
Definition: utils.h:63

References AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE, ast_bridge_channel_leave_bridge(), ast_bridge_channel_leave_bridge_nolock(), ast_bridge_channel_lock, ast_bridge_channel_unlock, ast_bridge_features_remove(), AST_BRIDGE_HOOK_REMOVE_ON_PULL, ast_bridge_publish_merge(), AST_CAUSE_NORMAL_CLEARING, ast_debug, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_test_flag, ast_bridge_channel::bridge, bridge_channel_change_bridge(), bridge_channel_internal_pull(), bridge_channel_internal_push(), bridge_channel_moving(), BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE, BRIDGE_CHANNEL_STATE_WAIT, bridge_reconfigured(), ast_bridge::cause, ast_bridge::channels, ast_bridge_features::feature_flags, ast_bridge_channel::features, ast_bridge_channel::state, and ast_bridge::uniqueid.

Referenced by bridge_merge(), bridge_merge_locked(), try_merge_optimize_out(), and two_bridge_attended_transfer().

◆ bridge_do_move()

int bridge_do_move ( struct ast_bridge dst_bridge,
struct ast_bridge_channel bridge_channel,
int  attempt_recovery,
unsigned int  optimized 
)

Definition at line 2314 of file bridge.c.

2316{
2317 struct ast_bridge *orig_bridge;
2318 int was_in_bridge;
2319 int res = 0;
2320
2321 if (bridge_channel->swap) {
2322 ast_debug(1, "Moving %p(%s) into bridge %s swapping with %s\n",
2323 bridge_channel, ast_channel_name(bridge_channel->chan), dst_bridge->uniqueid,
2324 ast_channel_name(bridge_channel->swap));
2325 } else {
2326 ast_debug(1, "Moving %p(%s) into bridge %s\n",
2327 bridge_channel, ast_channel_name(bridge_channel->chan), dst_bridge->uniqueid);
2328 }
2329
2330 orig_bridge = bridge_channel->bridge;
2331 was_in_bridge = bridge_channel->in_bridge;
2332
2333 bridge_channel_internal_pull(bridge_channel);
2334 if (bridge_channel->state != BRIDGE_CHANNEL_STATE_WAIT) {
2335 /*
2336 * The channel died as a result of being pulled. Leave it
2337 * pointing to the original bridge.
2338 *
2339 * Clear out the swap channel pointer. A ref is not held
2340 * by bridge_channel->swap at this point.
2341 */
2342 bridge_channel->swap = NULL;
2343 bridge_reconfigured(orig_bridge, 0);
2344 return -1;
2345 }
2346
2347 /* Point to new bridge.*/
2348 ao2_ref(orig_bridge, +1);/* Keep a ref in case the push fails. */
2349 bridge_channel_change_bridge(bridge_channel, dst_bridge);
2350
2351 bridge_channel_moving(bridge_channel, orig_bridge, dst_bridge);
2352
2353 if (bridge_channel_internal_push_full(bridge_channel, optimized)) {
2354 /* Try to put the channel back into the original bridge. */
2355 ast_bridge_features_remove(bridge_channel->features,
2357 if (attempt_recovery && was_in_bridge) {
2358 /* Point back to original bridge. */
2359 bridge_channel_change_bridge(bridge_channel, orig_bridge);
2360
2361 if (bridge_channel_internal_push(bridge_channel)) {
2362 ast_bridge_features_remove(bridge_channel->features,
2364 ast_bridge_channel_leave_bridge(bridge_channel,
2366 }
2367 } else {
2368 ast_bridge_channel_leave_bridge(bridge_channel,
2370 bridge_channel_settle_owed_events(orig_bridge, bridge_channel);
2371 }
2372 res = -1;
2373 } else if (!optimized) {
2374 bridge_channel_settle_owed_events(orig_bridge, bridge_channel);
2375 }
2376
2377 bridge_reconfigured(dst_bridge, !optimized);
2378 bridge_reconfigured(orig_bridge, !optimized);
2379 ao2_ref(orig_bridge, -1);
2380 return res;
2381}
void bridge_channel_settle_owed_events(struct ast_bridge *orig_bridge, struct ast_bridge_channel *bridge_channel)
int bridge_channel_internal_push_full(struct ast_bridge_channel *bridge_channel, int optimized)
const char * ast_channel_name(const struct ast_channel *chan)
struct ast_channel * swap
struct ast_channel * chan
unsigned int in_bridge

References ao2_ref, ast_bridge_channel_leave_bridge(), ast_bridge_features_remove(), AST_BRIDGE_HOOK_REMOVE_ON_PULL, ast_channel_name(), ast_debug, ast_bridge_channel::bridge, bridge_channel_change_bridge(), bridge_channel_internal_pull(), bridge_channel_internal_push(), bridge_channel_internal_push_full(), bridge_channel_moving(), bridge_channel_settle_owed_events(), BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE, BRIDGE_CHANNEL_STATE_WAIT, bridge_reconfigured(), ast_bridge::cause, ast_bridge_channel::chan, ast_bridge_channel::features, ast_bridge_channel::in_bridge, NULL, ast_bridge_channel::state, ast_bridge_channel::swap, and ast_bridge::uniqueid.

Referenced by bridge_move(), bridge_move_locked(), bridge_swap_attended_transfer(), and try_swap_optimize_out().

◆ bridge_find_channel()

struct ast_bridge_channel * bridge_find_channel ( struct ast_bridge bridge,
struct ast_channel chan 
)

◆ bridge_merge_inhibit_nolock()

void bridge_merge_inhibit_nolock ( struct ast_bridge bridge,
int  request 
)

Definition at line 2991 of file bridge.c.

2992{
2993 int new_request;
2994
2995 new_request = bridge->inhibit_merge + request;
2996 ast_assert(0 <= new_request);
2997 bridge->inhibit_merge = new_request;
2998}
static int request(void *obj)
Definition: chan_pjsip.c:2601
unsigned int inhibit_merge
Count of the active temporary requests to inhibit bridge merges. Zero if merges are allowed.
Definition: bridge.h:384

References ast_assert, ast_bridge::inhibit_merge, and request().

Referenced by ast_bridge_channel_merge_inhibit(), and ast_bridge_merge_inhibit().

◆ bridge_reconfigured()

void bridge_reconfigured ( struct ast_bridge bridge,
unsigned int  colp_update 
)

Definition at line 1403 of file bridge.c.

1404{
1405 if (!bridge->reconfigured) {
1406 return;
1407 }
1408 bridge->reconfigured = 0;
1410 && smart_bridge_operation(bridge)) {
1411 /* Smart bridge failed. */
1412 bridge_dissolve(bridge, 0);
1413 return;
1414 }
1415 bridge_complete_join(bridge);
1416
1417 if (bridge->dissolved) {
1418 return;
1419 }
1421 set_bridge_peer_vars(bridge);
1423
1424 if (colp_update) {
1426 }
1427}
void bridge_dissolve(struct ast_bridge *bridge, int cause)
Definition: bridge.c:315
static void check_bridge_play_sounds(struct ast_bridge *bridge)
Definition: bridge.c:1203
static int smart_bridge_operation(struct ast_bridge *bridge)
Definition: bridge.c:972
static void bridge_reconfigured_connected_line_update(struct ast_bridge *bridge)
Definition: bridge.c:385
static void bridge_complete_join(struct ast_bridge *bridge)
Definition: bridge.c:474
static void set_bridge_peer_vars(struct ast_bridge *bridge)
Definition: bridge.c:1386
@ AST_BRIDGE_FLAG_SMART
void ast_bridge_publish_state(struct ast_bridge *bridge)
Publish the state of a bridge.
unsigned int reconfigured
Definition: bridge.h:388

References AST_BRIDGE_FLAG_SMART, ast_bridge_publish_state(), ast_test_flag, ast_bridge_channel::bridge, bridge_complete_join(), bridge_dissolve(), bridge_reconfigured_connected_line_update(), check_bridge_play_sounds(), ast_bridge::dissolved, ast_bridge::feature_flags, ast_bridge::reconfigured, set_bridge_peer_vars(), and smart_bridge_operation().

Referenced by ast_bridge_notify_masquerade(), bridge_channel_handle_control(), bridge_channel_internal_join(), bridge_channel_wait(), bridge_do_merge(), and bridge_do_move().

◆ bridge_register()

struct ast_bridge * bridge_register ( struct ast_bridge bridge)

Register the new bridge with the system.

Since
12.0.0
Parameters
bridgeWhat to register. (Tolerates a NULL pointer)
struct ast_bridge *ast_bridge_basic_new(uint32_t capabilities, int flags, uint32 dtmf_features)
{
void *bridge;
bridge = bridge_alloc(sizeof(struct ast_bridge_basic), &ast_bridge_basic_v_table);
bridge = bridge_base_init(bridge, capabilities, flags);
bridge = ast_bridge_basic_init(bridge, dtmf_features);
bridge = bridge_register(bridge);
return bridge;
}
struct ast_bridge_methods ast_bridge_basic_v_table
Bridge basic class virtual method table.
struct ast_bridge * ast_bridge_basic_new(void)
Create a new basic class bridge.
struct ast_bridge * bridge_register(struct ast_bridge *bridge)
Register the new bridge with the system.
Definition: bridge.c:691
Note
This must be done after a bridge constructor has completed setting up the new bridge but before it returns.
After a bridge is registered, ast_bridge_destroy() must eventually be called to get rid of the bridge.
Returns
bridge on success.
Return values
NULLon error.

Definition at line 691 of file bridge.c.

692{
693 if (bridge) {
694 bridge->construction_completed = 1;
695 ast_bridge_lock(bridge);
697 ast_bridge_unlock(bridge);
698 if (!ao2_link(bridges, bridge)) {
699 ast_bridge_destroy(bridge, 0);
700 bridge = NULL;
701 }
702 }
703 return bridge;
704}
#define ao2_link(container, obj)
Add an object to a container.
Definition: astobj2.h:1532
int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
Destroy a bridge.
Definition: bridge.c:944
static struct ao2_container * bridges
Definition: bridge.c:123
#define ast_bridge_unlock(bridge)
Unlock the bridge.
Definition: bridge.h:481
#define ast_bridge_lock(bridge)
Lock the bridge.
Definition: bridge.h:470
unsigned int construction_completed
Definition: bridge.h:392

References ao2_link, ast_bridge_destroy(), ast_bridge_lock, ast_bridge_publish_state(), ast_bridge_unlock, bridges, ast_bridge::construction_completed, and NULL.

Referenced by ast_bridge_base_new(), ast_bridge_basic_new(), bridge_agent_hold_new(), bridge_parking_new(), and bridge_stasis_new().