<p>Sean Bright would like Torrey Searle to <strong>review</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13820">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res/res_pjsip_sdp_rtp: Fix MOH transitions<br><br>Update the state of remote_hold immediately on receipt of remote<br>SDP so that the information is available when building the SDP<br>answer<br><br>ASTERISK-28754 #close<br><br>Change-Id: I7026032a807e9c95081cb8f060400b05deb4836f<br>---<br>M include/asterisk/res_pjsip_session.h<br>M res/res_pjsip_sdp_rtp.c<br>2 files changed, 23 insertions(+), 11 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/20/13820/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/res_pjsip_session.h b/include/asterisk/res_pjsip_session.h</span><br><span>index 43ac9c0..e8ada40 100644</span><br><span>--- a/include/asterisk/res_pjsip_session.h</span><br><span>+++ b/include/asterisk/res_pjsip_session.h</span><br><span>@@ -89,6 +89,8 @@</span><br><span> int timeout_sched_id;</span><br><span> /*! \brief Stream is on hold by remote side */</span><br><span> unsigned int remotely_held:1;</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! \brief Stream is hold by remote side changed durign this handshake */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int remotely_held_changed:1;</span><br><span> /*! \brief Stream is on hold by local side */</span><br><span> unsigned int locally_held:1;</span><br><span> /*! \brief Does remote support rtcp_mux */</span><br><span>diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c</span><br><span>index d652fc4..724ff36 100644</span><br><span>--- a/res/res_pjsip_sdp_rtp.c</span><br><span>+++ b/res/res_pjsip_sdp_rtp.c</span><br><span>@@ -1406,6 +1406,19 @@</span><br><span> /* If ICE support is enabled find all the needed attributes */</span><br><span> check_ice_support(session, session_media, stream);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_sockaddr_isnull(addrs) ||</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sockaddr_is_any(addrs) ||</span><br><span style="color: hsl(120, 100%, 40%);">+ pjmedia_sdp_media_find_attr2(stream, "sendonly", NULL) ||</span><br><span style="color: hsl(120, 100%, 40%);">+ pjmedia_sdp_media_find_attr2(stream, "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> if (set_caps(session, session_media, session_media_transport, stream, 1, asterisk_stream)) {</span><br><span> return 0;</span><br><span> }</span><br><span>@@ -1997,22 +2010,19 @@</span><br><span> return 1;</span><br><span> }</span><br><span> </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(remote_stream, "sendonly", NULL) ||</span><br><span style="color: hsl(0, 100%, 40%);">- pjmedia_sdp_media_find_attr2(remote_stream, "inactive", NULL)) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!session_media->remotely_held) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (session_media->remotely_held_changed) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (session_media->remotely_held) {</span><br><span> /* The remote side has put us on hold */</span><br><span> ast_queue_hold(session->channel, session->endpoint->mohsuggest);</span><br><span> ast_rtp_instance_stop(session_media->rtp);</span><br><span> ast_queue_frame(session->channel, &ast_null_frame);</span><br><span style="color: hsl(0, 100%, 40%);">- session_media->remotely_held = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ session_media->remotely_held_changed = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* The remote side has taken us off hold */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_queue_unhold(session->channel);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_queue_frame(session->channel, &ast_null_frame);</span><br><span style="color: hsl(120, 100%, 40%);">+ session_media->remotely_held_changed = 0;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (session_media->remotely_held) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* The remote side has taken us off hold */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_unhold(session->channel);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_frame(session->channel, &ast_null_frame);</span><br><span style="color: hsl(0, 100%, 40%);">- session_media->remotely_held = 0;</span><br><span> } else if ((pjmedia_sdp_neg_was_answer_remote(session->inv_session->neg) == PJ_FALSE)</span><br><span> && (session->inv_session->state == PJSIP_INV_STATE_CONFIRMED)) {</span><br><span> ast_queue_control(session->channel, AST_CONTROL_UPDATE_RTP_PEER);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13820">change 13820</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/+/13820"/><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: I7026032a807e9c95081cb8f060400b05deb4836f </div>
<div style="display:none"> Gerrit-Change-Number: 13820 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Torrey Searle <tsearle@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>