<p>Torrey Searle has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10531">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res/res_pjsip_nat Fix logic for REINVITES<br><br>The presence of Record-Route in re-invites is optional, this it is<br>important to make sure the dialog doesn't have a routset before<br>rewriting the contact header.<br><br>ASTERISK-28129 #close<br><br>Change-Id: Ic8ceb54ccfc93f7e315e476c514a2c777f2da7dc<br>---<br>M res/res_pjsip_nat.c<br>1 file changed, 21 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/31/10531/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_nat.c b/res/res_pjsip_nat.c</span><br><span>index 370004a..a98d5f9 100644</span><br><span>--- a/res/res_pjsip_nat.c</span><br><span>+++ b/res/res_pjsip_nat.c</span><br><span>@@ -49,6 +49,7 @@</span><br><span> {</span><br><span> pjsip_rr_hdr *rr = NULL;</span><br><span> pjsip_sip_uri *uri;</span><br><span style="color: hsl(120, 100%, 40%);">+ int res = -1;</span><br><span> </span><br><span> if (rdata->msg_info.msg->type == PJSIP_RESPONSE_MSG) {</span><br><span> pjsip_hdr *iter;</span><br><span>@@ -65,16 +66,28 @@</span><br><span> if (rr) {</span><br><span> uri = pjsip_uri_get_uri(&rr->name_addr);</span><br><span> rewrite_uri(rdata, uri);</span><br><span style="color: hsl(0, 100%, 40%);">- if (dlg && !pj_list_empty(&dlg->route_set) && !dlg->route_set_frozen) {</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_routing_hdr *route = dlg->route_set.next;</span><br><span style="color: hsl(0, 100%, 40%);">- uri = pjsip_uri_get_uri(&route->name_addr);</span><br><span style="color: hsl(0, 100%, 40%);">- rewrite_uri(rdata, uri);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ res = 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (dlg && !pj_list_empty(&dlg->route_set) && !dlg->route_set_frozen) {</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_routing_hdr *route = dlg->route_set.next;</span><br><span style="color: hsl(120, 100%, 40%);">+ uri = pjsip_uri_get_uri(&route->name_addr);</span><br><span style="color: hsl(120, 100%, 40%);">+ rewrite_uri(rdata, uri);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = 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%);">+ if (!dlg && !rr) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /**</span><br><span style="color: hsl(120, 100%, 40%);">+ * Even if this message doesn't have any route headers</span><br><span style="color: hsl(120, 100%, 40%);">+ * the dialog may, so wait until a later invocation that</span><br><span style="color: hsl(120, 100%, 40%);">+ * has a dialog reference to make sure there isn't a </span><br><span style="color: hsl(120, 100%, 40%);">+ * previously saved routset in the dialog before deciding</span><br><span style="color: hsl(120, 100%, 40%);">+ * the contact needs to be modified</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = 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%);">+ return res;</span><br><span> }</span><br><span> </span><br><span> static int rewrite_contact(pjsip_rx_data *rdata, pjsip_dialog *dlg)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10531">change 10531</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/10531"/><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-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ic8ceb54ccfc93f7e315e476c514a2c777f2da7dc </div>
<div style="display:none"> Gerrit-Change-Number: 10531 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Torrey Searle <tsearle@gmail.com> </div>