<p>Hi <a href="https://github.com/doome" class="user-mention">@doome</a> , sorry for late handling on this patch.<br>
I checked a bit the whole logic in handling the routing and IMHO, your change is not correct.</p>

<p>The handle_sr() function is called from after_loose() when the next hop (indicated by Route hdrs) is marked as strict router. Coming via the after_loose() route, it means in RURI we have something else than our own IP (most probably the IP of the end point).<br>
Going back to handle_sr()....as next hop is strict , we need to place its IP in RURI; and not to loose what we have in RURI (the end point), this must be added as a last Route to the message.<br>
You say this insertion (of current RURI as Route) should be do only if there is another Route to follow, but this has no impact actually.</p>

<p>Let's take this example:</p>

<blockquote>
<p>RURI: end_point<br>
Route: myself;lr<br>
Route: proxy_sr</p>
</blockquote>

<p>after going through after_loose(), the local Route is dropped and the next route will point to "proxy_sr" which is strict route:</p>

<blockquote>
<p>RURI: end_point<br>
Route: proxy_sr</p>
</blockquote>

<p>Now, the handle_sr() should re-arrange the message as the next hop is a strict router. If you do it as per your patch, the RURI will not be saved into Route any more, and only have the proxy_sr moved into RURI:</p>

<blockquote>
<p>RURI: proxy_sr</p>
</blockquote>

<p>Which is wrong as you lost the last element in the routing set - the "end_point" ; the next proxy will have no idea where to send the message further.</p>

<p>Currently, without your patch, the result after handle_sr() is:</p>

<blockquote>
<p>RURI: proxy_sr<br>
Route: end_point</p>
</blockquote>

<p>so proxy_sr will know that it has to fwd the request to end_point.</p>

<p>Am I missing anything on your patch ?</p>

<p>Regards,<br>
Bogdan</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/pull/642#issuecomment-173560932">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciX7RlYKK-bH_uJ7wVATct4GOtJtrks5pcMxPgaJpZM4F_2xj.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/OpenSIPS/opensips/pull/642#issuecomment-173560932"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>