<p>Joshua Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13954">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, approved; Approved for Submit
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, but someone else must approve
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_session: Don't restrict non-audio default streams to sendrecv.<br><br>The state of the default audio stream is used for hold/unhold so we<br>restrict it to sendrecv as the core does not handle when it changes as<br>a result of hold/unhold.<br><br>This restriction does not apply to other media types though so we now<br>only restrict it to audio. This allows the other default streams to<br>store their state at all values, and not just sendrecv and removed.<br><br>ASTERISK-28783<br><br>Change-Id: I139740f38cea7f7d92a876ec2631ef50681f6625<br>---<br>M res/res_pjsip_session.c<br>1 file changed, 12 insertions(+), 11 deletions(-)<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 b9448b9..ebd0516 100644</span><br><span>--- a/res/res_pjsip_session.c</span><br><span>+++ b/res/res_pjsip_session.c</span><br><span>@@ -760,8 +760,8 @@</span><br><span> ast_stream_free(stream);</span><br><span> return -1;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- /* For backwards compatibility with the core default streams are always sendrecv */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_sip_session_is_pending_stream_default(session, stream)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* For backwards compatibility with the core the default audio stream is always sendrecv */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_sip_session_is_pending_stream_default(session, stream) || strcmp(media, "audio")) {</span><br><span> if (pjmedia_sdp_media_find_attr2(remote_stream, "sendonly", NULL)) {</span><br><span> /* Stream state reflects our state of a stream, so in the case of</span><br><span> * sendonly and recvonly we store the opposite since that is what ours</span><br><span>@@ -871,12 +871,16 @@</span><br><span> RAII_VAR(struct sdp_handler_list *, handler_list, NULL, ao2_cleanup);</span><br><span> int res;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /* We need a null-terminated version of the media string */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_pj_str(media, &local->media[index]->desc.media, sizeof(media));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* For backwards compatibility we only reflect the stream state correctly on</span><br><span style="color: hsl(0, 100%, 40%);">- * the non-default streams. This is because the stream state is also used for</span><br><span style="color: hsl(0, 100%, 40%);">- * signaling that someone has placed us on hold. This situation is not handled</span><br><span style="color: hsl(0, 100%, 40%);">- * currently and can result in the remote side being sort of placed on hold too.</span><br><span style="color: hsl(120, 100%, 40%);">+ * the non-default streams and any non-audio streams. This is because the stream</span><br><span style="color: hsl(120, 100%, 40%);">+ * state of the default audio stream is also used for signaling that someone has</span><br><span style="color: hsl(120, 100%, 40%);">+ * placed us on hold. This situation is not handled currently and can result in</span><br><span style="color: hsl(120, 100%, 40%);">+ * the remote side being sorted of placed on hold too.</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_sip_session_is_pending_stream_default(session, asterisk_stream)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_sip_session_is_pending_stream_default(session, asterisk_stream) || strcmp(media, "audio")) {</span><br><span> /* Determine the state of the stream based on our local SDP */</span><br><span> if (pjmedia_sdp_media_find_attr2(local_stream, "sendonly", NULL)) {</span><br><span> ast_stream_set_state(asterisk_stream, AST_STREAM_STATE_SENDONLY);</span><br><span>@@ -891,9 +895,6 @@</span><br><span> ast_stream_set_state(asterisk_stream, AST_STREAM_STATE_SENDRECV);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- /* We need a null-terminated version of the media string */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_pj_str(media, &local->media[index]->desc.media, sizeof(media));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> set_mid_and_bundle_group(session, session_media, remote, remote->media[index]);</span><br><span> set_remote_mslabel_and_stream_group(session, session_media, remote, remote->media[index], asterisk_stream);</span><br><span> </span><br><span>@@ -1965,8 +1966,8 @@</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- /* For backwards compatibility with the core default streams are always sendrecv */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_sip_session_is_pending_stream_default(session, stream)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* For backwards compatibility with the core the default audio stream is always sendrecv */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_sip_session_is_pending_stream_default(session, stream) || strcmp(media, "audio")) {</span><br><span> if (pjmedia_sdp_media_find_attr2(remote_stream, "sendonly", NULL)) {</span><br><span> /* Stream state reflects our state of a stream, so in the case of</span><br><span> * sendonly and recvonly we store the opposite since that is what ours</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13954">change 13954</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/+/13954"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I139740f38cea7f7d92a876ec2631ef50681f6625 </div>
<div style="display:none"> Gerrit-Change-Number: 13954 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Joshua 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 Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>