<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/16541">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">ari: Ignore invisible bridges when listing bridges.<br><br>When listing bridges we go through the ones present in<br>ARI, get their snapshot, turn it into JSON, and add it<br>to the payload we ultimately return.<br><br>An invisible "dial bridge" exists within ARI that would<br>also try to be added to this payload if the channel<br>"create" and "dial" routes were used. This would ultimately<br>fail due to invisible bridges having no snapshot<br>resulting in the listing of bridges failing.<br><br>This change makes it so that the listing of bridges<br>ignores invisible ones.<br><br>ASTERISK-29668<br><br>Change-Id: I14fa4b589b4657d1c2a5226b0f527f45a0cd370a<br>---<br>M res/ari/resource_bridges.c<br>1 file changed, 15 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/41/16541/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/ari/resource_bridges.c b/res/ari/resource_bridges.c</span><br><span>index e4e7064..d03e86f 100644</span><br><span>--- a/res/ari/resource_bridges.c</span><br><span>+++ b/res/ari/resource_bridges.c</span><br><span>@@ -905,12 +905,23 @@</span><br><span> </span><br><span> i = ao2_iterator_init(bridges, 0);</span><br><span> while ((bridge = ao2_iterator_next(&i))) {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_bridge_snapshot *snapshot = ast_bridge_get_snapshot(bridge);</span><br><span style="color: hsl(0, 100%, 40%);">- /* ast_bridge_snapshot_to_json will return NULL if snapshot is NULL */</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_json *json_bridge = ast_bridge_snapshot_to_json(snapshot, stasis_app_get_sanitizer());</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_bridge_snapshot *snapshot;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_json *json_bridge = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Invisible bridges don't get shown externally and have no snapshot */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_test_flag(&bridge->feature_flags, AST_BRIDGE_FLAG_INVISIBLE)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(bridge, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+ continue;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ snapshot = ast_bridge_get_snapshot(bridge);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (snapshot) {</span><br><span style="color: hsl(120, 100%, 40%);">+ json_bridge = ast_bridge_snapshot_to_json(snapshot, stasis_app_get_sanitizer());</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(snapshot, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> ao2_ref(bridge, -1);</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_cleanup(snapshot);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> if (!json_bridge || ast_json_array_append(json, json_bridge)) {</span><br><span> ao2_iterator_destroy(&i);</span><br><span> ast_ari_response_alloc_failed(response);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16541">change 16541</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/16541"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 19 </div>
<div style="display:none"> Gerrit-Change-Id: I14fa4b589b4657d1c2a5226b0f527f45a0cd370a </div>
<div style="display:none"> Gerrit-Change-Number: 16541 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>