<p>Torrey Searle has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11102">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_pjsip: add a flag to ignore 183 responses if no SDP present<br><br>chan_sip will always ignore 183 responses that do not contain SDP<br>however, chan_pjsip will currently always translate it into a<br>183 with SDP. This new flag allows chan_pjsip to have the same<br>behavior as chan_sip.<br><br>ASTERISK-28322 #close<br><br>Change-Id: If81cfaa17c11b6ac703e3d71696f259d86c6be4a<br>---<br>M CHANGES<br>M channels/chan_pjsip.c<br>M configs/samples/pjsip.conf.sample<br>A contrib/ast-db-manage/config/versions/80473bad3c16_ignore_183_without_sdp.py<br>M include/asterisk/res_pjsip.h<br>M res/res_pjsip.c<br>M res/res_pjsip/pjsip_configuration.c<br>7 files changed, 79 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/02/11102/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/CHANGES b/CHANGES</span><br><span>index d347507..3f0c84e 100644</span><br><span>--- a/CHANGES</span><br><span>+++ b/CHANGES</span><br><span>@@ -92,6 +92,13 @@</span><br><span> RECOMMENDED), keep the current behavior, or trigger only on pjsip</span><br><span> taskprocessor overloads.</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+chan_pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+------------------</span><br><span style="color: hsl(120, 100%, 40%);">+ * A new configuration parameter 'ignore_183_without_sdp' has been added</span><br><span style="color: hsl(120, 100%, 40%);">+ to the pjsip.conf "endpoints" section. If enabled, will make chan_pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+ not discard 183 that do not contain an SDP body, which can resolve no</span><br><span style="color: hsl(120, 100%, 40%);">+ ringback tone issues as well as making the behavior match chan_sip.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> MWI</span><br><span> ------------------</span><br><span> * A new module "res_mwi_devstate" has been added that allows subscriptions</span><br><span>diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c</span><br><span>index e44f328..55cd9ed 100644</span><br><span>--- a/channels/chan_pjsip.c</span><br><span>+++ b/channels/chan_pjsip.c</span><br><span>@@ -3014,7 +3014,14 @@</span><br><span> ast_channel_unlock(session->channel);</span><br><span> break;</span><br><span> case 183:</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_control(session->channel, AST_CONTROL_PROGRESS);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (session->endpoint->ignore_183_without_sdp) {</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_rdata_sdp_info *sdp = pjsip_rdata_get_sdp_info(rdata);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sdp && sdp->body.ptr) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_queue_control(session->channel, AST_CONTROL_PROGRESS);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_queue_control(session->channel, AST_CONTROL_PROGRESS);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> break;</span><br><span> case 200:</span><br><span> ast_queue_control(session->channel, AST_CONTROL_ANSWER);</span><br><span>diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample</span><br><span>index 29f53a5..fcc8c4a 100644</span><br><span>--- a/configs/samples/pjsip.conf.sample</span><br><span>+++ b/configs/samples/pjsip.conf.sample</span><br><span>@@ -858,6 +858,15 @@</span><br><span> ; headers are received. This option allows the</span><br><span> ; 'Q.850' Reason header to be suppressed.</span><br><span> ; (default: no)</span><br><span style="color: hsl(120, 100%, 40%);">+;ignore_183_without_sdp =</span><br><span style="color: hsl(120, 100%, 40%);">+ ; Do not forward 183 when it doesn't contain SDP</span><br><span style="color: hsl(120, 100%, 40%);">+ ; Certian SS7 internetworking scenarios can result in</span><br><span style="color: hsl(120, 100%, 40%);">+ ; a 183 to be generated for reasons other than early</span><br><span style="color: hsl(120, 100%, 40%);">+ ; media. Forwarding this 183 can cause loss of</span><br><span style="color: hsl(120, 100%, 40%);">+ ; ringback tone. This flag emulates the behavior of</span><br><span style="color: hsl(120, 100%, 40%);">+ ; chan_sip and prevents these 183 responses from</span><br><span style="color: hsl(120, 100%, 40%);">+ ; being forwarded.</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/80473bad3c16_ignore_183_without_sdp.py b/contrib/ast-db-manage/config/versions/80473bad3c16_ignore_183_without_sdp.py</span><br><span>new file mode 100644</span><br><span>index 0000000..d05e2d5</span><br><span>--- /dev/null</span><br><span>+++ b/contrib/ast-db-manage/config/versions/80473bad3c16_ignore_183_without_sdp.py</span><br><span>@@ -0,0 +1,38 @@</span><br><span style="color: hsl(120, 100%, 40%);">+"""ignore 183 without sdp</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Revision ID: 80473bad3c16</span><br><span style="color: hsl(120, 100%, 40%);">+Revises: f3c0b8695b66</span><br><span style="color: hsl(120, 100%, 40%);">+Create Date: 2019-03-04 08:30:51.592907</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 = '80473bad3c16'</span><br><span style="color: hsl(120, 100%, 40%);">+down_revision = 'f3c0b8695b66'</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%);">+AST_BOOL_NAME = 'ast_bool_values'</span><br><span style="color: hsl(120, 100%, 40%);">+# We'll just ignore the n/y and f/t abbreviations as Asterisk does not write</span><br><span style="color: hsl(120, 100%, 40%);">+# those aliases.</span><br><span style="color: hsl(120, 100%, 40%);">+AST_BOOL_VALUES = [ '0', '1',</span><br><span style="color: hsl(120, 100%, 40%);">+ 'off', 'on',</span><br><span style="color: hsl(120, 100%, 40%);">+ 'false', 'true',</span><br><span style="color: hsl(120, 100%, 40%);">+ 'no', 'yes' ]</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%);">+ ############################# Enums ##############################</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # ast_bool_values has already been created, so use postgres enum object</span><br><span style="color: hsl(120, 100%, 40%);">+ # type to get around "already created" issue - works okay with mysql</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ op.add_column('ps_endpoints', sa.Column('ignore_183_without_sdp', ast_bool_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_ignore_183_without_sdp_ast_bool_values', 'ps_endpoints')</span><br><span style="color: hsl(120, 100%, 40%);">+ op.drop_column('ps_endpoints', 'ignore_183_without_sdp')</span><br><span style="color: hsl(120, 100%, 40%);">+ pass</span><br><span>diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h</span><br><span>index fd053b3..3ef0ae9 100644</span><br><span>--- a/include/asterisk/res_pjsip.h</span><br><span>+++ b/include/asterisk/res_pjsip.h</span><br><span>@@ -845,6 +845,12 @@</span><br><span> unsigned int notify_early_inuse_ringing;</span><br><span> /*! Suppress Q.850 Reason headers on this endpoint */</span><br><span> unsigned int suppress_q850_reason_headers;</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! Do we accept connected line updates from this endpoint? */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int trust_connected_line;</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! Do we send connected line updates to this endpoint? */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int send_connected_line;</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! Ignore 183 if no SDP is present */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int ignore_183_without_sdp;</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 24796fc..ab90a42 100644</span><br><span>--- a/res/res_pjsip.c</span><br><span>+++ b/res/res_pjsip.c</span><br><span>@@ -1127,6 +1127,16 @@</span><br><span> option allows the 'Q.850' Reason header to be suppressed.</para></span><br><span> </description></span><br><span> </configOption></span><br><span style="color: hsl(120, 100%, 40%);">+ <configOption name="ignore_183_without_sdp" default="no"></span><br><span style="color: hsl(120, 100%, 40%);">+ <synopsis>Do not forward 183 when it doesn't contain SDP</synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+ <description><para></span><br><span style="color: hsl(120, 100%, 40%);">+ Certian SS7 internetworking scenarios can result in a 183</span><br><span style="color: hsl(120, 100%, 40%);">+ to be generated for reasons other than early media. Forwarding</span><br><span style="color: hsl(120, 100%, 40%);">+ this 183 can cause loss of ringback tone. This flag emulates</span><br><span style="color: hsl(120, 100%, 40%);">+ the behavior of chan_sip and prevents these 183 responses from</span><br><span style="color: hsl(120, 100%, 40%);">+ being forwarded.</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 e6ac8ec..050073b 100644</span><br><span>--- a/res/res_pjsip/pjsip_configuration.c</span><br><span>+++ b/res/res_pjsip/pjsip_configuration.c</span><br><span>@@ -1949,6 +1949,7 @@</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> 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 style="color: hsl(120, 100%, 40%);">+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "ignore_183_without_sdp", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, ignore_183_without_sdp));</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></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11102">change 11102</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/+/11102"/><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: If81cfaa17c11b6ac703e3d71696f259d86c6be4a </div>
<div style="display:none"> Gerrit-Change-Number: 11102 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Torrey Searle <tsearle@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>