<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6760">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge_simple: Improve renegotiation success rate.<br><br>When making channels compatible the bridge_simple module<br>will renegotiate one to better match the other. Some<br>endpoints incorrectly terminate the call if this process<br>fails.<br><br>To better handle this scenario the audio streams present<br>on the new requested topology will include any existing<br>negotiated formats that happen to exist on the first<br>valid audio stream. This ensures formats are persent that<br>are known to be acceptable to the remote endpoint.<br><br>ASTERISK-27259<br><br>Change-Id: I8fc0cc03e8bcfd0be8302f13b9f32d8268977f43<br>---<br>M bridges/bridge_simple.c<br>1 file changed, 54 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/bridges/bridge_simple.c b/bridges/bridge_simple.c<br>index a49bc39..7ee1966 100644<br>--- a/bridges/bridge_simple.c<br>+++ b/bridges/bridge_simple.c<br>@@ -113,6 +113,58 @@<br> .stream_topology_changed = simple_bridge_stream_topology_changed,<br> };<br> <br>+static void simple_bridge_request_stream_topology_change(struct ast_channel *chan,<br>+ struct ast_stream_topology *requested_topology)<br>+{<br>+ struct ast_stream_topology *existing_topology = ast_channel_get_stream_topology(chan);<br>+ struct ast_stream *stream;<br>+ struct ast_format_cap *audio_formats = NULL;<br>+ struct ast_stream_topology *new_topology;<br>+ int i;<br>+<br>+ /* We find an existing stream with negotiated audio formats that we can place into<br>+ * any audio streams in the new topology to ensure that negotiation succeeds. Some<br>+ * endpoints incorrectly terminate the call if SDP negotiation fails.<br>+ */<br>+ for (i = 0; i < ast_stream_topology_get_count(existing_topology); ++i) {<br>+ stream = ast_stream_topology_get_stream(existing_topology, i);<br>+<br>+ if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_AUDIO ||<br>+ ast_stream_get_state(stream) == AST_STREAM_STATE_REMOVED) {<br>+ continue;<br>+ }<br>+<br>+ audio_formats = ast_stream_get_formats(stream);<br>+ break;<br>+ }<br>+<br>+ if (!audio_formats) {<br>+ ast_channel_request_stream_topology_change(chan, requested_topology, &simple_bridge);<br>+ return;<br>+ }<br>+<br>+ new_topology = ast_stream_topology_clone(requested_topology);<br>+ if (!new_topology) {<br>+ ast_channel_request_stream_topology_change(chan, requested_topology, &simple_bridge);<br>+ return;<br>+ }<br>+<br>+ for (i = 0; i < ast_stream_topology_get_count(new_topology); ++i) {<br>+ stream = ast_stream_topology_get_stream(new_topology, i);<br>+<br>+ if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_AUDIO ||<br>+ ast_stream_get_state(stream) == AST_STREAM_STATE_REMOVED) {<br>+ continue;<br>+ }<br>+<br>+ ast_format_cap_append_from_cap(ast_stream_get_formats(stream), audio_formats, AST_MEDIA_TYPE_AUDIO);<br>+ }<br>+<br>+ ast_channel_request_stream_topology_change(chan, new_topology, &simple_bridge);<br>+<br>+ ast_stream_topology_free(new_topology);<br>+}<br>+<br> static void simple_bridge_stream_topology_changed(struct ast_bridge *bridge,<br> struct ast_bridge_channel *bridge_channel)<br> {<br>@@ -135,9 +187,9 @@<br> <br> /* Align topologies according to size or first channel to join */<br> if (ast_stream_topology_get_count(t0) < ast_stream_topology_get_count(t1)) {<br>- ast_channel_request_stream_topology_change(c0, t1, &simple_bridge);<br>+ simple_bridge_request_stream_topology_change(c0, t1);<br> } else {<br>- ast_channel_request_stream_topology_change(c1, t0, &simple_bridge);<br>+ simple_bridge_request_stream_topology_change(c1, t0);<br> }<br> }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6760">change 6760</a>. To unsubscribe, 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/6760"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I8fc0cc03e8bcfd0be8302f13b9f32d8268977f43 </div>
<div style="display:none"> Gerrit-Change-Number: 6760 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>