<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/16109">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_sdp_rtp: Evaluate remotely held for Session Progress<br><br>With the fix for ASTERISK_28754 channels are no longer put on hold if an<br>outbound INVITE is answered with a "Session Progress" containing<br>"inactive" audio.<br><br>The previous change moved the evaluation of the media attributes to<br>`negotiate_incoming_sdp_stream()` to have the `remotely_held` status<br>available when building the SDP in `create_outgoing_sdp_stream()`.<br>This however means that an answer to an outbound INVITE, which does not<br>traverse `negotiate_incoming_sdp_stream()`, cannot set the<br>`remotely_held` status anymore.<br><br>This change moves the check so that both, `negotiate_incoming_sdp_stream()` and<br>`apply_negotiated_sdp_stream()` can do the checks.<br><br>ASTERISK-29479<br><br>Change-Id: Icde805a819399d5123b688e1ed1d2bcd9d5b0f75<br>---<br>M res/res_pjsip_sdp_rtp.c<br>1 file changed, 27 insertions(+), 15 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c</span><br><span>index a6f4975..d422f01 100644</span><br><span>--- a/res/res_pjsip_sdp_rtp.c</span><br><span>+++ b/res/res_pjsip_sdp_rtp.c</span><br><span>@@ -1458,6 +1458,29 @@</span><br><span> }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static void set_session_media_remotely_held(struct ast_sip_session_media *session_media,</span><br><span style="color: hsl(120, 100%, 40%);">+ const struct ast_sip_session *session,</span><br><span style="color: hsl(120, 100%, 40%);">+ const pjmedia_sdp_media *media,</span><br><span style="color: hsl(120, 100%, 40%);">+ const struct ast_stream *stream,</span><br><span style="color: hsl(120, 100%, 40%);">+ const struct ast_sockaddr *addrs)</span><br><span style="color: hsl(120, 100%, 40%);">+{</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%);">+ (session_media->type == AST_MEDIA_TYPE_AUDIO)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (((addrs != NULL) && ast_sockaddr_isnull(addrs)) ||</span><br><span style="color: hsl(120, 100%, 40%);">+ ((addrs != NULL) && ast_sockaddr_is_any(addrs)) ||</span><br><span style="color: hsl(120, 100%, 40%);">+ pjmedia_sdp_media_find_attr2(media, "sendonly", NULL) ||</span><br><span style="color: hsl(120, 100%, 40%);">+ pjmedia_sdp_media_find_attr2(media, "inactive", NULL)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!session_media->remotely_held) {</span><br><span style="color: hsl(120, 100%, 40%);">+ session_media->remotely_held = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ session_media->remotely_held_changed = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (session_media->remotely_held) {</span><br><span style="color: hsl(120, 100%, 40%);">+ session_media->remotely_held = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ session_media->remotely_held_changed = 1;</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%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! \brief Function which negotiates an incoming media stream */</span><br><span> static int negotiate_incoming_sdp_stream(struct ast_sip_session *session,</span><br><span> struct ast_sip_session_media *session_media, const pjmedia_sdp_session *sdp,</span><br><span>@@ -1551,21 +1574,8 @@</span><br><span> process_ice_auth_attrb(session, session_media, sdp, stream);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_sip_session_is_pending_stream_default(session, asterisk_stream) && media_type == AST_MEDIA_TYPE_AUDIO) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Check if incomming SDP is changing the remotely held state */</span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_sockaddr_isnull(addrs) ||</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sockaddr_is_any(addrs) ||</span><br><span style="color: hsl(0, 100%, 40%);">- pjmedia_sdp_media_find_attr2(stream, "sendonly", NULL) ||</span><br><span style="color: hsl(0, 100%, 40%);">- pjmedia_sdp_media_find_attr2(stream, "inactive", NULL)) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!session_media->remotely_held) {</span><br><span style="color: hsl(0, 100%, 40%);">- session_media->remotely_held = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- session_media->remotely_held_changed = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (session_media->remotely_held) {</span><br><span style="color: hsl(0, 100%, 40%);">- session_media->remotely_held = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- session_media->remotely_held_changed = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Check if incoming SDP is changing the remotely held state */</span><br><span style="color: hsl(120, 100%, 40%);">+ set_session_media_remotely_held(session_media, session, stream, asterisk_stream, addrs);</span><br><span> </span><br><span> joint = set_incoming_call_offer_cap(session, session_media, stream);</span><br><span> res = apply_cap_to_bundled(session_media, session_media_transport, asterisk_stream, joint);</span><br><span>@@ -2164,6 +2174,8 @@</span><br><span> SCOPE_EXIT_RTN_VALUE(1, "moh\n");</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ set_session_media_remotely_held(session_media, session, remote_stream, asterisk_stream, addrs);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> if (session_media->remotely_held_changed) {</span><br><span> if (session_media->remotely_held) {</span><br><span> /* The remote side has put us on hold */</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16109">change 16109</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/+/16109"/><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-Change-Id: Icde805a819399d5123b688e1ed1d2bcd9d5b0f75 </div>
<div style="display:none"> Gerrit-Change-Number: 16109 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Bernd Zobl <b.zobl@commend.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-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>