summaryrefslogtreecommitdiff
path: root/main/bridge_roles.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2013-08-05 16:59:13 +0000
committerJonathan Rose <jrose@digium.com>2013-08-05 16:59:13 +0000
commite47794ead1fb35527728a0c655585af35679e258 (patch)
treec3e08fcd907c1b0a2390a388d69905394b5c307e /main/bridge_roles.c
parent98b02d98f389d922da568882cd3f350fe28b473d (diff)
ARI: bridges/{bridgeID}/addChannel: add roles parameter
Roles are now cleared with each entry into a bridge with addChannel. If the roles parameter is present, the role specified will be applied to all channels being added with the addChannel command. (closes issue ASTERISK-21973) Reported by: Matt Jordan https://reviewboard.asterisk.org/r/2691/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396182 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/bridge_roles.c')
-rw-r--r--main/bridge_roles.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/main/bridge_roles.c b/main/bridge_roles.c
index dd1012b9c..1d781ca93 100644
--- a/main/bridge_roles.c
+++ b/main/bridge_roles.c
@@ -355,6 +355,25 @@ void ast_channel_remove_bridge_role(struct ast_channel *chan, const char *role_n
ast_debug(2, "Role %s did not exist on channel %s\n", role_name, ast_channel_name(chan));
}
+void ast_channel_clear_bridge_roles(struct ast_channel *chan)
+{
+ struct bridge_roles_datastore *roles_datastore = fetch_bridge_roles_datastore(chan);
+ struct bridge_role *role;
+
+ if (!roles_datastore) {
+ /* The roles datastore didn't already exist, so there is no need to remove any roles */
+ ast_debug(2, "Roles did not exist on channel %s\n", ast_channel_name(chan));
+ return;
+ }
+
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&roles_datastore->role_list, role, list) {
+ ast_debug(2, "Removing bridge role %s from channel %s\n", role->role, ast_channel_name(chan));
+ AST_LIST_REMOVE_CURRENT(list);
+ bridge_role_destroy(role);
+ }
+ AST_LIST_TRAVERSE_SAFE_END;
+}
+
int ast_channel_set_bridge_role_option(struct ast_channel *channel, const char *role_name, const char *option, const char *value)
{
struct bridge_role *role = get_role_from_channel(channel, role_name);