<p>Ivan Poddubny has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15304">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_pjsip: Stop queueing control frames twice on outgoing channels<br><br>The fix for ASTERISK-27902 made chan_pjsip process SIP responses twice.<br>This resulted in extra noise in logs (for example, "is making progress"<br>and "is ringing" get logged twice by app_dial), as well as in noise in<br>signalling: one incoming 183 Session Progress results in 2 outgoing 183-s.<br><br>This change splits the response handler into 2 functions:<br> - one for updating HANGUPCAUSE, which is still called twice,<br> - another that does the rest, which is called only once as before.<br><br>ASTERISK-28016<br>Reported-by: Alex Hermann<br><br>ASTERISK-28549<br>Reported-by: Gant Liu<br><br>ASTERISK-28185<br>Reported-by: Julien<br><br>Change-Id: I0a1874be5bb5ed12d572d17c7f80de6e5e542940<br>---<br>M channels/chan_pjsip.c<br>1 file changed, 17 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/04/15304/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c</span><br><span>index 649dd36..1e54e84 100644</span><br><span>--- a/channels/chan_pjsip.c</span><br><span>+++ b/channels/chan_pjsip.c</span><br><span>@@ -137,6 +137,7 @@</span><br><span> static void chan_pjsip_session_end(struct ast_sip_session *session);</span><br><span> static int chan_pjsip_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata);</span><br><span> static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata);</span><br><span style="color: hsl(120, 100%, 40%);">+static void chan_pjsip_incoming_response_update_cause(struct ast_sip_session *session, struct pjsip_rx_data *rdata);</span><br><span> </span><br><span> /*! \brief SIP session supplement structure */</span><br><span> static struct ast_sip_session_supplement chan_pjsip_supplement = {</span><br><span>@@ -145,6 +146,7 @@</span><br><span> .session_begin = chan_pjsip_session_begin,</span><br><span> .session_end = chan_pjsip_session_end,</span><br><span> .incoming_request = chan_pjsip_incoming_request,</span><br><span style="color: hsl(120, 100%, 40%);">+ .incoming_response = chan_pjsip_incoming_response,</span><br><span> /* It is important that this supplement runs after media has been negotiated */</span><br><span> .response_priority = AST_SIP_SESSION_AFTER_MEDIA,</span><br><span> };</span><br><span>@@ -153,7 +155,7 @@</span><br><span> static struct ast_sip_session_supplement chan_pjsip_supplement_response = {</span><br><span> .method = "INVITE",</span><br><span> .priority = AST_SIP_SUPPLEMENT_PRIORITY_CHANNEL,</span><br><span style="color: hsl(0, 100%, 40%);">- .incoming_response = chan_pjsip_incoming_response,</span><br><span style="color: hsl(120, 100%, 40%);">+ .incoming_response = chan_pjsip_incoming_response_update_cause,</span><br><span> .response_priority = AST_SIP_SESSION_BEFORE_MEDIA | AST_SIP_SESSION_AFTER_MEDIA,</span><br><span> };</span><br><span> </span><br><span>@@ -3080,7 +3082,7 @@</span><br><span> };</span><br><span> </span><br><span> /*! \brief Function called when a response is received on the session */</span><br><span style="color: hsl(0, 100%, 40%);">-static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata)</span><br><span style="color: hsl(120, 100%, 40%);">+static void chan_pjsip_incoming_response_update_cause(struct ast_sip_session *session, struct pjsip_rx_data *rdata)</span><br><span> {</span><br><span> struct pjsip_status_line status = rdata->msg_info.msg->line.status;</span><br><span> struct ast_control_pvt_cause_code *cause_code;</span><br><span>@@ -3106,6 +3108,19 @@</span><br><span> ast_queue_control_data(session->channel, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);</span><br><span> ast_channel_hangupcause_hash_set(session->channel, cause_code, data_size);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_RTN("%s\n", ast_sip_session_get_name(session));</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%);">+/*! \brief Function called when a response is received on the session */</span><br><span style="color: hsl(120, 100%, 40%);">+static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct pjsip_status_line status = rdata->msg_info.msg->line.status;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_ENTER(3, "%s: Status: %d\n", ast_sip_session_get_name(session), status.code);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!session->channel) {</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_RTN("%s: No channel\n", ast_sip_session_get_name(session));</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> switch (status.code) {</span><br><span> case 180:</span><br><span> ast_trace(-1, "%s: Queueing RINGING\n", ast_sip_session_get_name(session));</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15304">change 15304</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/+/15304"/><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: I0a1874be5bb5ed12d572d17c7f80de6e5e542940 </div>
<div style="display:none"> Gerrit-Change-Number: 15304 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Ivan Poddubny <ivan.poddubny@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>