ari: Ignore invisible bridges when listing bridges.
When listing bridges we go through the ones present in ARI, get their snapshot, turn it into JSON, and add it to the payload we ultimately return. An invisible "dial bridge" exists within ARI that would also try to be added to this payload if the channel "create" and "dial" routes were used. This would ultimately fail due to invisible bridges having no snapshot resulting in the listing of bridges failing. This change makes it so that the listing of bridges ignores invisible ones. ASTERISK-29668 Change-Id: I14fa4b589b4657d1c2a5226b0f527f45a0cd370a
This commit is contained in:
parent
484da42d6c
commit
ea36473c45
|
@ -905,12 +905,23 @@ void ast_ari_bridges_list(struct ast_variable *headers,
|
|||
|
||||
i = ao2_iterator_init(bridges, 0);
|
||||
while ((bridge = ao2_iterator_next(&i))) {
|
||||
struct ast_bridge_snapshot *snapshot = ast_bridge_get_snapshot(bridge);
|
||||
/* ast_bridge_snapshot_to_json will return NULL if snapshot is NULL */
|
||||
struct ast_json *json_bridge = ast_bridge_snapshot_to_json(snapshot, stasis_app_get_sanitizer());
|
||||
struct ast_bridge_snapshot *snapshot;
|
||||
struct ast_json *json_bridge = NULL;
|
||||
|
||||
/* Invisible bridges don't get shown externally and have no snapshot */
|
||||
if (ast_test_flag(&bridge->feature_flags, AST_BRIDGE_FLAG_INVISIBLE)) {
|
||||
ao2_ref(bridge, -1);
|
||||
continue;
|
||||
}
|
||||
|
||||
snapshot = ast_bridge_get_snapshot(bridge);
|
||||
if (snapshot) {
|
||||
json_bridge = ast_bridge_snapshot_to_json(snapshot, stasis_app_get_sanitizer());
|
||||
ao2_ref(snapshot, -1);
|
||||
}
|
||||
|
||||
ao2_ref(bridge, -1);
|
||||
ao2_cleanup(snapshot);
|
||||
|
||||
if (!json_bridge || ast_json_array_append(json, json_bridge)) {
|
||||
ao2_iterator_destroy(&i);
|
||||
ast_ari_response_alloc_failed(response);
|
||||
|
|
Loading…
Reference in New Issue