<p>Joshua C. Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13436">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, but someone else must approve
Joshua C. Colp: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_session: Set stream state on created streams for incoming SDP.<br><br>A previous review, 13174, made a change whereby on an incoming offer SDP<br>the pending topology was initialized to the configured. This caused a problem<br>for bundle with WebRTC where bundle could reference a stream that did not<br>actually exist if the configuration had both audio and video but the<br>offer SDP only contained audio.<br><br>This change undoes that review and instead fixes the original problem it<br>sought to solve by setting the state of created streams based on the<br>contents of the offer SDP. This way the stream state is not inactive<br>until negotiation later completes.<br><br>ASTERISK-28659<br><br>Change-Id: Ic5ae5a86437d3e686ac5afd91d133cc916198355<br>---<br>M res/res_pjsip_session.c<br>1 file changed, 19 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c</span><br><span>index bc01548..76740c1 100644</span><br><span>--- a/res/res_pjsip_session.c</span><br><span>+++ b/res/res_pjsip_session.c</span><br><span>@@ -712,7 +712,7 @@</span><br><span> </span><br><span> /* It is possible for SDP deferral to have already created a pending topology */</span><br><span> if (!session->pending_media_state->topology) {</span><br><span style="color: hsl(0, 100%, 40%);">- session->pending_media_state->topology = ast_stream_topology_clone(session->endpoint->media.topology);</span><br><span style="color: hsl(120, 100%, 40%);">+ session->pending_media_state->topology = ast_stream_topology_alloc();</span><br><span> if (!session->pending_media_state->topology) {</span><br><span> return -1;</span><br><span> }</span><br><span>@@ -753,6 +753,24 @@</span><br><span> ast_stream_free(stream);</span><br><span> return -1;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ /* For backwards compatibility with the core default streams are always sendrecv */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_sip_session_is_pending_stream_default(session, stream)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (pjmedia_sdp_media_find_attr2(remote_stream, "sendonly", NULL)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Stream state reflects our state of a stream, so in the case of</span><br><span style="color: hsl(120, 100%, 40%);">+ * sendonly and recvonly we store the opposite since that is what ours</span><br><span style="color: hsl(120, 100%, 40%);">+ * is.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_stream_set_state(stream, AST_STREAM_STATE_RECVONLY);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (pjmedia_sdp_media_find_attr2(remote_stream, "recvonly", NULL)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_stream_set_state(stream, AST_STREAM_STATE_SENDONLY);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (pjmedia_sdp_media_find_attr2(remote_stream, "inactive", NULL)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_stream_set_state(stream, AST_STREAM_STATE_INACTIVE);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_stream_set_state(stream, AST_STREAM_STATE_SENDRECV);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_stream_set_state(stream, AST_STREAM_STATE_SENDRECV);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> </span><br><span> session_media = ast_sip_session_media_state_add(session, session->pending_media_state, ast_media_type_from_str(media), i);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13436">change 13436</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/+/13436"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 17 </div>
<div style="display:none"> Gerrit-Change-Id: Ic5ae5a86437d3e686ac5afd91d133cc916198355 </div>
<div style="display:none"> Gerrit-Change-Number: 13436 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua C. Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua C. Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>