diff --git a/doc/CHANGES-staging/ari-bridges-inhibit-colp.txt b/doc/CHANGES-staging/ari-bridges-inhibit-colp.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdc9ffb80a43c15c5e137757ef12ea10ae745df6 --- /dev/null +++ b/doc/CHANGES-staging/ari-bridges-inhibit-colp.txt @@ -0,0 +1,5 @@ +Subject: ARI + +A new parameter 'inhibitConnectedLineUpdates' is now available in the +'bridges.addChannel' call. This prevents the identity of the newly connected +channel from being presented to other bridge members. diff --git a/include/asterisk/bridge_features.h b/include/asterisk/bridge_features.h index f9af8fbfd91e67572ceac03350c6a6be44cbc894..9b5f70f7036ad0c1a752c9bc26605751c430aef5 100644 --- a/include/asterisk/bridge_features.h +++ b/include/asterisk/bridge_features.h @@ -277,6 +277,8 @@ struct ast_bridge_features { unsigned int mute:1; /*! TRUE if DTMF should be passed into the bridge tech. */ unsigned int dtmf_passthrough:1; + /*! TRUE to avoid generating COLP frames when joining the bridge */ + unsigned int inhibit_colp:1; }; /*! diff --git a/include/asterisk/stasis_app.h b/include/asterisk/stasis_app.h index 01c7ff4d7cbd9bff31504cc794de9dbd9473dff6..285d54a08992e6d6640aacb06c8124a666140770 100644 --- a/include/asterisk/stasis_app.h +++ b/include/asterisk/stasis_app.h @@ -837,6 +837,16 @@ void stasis_app_control_absorb_dtmf_in_bridge( void stasis_app_control_mute_in_bridge( struct stasis_app_control *control, int mute); +/*! + * \since 18 + * \brief Set whether COLP frames should be generated when joining the bridge + * + * \param control Control whose channel should have its COLP frames inhibited when bridged + * \param mute Whether COLP frames should be generated (0) or not (1). + */ +void stasis_app_control_inhibit_colp_in_bridge( + struct stasis_app_control *control, int inhibit_colp); + /*! * \since 12 * \brief Gets the bridge currently associated with a control object. diff --git a/res/ari/resource_bridges.c b/res/ari/resource_bridges.c index 33e4cd18175216dfc3a336ba860a270a55f0035a..e4e70641a9453a826baf90cf7d82bf0058dbdfb3 100644 --- a/res/ari/resource_bridges.c +++ b/res/ari/resource_bridges.c @@ -221,6 +221,7 @@ void ast_ari_bridges_add_channel(struct ast_variable *headers, if (!stasis_app_control_bridge_features_init(list->controls[i])) { stasis_app_control_absorb_dtmf_in_bridge(list->controls[i], args->absorb_dtmf); stasis_app_control_mute_in_bridge(list->controls[i], args->mute); + stasis_app_control_inhibit_colp_in_bridge(list->controls[i], args->inhibit_connected_line_updates); } } diff --git a/res/ari/resource_bridges.h b/res/ari/resource_bridges.h index 0d0286c31bba6766d5d6666f22a9d385fad65bf5..83a353227cf3d2f3404c1981ad01747a535f5a2f 100644 --- a/res/ari/resource_bridges.h +++ b/res/ari/resource_bridges.h @@ -154,6 +154,8 @@ struct ast_ari_bridges_add_channel_args { int absorb_dtmf; /*! Mute audio from this channel, preventing it to pass through to the bridge */ int mute; + /*! Do not present the identity of the newly connected channel to other bridge members */ + int inhibit_connected_line_updates; }; /*! * \brief Body parsing function for /bridges/{bridgeId}/addChannel. diff --git a/res/res_ari_bridges.c b/res/res_ari_bridges.c index 7ef0f684a5b4296010ff936f059d1738f21a6f04..0f0f22bae5b062979213522bc96ea5b085321994 100644 --- a/res/res_ari_bridges.c +++ b/res/res_ari_bridges.c @@ -440,6 +440,10 @@ int ast_ari_bridges_add_channel_parse_body( if (field) { args->mute = ast_json_is_true(field); } + field = ast_json_object_get(body, "inhibitConnectedLineUpdates"); + if (field) { + args->inhibit_connected_line_updates = ast_json_is_true(field); + } return 0; } @@ -515,6 +519,9 @@ static void ast_ari_bridges_add_channel_cb( if (strcmp(i->name, "mute") == 0) { args.mute = ast_true(i->value); } else + if (strcmp(i->name, "inhibitConnectedLineUpdates") == 0) { + args.inhibit_connected_line_updates = ast_true(i->value); + } else {} } for (i = path_vars; i; i = i->next) { diff --git a/res/stasis/control.c b/res/stasis/control.c index 96ddf39d0c27cf550834d10bc69ebdcf585c232f..584e60ecfa76a5a522201bb47eec31204361b4c7 100644 --- a/res/stasis/control.c +++ b/res/stasis/control.c @@ -1285,6 +1285,7 @@ int control_swap_channel_in_bridge(struct stasis_app_control *control, struct as { int res; struct ast_bridge_features *features; + int flags = AST_BRIDGE_IMPART_CHAN_DEPARTABLE; if (!control || !bridge) { return -1; @@ -1332,6 +1333,9 @@ int control_swap_channel_in_bridge(struct stasis_app_control *control, struct as /* Pull bridge features from the control */ features = control->bridge_features; control->bridge_features = NULL; + if (features && features->inhibit_colp) { + flags |= AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP; + } ast_assert(stasis_app_get_bridge(control) == NULL); /* We need to set control->bridge here since bridge_after_cb may be run @@ -1349,7 +1353,7 @@ int control_swap_channel_in_bridge(struct stasis_app_control *control, struct as chan, swap, features, /* features */ - AST_BRIDGE_IMPART_CHAN_DEPARTABLE); + flags); if (res != 0) { /* ast_bridge_impart failed before it could spawn the depart * thread. The callbacks aren't called in this case. @@ -1469,6 +1473,12 @@ void stasis_app_control_mute_in_bridge( control->bridge_features->mute = mute; } +void stasis_app_control_inhibit_colp_in_bridge( + struct stasis_app_control *control, int inhibit_colp) +{ + control->bridge_features->inhibit_colp = inhibit_colp; +} + void control_flush_queue(struct stasis_app_control *control) { struct ao2_iterator iter; diff --git a/rest-api/api-docs/bridges.json b/rest-api/api-docs/bridges.json index 22743c3be326e4fbeff8fa45d1fb5d7bc85e6fb6..a46513791fa8c9e9356725362179389c89c8b9b4 100644 --- a/rest-api/api-docs/bridges.json +++ b/rest-api/api-docs/bridges.json @@ -191,6 +191,15 @@ "allowMultiple": false, "dataType": "boolean", "defaultValue": false + }, + { + "name": "inhibitConnectedLineUpdates", + "description": "Do not present the identity of the newly connected channel to other bridge members", + "paramType": "query", + "required": false, + "allowMultiple": false, + "dataType": "boolean", + "defaultValue": false } ], "errorResponses": [