<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9358">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Matthew Fredrickson: Looks good to me, but someone else must approve
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip: Add 'suppress_q850_reason_headers' option to endpoint<br><br>A new option 'suppress_q850_reason_headers' has been added to the<br>endpoint object. Some devices can't accept multiple Reason headers and<br>get confused when both 'SIP' and 'Q.850' Reason headers are received.<br>This option allows the 'Q.850' Reason header to be suppressed.<br>The default value is 'no'.<br><br>ASTERISK-27949<br>Reported-by: Ross Beer<br><br>Change-Id: I54cf37a827d77de2079256bb3de7e90fa5e1deb1<br>---<br>M CHANGES<br>M configs/samples/pjsip.conf.sample<br>A contrib/ast-db-manage/config/versions/19b00bc19b7b_add_suppress_q850_reason_headers_to_.py<br>M include/asterisk/res_pjsip.h<br>M res/res_pjsip.c<br>M res/res_pjsip/pjsip_configuration.c<br>M res/res_pjsip_rfc3326.c<br>7 files changed, 65 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/CHANGES b/CHANGES</span><br><span>index f7e1187..f79cd84 100644</span><br><span>--- a/CHANGES</span><br><span>+++ b/CHANGES</span><br><span>@@ -114,6 +114,17 @@</span><br><span> by the system.</span><br><span> </span><br><span> ------------------------------------------------------------------------------</span><br><span style="color: hsl(120, 100%, 40%);">+--- Functionality changes from Asterisk 15.5.0 to Asterisk 15.6.0 ------------</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%);">+res_pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+------------------</span><br><span style="color: hsl(120, 100%, 40%);">+ * A new option 'suppress_q850_reason_headers' has been added to the endpoint</span><br><span style="color: hsl(120, 100%, 40%);">+ object. Some devices can't accept multiple Reason headers and get confused</span><br><span style="color: hsl(120, 100%, 40%);">+ when both 'SIP' and 'Q.850' Reason headers are received. This option allows</span><br><span style="color: hsl(120, 100%, 40%);">+ the 'Q.850' Reason header to be suppressed. The default value is 'no'.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+------------------------------------------------------------------------------</span><br><span> --- Functionality changes from Asterisk 15.4.0 to Asterisk 15.5.0 ------------</span><br><span> ------------------------------------------------------------------------------</span><br><span> </span><br><span>diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample</span><br><span>index 5ec7a63..c2e2918 100644</span><br><span>--- a/configs/samples/pjsip.conf.sample</span><br><span>+++ b/configs/samples/pjsip.conf.sample</span><br><span>@@ -830,6 +830,13 @@</span><br><span> ; This option must also be enabled in the system</span><br><span> ; section.</span><br><span> ; (default: no)</span><br><span style="color: hsl(120, 100%, 40%);">+suppress_q850_reason_headers =</span><br><span style="color: hsl(120, 100%, 40%);">+ ; Suppress Q.850 Reason headers for this endpoint.</span><br><span style="color: hsl(120, 100%, 40%);">+ ; Some devices can't accept multiple Reason headers</span><br><span style="color: hsl(120, 100%, 40%);">+ ; and get confused when both 'SIP' and 'Q.850' Reason</span><br><span style="color: hsl(120, 100%, 40%);">+ ; headers are received. This option allows the</span><br><span style="color: hsl(120, 100%, 40%);">+ ; 'Q.850' Reason header to be suppressed.</span><br><span style="color: hsl(120, 100%, 40%);">+ ; (default: no)</span><br><span> </span><br><span> ;==========================AUTH SECTION OPTIONS=========================</span><br><span> ;[auth]</span><br><span>diff --git a/contrib/ast-db-manage/config/versions/19b00bc19b7b_add_suppress_q850_reason_headers_to_.py b/contrib/ast-db-manage/config/versions/19b00bc19b7b_add_suppress_q850_reason_headers_to_.py</span><br><span>new file mode 100644</span><br><span>index 0000000..bf58ad3</span><br><span>--- /dev/null</span><br><span>+++ b/contrib/ast-db-manage/config/versions/19b00bc19b7b_add_suppress_q850_reason_headers_to_.py</span><br><span>@@ -0,0 +1,27 @@</span><br><span style="color: hsl(120, 100%, 40%);">+"""add suppress_q850_reason_headers to endpoint</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Revision ID: 19b00bc19b7b</span><br><span style="color: hsl(120, 100%, 40%);">+Revises: 0be05c3a8225</span><br><span style="color: hsl(120, 100%, 40%);">+Create Date: 2018-07-06 06:30:32.196669</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%);">+# revision identifiers, used by Alembic.</span><br><span style="color: hsl(120, 100%, 40%);">+revision = '19b00bc19b7b'</span><br><span style="color: hsl(120, 100%, 40%);">+down_revision = '0be05c3a8225'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+from alembic import op</span><br><span style="color: hsl(120, 100%, 40%);">+import sqlalchemy as sa</span><br><span style="color: hsl(120, 100%, 40%);">+from sqlalchemy.dialects.postgresql import ENUM</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+YESNO_NAME = 'yesno_values'</span><br><span style="color: hsl(120, 100%, 40%);">+YESNO_VALUES = ['yes', 'no']</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+def upgrade():</span><br><span style="color: hsl(120, 100%, 40%);">+ yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)</span><br><span style="color: hsl(120, 100%, 40%);">+ op.add_column('ps_endpoints', sa.Column('suppress_q850_reason_header', yesno_values))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+def downgrade():</span><br><span style="color: hsl(120, 100%, 40%);">+ if op.get_context().bind.dialect.name == 'mssql':</span><br><span style="color: hsl(120, 100%, 40%);">+ op.drop_constraint('ck_ps_endpoints_suppress_q850_reason_header_yesno_values','ps_endpoints')</span><br><span style="color: hsl(120, 100%, 40%);">+ op.drop_column('ps_endpoints', 'suppress_q850_reason_header')</span><br><span>diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h</span><br><span>index b94269a..849f087 100644</span><br><span>--- a/include/asterisk/res_pjsip.h</span><br><span>+++ b/include/asterisk/res_pjsip.h</span><br><span>@@ -813,6 +813,8 @@</span><br><span> unsigned int refer_blind_progress;</span><br><span> /*! Whether to notifies dialog-info 'early' on INUSE && RINGING state */</span><br><span> unsigned int notify_early_inuse_ringing;</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! Suppress Q.850 Reason headers on this endpoint */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int suppress_q850_reason_headers;</span><br><span> };</span><br><span> </span><br><span> /*! URI parameter for symmetric transport */</span><br><span>diff --git a/res/res_pjsip.c b/res/res_pjsip.c</span><br><span>index 300c0de..507267a 100644</span><br><span>--- a/res/res_pjsip.c</span><br><span>+++ b/res/res_pjsip.c</span><br><span>@@ -1110,6 +1110,14 @@</span><br><span> </para></note></span><br><span> </description></span><br><span> </configOption></span><br><span style="color: hsl(120, 100%, 40%);">+ <configOption name="suppress_q850_reason_headers" default="no"></span><br><span style="color: hsl(120, 100%, 40%);">+ <synopsis>Suppress Q.850 Reason headers for this endpoint</synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+ <description><para></span><br><span style="color: hsl(120, 100%, 40%);">+ Some devices can't accept multiple Reason headers and get confused</span><br><span style="color: hsl(120, 100%, 40%);">+ when both 'SIP' and 'Q.850' Reason headers are received. This</span><br><span style="color: hsl(120, 100%, 40%);">+ option allows the 'Q.850' Reason header to be suppressed.</para></span><br><span style="color: hsl(120, 100%, 40%);">+ </description></span><br><span style="color: hsl(120, 100%, 40%);">+ </configOption></span><br><span> </configObject></span><br><span> <configObject name="auth"></span><br><span> <synopsis>Authentication type</synopsis></span><br><span>diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c</span><br><span>index f44ceb0..f4a9ecb 100644</span><br><span>--- a/res/res_pjsip/pjsip_configuration.c</span><br><span>+++ b/res/res_pjsip/pjsip_configuration.c</span><br><span>@@ -1904,6 +1904,7 @@</span><br><span> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "incoming_mwi_mailbox", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, incoming_mwi_mailbox));</span><br><span> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "follow_early_media_fork", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.follow_early_media_fork));</span><br><span> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "accept_multiple_sdp_answers", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.accept_multiple_sdp_answers));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "suppress_q850_reason_headers", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, suppress_q850_reason_headers));</span><br><span> </span><br><span> if (ast_sip_initialize_sorcery_transport()) {</span><br><span> ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");</span><br><span>diff --git a/res/res_pjsip_rfc3326.c b/res/res_pjsip_rfc3326.c</span><br><span>index 76b0d08..293c3db 100644</span><br><span>--- a/res/res_pjsip_rfc3326.c</span><br><span>+++ b/res/res_pjsip_rfc3326.c</span><br><span>@@ -98,8 +98,15 @@</span><br><span> ast_sip_add_header(tdata, "Reason", "SIP;cause=200;text=\"Call completed elsewhere\"");</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(buf, sizeof(buf), "Q.850;cause=%i", ast_channel_hangupcause(session->channel) & 0x7f);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sip_add_header(tdata, "Reason", buf);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (session->endpoint && session->endpoint->suppress_q850_reason_headers) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_debug(1, "A Q.850 '%s'(%i) Reason header was suppresed for endpoint '%s'\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cause2str((ast_channel_hangupcause(session->channel) & 0x7f)),</span><br><span style="color: hsl(120, 100%, 40%);">+ (ast_channel_hangupcause(session->channel) & 0x7f),</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sorcery_object_get_id(session->endpoint));</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(buf, sizeof(buf), "Q.850;cause=%i", ast_channel_hangupcause(session->channel) & 0x7f);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sip_add_header(tdata, "Reason", buf);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> </span><br><span> static void rfc3326_outgoing_request(struct ast_sip_session *session, struct pjsip_tx_data *tdata)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9358">change 9358</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/9358"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I54cf37a827d77de2079256bb3de7e90fa5e1deb1 </div>
<div style="display:none"> Gerrit-Change-Number: 9358 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Matthew Fredrickson <creslin@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>