<p>Igor Goncharovsky has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19211">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip:  Fix double Route headers in OPTIONS<br><br>Move aor proxy set to create_out_of_dialog_request() to prevent double set<br>of rpoxies in OPTIONS request.<br><br>ASTERISK-30224 #close<br><br>Change-Id: Ic43137cfcc468791bf4891ec9792bdb45043a5dc<br>---<br>M res/res_pjsip.c<br>M res/res_pjsip/pjsip_options.c<br>2 files changed, 30 insertions(+), 16 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/11/19211/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip.c b/res/res_pjsip.c</span><br><span>index c52ceec..076734c 100644</span><br><span>--- a/res/res_pjsip.c</span><br><span>+++ b/res/res_pjsip.c</span><br><span>@@ -1223,13 +1223,22 @@</span><br><span>        ast_sip_add_usereqphone(endpoint, (*tdata)->pool, (*tdata)->msg->line.req.uri);</span><br><span> </span><br><span>         /* If an outbound proxy is specified on the endpoint apply it to this request */</span><br><span style="color: hsl(0, 100%, 40%);">-        if (endpoint && !ast_strlen_zero(endpoint->outbound_proxy) &&</span><br><span style="color: hsl(0, 100%, 40%);">-                ast_sip_set_outbound_proxy((*tdata), endpoint->outbound_proxy)) {</span><br><span style="color: hsl(0, 100%, 40%);">-            ast_log(LOG_ERROR, "Unable to apply outbound proxy on request %.*s to endpoint %s as outbound proxy URI '%s' is not valid\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                 (int) pj_strlen(&method->name), pj_strbuf(&method->name), ast_sorcery_object_get_id(endpoint),</span><br><span style="color: hsl(0, 100%, 40%);">-                    endpoint->outbound_proxy);</span><br><span style="color: hsl(0, 100%, 40%);">-           pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);</span><br><span style="color: hsl(0, 100%, 40%);">-           return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+    if (pjsip_method_cmp(method, &pjsip_options_method)) {</span><br><span style="color: hsl(120, 100%, 40%);">+            if (contact && !ast_strlen_zero(contact->outbound_proxy) &&</span><br><span style="color: hsl(120, 100%, 40%);">+                        ast_sip_set_outbound_proxy((*tdata), contact->outbound_proxy)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                   ast_log(LOG_ERROR, "Unable to apply outbound proxy on request to qualify contact %s\n", contact->uri);</span><br><span style="color: hsl(120, 100%, 40%);">+                   pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);</span><br><span style="color: hsl(120, 100%, 40%);">+                 return -1;</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%);">+              if (endpoint && !ast_strlen_zero(endpoint->outbound_proxy) &&</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_sip_set_outbound_proxy((*tdata), endpoint->outbound_proxy)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                  ast_log(LOG_ERROR, "Unable to apply outbound proxy on request %.*s to endpoint %s as outbound proxy URI '%s' is not valid\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                               (int) pj_strlen(&method->name), pj_strbuf(&method->name), ast_sorcery_object_get_id(endpoint),</span><br><span style="color: hsl(120, 100%, 40%);">+                          endpoint->outbound_proxy);</span><br><span style="color: hsl(120, 100%, 40%);">+                 pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);</span><br><span style="color: hsl(120, 100%, 40%);">+                 return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+            }</span><br><span>    }</span><br><span> </span><br><span>        ast_sip_mod_data_set((*tdata)->pool, (*tdata)->mod_data, supplement_module.id, MOD_DATA_CONTACT, ao2_bump(contact));</span><br><span>diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c</span><br><span>index 7632dea..db8ea47 100644</span><br><span>--- a/res/res_pjsip/pjsip_options.c</span><br><span>+++ b/res/res_pjsip/pjsip_options.c</span><br><span>@@ -877,15 +877,6 @@</span><br><span>           return 0;</span><br><span>    }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   /* If an outbound proxy is specified set it on this request */</span><br><span style="color: hsl(0, 100%, 40%);">-  if (!ast_strlen_zero(contact->outbound_proxy) &&</span><br><span style="color: hsl(0, 100%, 40%);">-             ast_sip_set_outbound_proxy(tdata, contact->outbound_proxy)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                ast_log(LOG_ERROR, "Unable to apply outbound proxy on request to qualify contact %s\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                       contact->uri);</span><br><span style="color: hsl(0, 100%, 40%);">-               pjsip_tx_data_dec_ref(tdata);</span><br><span style="color: hsl(0, 100%, 40%);">-           return 0;</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>    contact_status = ast_res_pjsip_find_or_create_contact_status(contact);</span><br><span>       if (!contact_status) {</span><br><span>               ast_log(LOG_ERROR, "Unable to retrieve contact status information for contact %s on AOR %s\n",</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19211">change 19211</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/+/19211"/><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: Ic43137cfcc468791bf4891ec9792bdb45043a5dc </div>
<div style="display:none"> Gerrit-Change-Number: 19211 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Igor Goncharovsky <igor.goncharovsky@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>