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
This commit is contained in:
Mark Michelson
2016-05-09 14:27:53 -05:00
parent 5b15ec966d
commit f6c33771f6
5 changed files with 33 additions and 12 deletions

View File

@@ -759,11 +759,13 @@ struct ast_bridge *bridge_base_init(struct ast_bridge *self, uint32_t capabiliti
ast_set_flag(&self->feature_flags, flags);
self->allowed_capabilities = capabilities;
if (bridge_topics_init(self) != 0) {
ast_log(LOG_WARNING, "Bridge %s: Could not initialize topics\n",
self->uniqueid);
ao2_ref(self, -1);
return NULL;
if (!(flags & AST_BRIDGE_FLAG_INVISIBLE)) {
if (bridge_topics_init(self) != 0) {
ast_log(LOG_WARNING, "Bridge %s: Could not initialize topics\n",
self->uniqueid);
ao2_ref(self, -1);
return NULL;
}
}
/* Use our helper function to find the "best" bridge technology. */
@@ -793,9 +795,11 @@ struct ast_bridge *bridge_base_init(struct ast_bridge *self, uint32_t capabiliti
return NULL;
}
if (!ast_bridge_topic(self)) {
ao2_ref(self, -1);
return NULL;
if (!(flags & AST_BRIDGE_FLAG_INVISIBLE)) {
if (!ast_bridge_topic(self)) {
ao2_ref(self, -1);
return NULL;
}
}
return self;
@@ -4321,8 +4325,8 @@ static struct ast_bridge *acquire_bridge(struct ast_channel *chan)
bridge = ast_channel_get_bridge(chan);
ast_channel_unlock(chan);
if (bridge
&& ast_test_flag(&bridge->feature_flags, AST_BRIDGE_FLAG_MASQUERADE_ONLY)) {
if (bridge && ast_test_flag(&bridge->feature_flags,
(AST_BRIDGE_FLAG_MASQUERADE_ONLY | AST_BRIDGE_FLAG_INVISIBLE))) {
ao2_ref(bridge, -1);
bridge = NULL;
}