diff options
author | Mark Michelson <mmichelson@digium.com> | 2016-05-09 14:27:53 -0500 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2016-05-23 13:18:18 -0500 |
commit | f6c33771f660c3ad15bc554b355cb21e83c85e36 (patch) | |
tree | 721f6cbbb2032fbabb5acae6dd2b73876ca3abed /main/stasis_bridges.c | |
parent | 5b15ec966db9c686ca7fbc74be8d57b4c63253d7 (diff) |
Bridging: introduce "invisible" bridges.
Invisible bridges function the same as normal bridges, but they have the
following restrictions:
* They never show up in CLI, AMI, or ARI queries.
* They do not have Stasis messages published about them.
Invisible bridges' main use is for when use of the bridging system is
desired, but the bridge should not be known to users of the Asterisk
system.
ASTERISK-25925
Change-Id: I804a209d3181d7c54e3d61a60eb462e7ce0e3670
Diffstat (limited to 'main/stasis_bridges.c')
-rw-r--r-- | main/stasis_bridges.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/main/stasis_bridges.c b/main/stasis_bridges.c index d06ee14a7..0e46edbea 100644 --- a/main/stasis_bridges.c +++ b/main/stasis_bridges.c @@ -232,6 +232,10 @@ struct ast_bridge_snapshot *ast_bridge_snapshot_create(struct ast_bridge *bridge RAII_VAR(struct ast_bridge_snapshot *, snapshot, NULL, ao2_cleanup); struct ast_bridge_channel *bridge_channel; + if (ast_test_flag(&bridge->feature_flags, AST_BRIDGE_FLAG_INVISIBLE)) { + return NULL; + } + snapshot = ao2_alloc_options(sizeof(*snapshot), bridge_snapshot_dtor, AO2_ALLOC_OPT_LOCK_NOLOCK); if (!snapshot || ast_string_field_init(snapshot, 128)) { @@ -371,6 +375,8 @@ void ast_bridge_publish_merge(struct ast_bridge *to, struct ast_bridge *from) ast_assert(to != NULL); ast_assert(from != NULL); + ast_assert(ast_test_flag(&to->feature_flags, AST_BRIDGE_FLAG_INVISIBLE) == 0); + ast_assert(ast_test_flag(&from->feature_flags, AST_BRIDGE_FLAG_INVISIBLE) == 0); merge_msg = bridge_merge_message_create(to, from); if (!merge_msg) { @@ -447,6 +453,10 @@ void ast_bridge_publish_enter(struct ast_bridge *bridge, struct ast_channel *cha RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup); RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref); + if (ast_test_flag(&bridge->feature_flags, AST_BRIDGE_FLAG_INVISIBLE)) { + return; + } + if (swap) { blob = ast_json_pack("{s: s}", "swap", ast_channel_uniqueid(swap)); if (!blob) { @@ -468,6 +478,9 @@ void ast_bridge_publish_leave(struct ast_bridge *bridge, struct ast_channel *cha { RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup); + if (ast_test_flag(&bridge->feature_flags, AST_BRIDGE_FLAG_INVISIBLE)) { + return; + } msg = ast_bridge_blob_create(ast_channel_left_bridge_type(), bridge, chan, NULL); if (!msg) { return; |