diff options
Diffstat (limited to 'res')
-rw-r--r-- | res/ari/resource_bridges.c | 10 | ||||
-rw-r--r-- | res/ari/resource_bridges.h | 2 | ||||
-rw-r--r-- | res/res_ari_bridges.c | 3 | ||||
-rw-r--r-- | res/stasis/control.c | 10 |
4 files changed, 25 insertions, 0 deletions
diff --git a/res/ari/resource_bridges.c b/res/ari/resource_bridges.c index e4c7194ff..65fe8d79f 100644 --- a/res/ari/resource_bridges.c +++ b/res/ari/resource_bridges.c @@ -176,6 +176,16 @@ void ast_ari_add_channel_to_bridge(struct ast_variable *headers, struct ast_add_ } for (i = 0; i < list->count; ++i) { + stasis_app_control_clear_roles(list->controls[i]); + if (!ast_strlen_zero(args->role)) { + if (stasis_app_control_add_role(list->controls[i], args->role)) { + ast_ari_response_alloc_failed(response); + return; + } + } + } + + for (i = 0; i < list->count; ++i) { stasis_app_control_add_channel_to_bridge(list->controls[i], bridge); } diff --git a/res/ari/resource_bridges.h b/res/ari/resource_bridges.h index d12432413..d82cb6f8b 100644 --- a/res/ari/resource_bridges.h +++ b/res/ari/resource_bridges.h @@ -103,6 +103,8 @@ struct ast_add_channel_to_bridge_args { size_t channel_count; /*! \brief Parsing context for channel. */ char *channel_parse; + /*! \brief Channel's role in the bridge */ + const char *role; }; /*! * \brief Add a channel to a bridge. diff --git a/res/res_ari_bridges.c b/res/res_ari_bridges.c index 57dc6a48d..05ea12e6a 100644 --- a/res/res_ari_bridges.c +++ b/res/res_ari_bridges.c @@ -324,6 +324,9 @@ static void ast_ari_add_channel_to_bridge_cb( args.channel[j] = (vals[j]); } } else + if (strcmp(i->name, "role") == 0) { + args.role = (i->value); + } else {} } for (i = path_vars; i; i = i->next) { diff --git a/res/stasis/control.c b/res/stasis/control.c index 211566e11..dcc029701 100644 --- a/res/stasis/control.c +++ b/res/stasis/control.c @@ -168,6 +168,16 @@ int stasis_app_control_dial(struct stasis_app_control *control, const char *endp return 0; } +int stasis_app_control_add_role(struct stasis_app_control *control, const char *role) +{ + return ast_channel_add_bridge_role(control->channel, role); +} + +void stasis_app_control_clear_roles(struct stasis_app_control *control) +{ + ast_channel_clear_bridge_roles(control->channel); +} + int control_is_done(struct stasis_app_control *control) { /* Called from stasis_app_exec thread; no lock needed */ |