<p>Torrey Searle has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11086">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 channels/chan_pjsip.c<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/pjsip_configuration.c<br>4 files changed, 49 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/86/11086/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 062fb7c..36cc0ad 100644</span><br><span>--- a/channels/chan_pjsip.c</span><br><span>+++ b/channels/chan_pjsip.c</span><br><span>@@ -2742,7 +2742,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/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 7854df7..65a0075 100644</span><br><span>--- a/include/asterisk/res_pjsip.h</span><br><span>+++ b/include/asterisk/res_pjsip.h</span><br><span>@@ -800,6 +800,8 @@</span><br><span>   unsigned int trust_connected_line;</span><br><span>   /*! Do we send connected line updates to this endpoint? */</span><br><span>   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/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c</span><br><span>index 40948c3..4f7beb6 100644</span><br><span>--- a/res/res_pjsip/pjsip_configuration.c</span><br><span>+++ b/res/res_pjsip/pjsip_configuration.c</span><br><span>@@ -1901,6 +1901,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, 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, 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/+/11086">change 11086</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/+/11086"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: If81cfaa17c11b6ac703e3d71696f259d86c6be4a </div>
<div style="display:none"> Gerrit-Change-Number: 11086 </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>