<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6393">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Joshua Colp: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_session: Preserve stream name during renegotiation.<br><br>Stream names within Asterisk can have meaning so when an externally<br>initiated renegotiation occurs we need to preserve the name of<br>the stream if it already exists.<br><br>Change-Id: I29f50d0cc7f3238287d6d647777e76e1bdf8c596<br>---<br>M res/res_pjsip_session.c<br>1 file changed, 15 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c<br>index 76550ed..b6fa8bb 100644<br>--- a/res/res_pjsip_session.c<br>+++ b/res/res_pjsip_session.c<br>@@ -588,7 +588,14 @@<br>                     stream = ast_stream_topology_get_stream(session->pending_media_state->topology, i);<br>             }<br>             if (!stream) {<br>-                       stream = ast_stream_alloc(ast_codec_media_type2str(type), type);<br>+                     struct ast_stream *existing_stream = NULL;<br>+<br>+                        if (session->active_media_state->topology &&<br>+                           (i < ast_stream_topology_get_count(session->active_media_state->topology))) {<br>+                               existing_stream = ast_stream_topology_get_stream(session->active_media_state->topology, i);<br>+                    }<br>+<br>+                 stream = ast_stream_alloc(existing_stream ? ast_stream_get_name(existing_stream) : ast_codec_media_type2str(type), type);<br>                     if (!stream) {<br>                                return -1;<br>                    }<br>@@ -1586,6 +1593,7 @@<br>              char media[20];<br>               struct ast_sip_session_sdp_handler *handler;<br>          RAII_VAR(struct sdp_handler_list *, handler_list, NULL, ao2_cleanup);<br>+                struct ast_stream *existing_stream = NULL;<br>            struct ast_stream *stream;<br>            enum ast_media_type type;<br>             struct ast_sip_session_media *session_media = NULL;<br>@@ -1594,8 +1602,13 @@<br>           /* We need a null-terminated version of the media string */<br>           ast_copy_pj_str(media, &sdp->media[i]->desc.media, sizeof(media));<br> <br>+              if (session->active_media_state->topology &&<br>+                   (i < ast_stream_topology_get_count(session->active_media_state->topology))) {<br>+                       existing_stream = ast_stream_topology_get_stream(session->active_media_state->topology, i);<br>+            }<br>+<br>          type = ast_media_type_from_str(media);<br>-               stream = ast_stream_alloc(ast_codec_media_type2str(type), type);<br>+             stream = ast_stream_alloc(existing_stream ? ast_stream_get_name(existing_stream) : ast_codec_media_type2str(type), type);<br>             if (!stream) {<br>                        return -1;<br>            }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6393">change 6393</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/6393"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15.0 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I29f50d0cc7f3238287d6d647777e76e1bdf8c596 </div>
<div style="display:none"> Gerrit-Change-Number: 6393 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </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: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>