<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>I just added a note in the docs that it works only when RR has IP
      address in its URI.</p>
    <p>The reason is that the IP in RR is compared with source address
      in order to see if it is a loop, so if there is no IP in RR, then
      it returns false/-1.</p>
    <p>It is how the function was designed, if someone wants to make
      some alternative, just propose a patch.<br>
    </p>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 03.10.18 23:46, Joel Serrano wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMtXxQmak9M6KLXD0QK-wVoJR-oci6roRQKYNfaA_DTb=fB7Ow@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="ltr">I actually had this exact problem, and because I
        knew when I was first hop and when not, I ended up adding if
        conditions to solve the problem. I would love to know the answer
        to this too and the correct reason as to why it happens and how
        to correct it.
        <div><br>
        </div>
        <div><br>
          <div><br>
          </div>
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr">On Wed, Oct 3, 2018 at 11:34 PM Sergiu Pojoga
          <<a href="mailto:pojogas@gmail.com" moz-do-not-send="true">pojogas@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir="ltr">
            <div dir="ltr">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div dir="ltr">
                        <div dir="ltr">Hi ppl,
                          <div><br>
                          </div>
                          <div>If I add a FQDN advertise address to the
                            listen statement, <i><a
href="https://kamailio.org/docs/modules/4.3.x/modules/siputils.html#siputils.f.is_first_hop"
                                target="_blank" moz-do-not-send="true">is_first_hop()</a></i>
                            seems to return FALSE no matter how I play
                            with the listen and alias settings.</div>
                          <div><br>
                          </div>
                          <div>listen=udp:<a href="http://1.1.1.1:5060"
                              target="_blank" moz-do-not-send="true">1.1.1.1:5060</a>
                            advertise <a
                              href="http://sip.mydomain.net:5060"
                              target="_blank" moz-do-not-send="true">sip.mydomain.net:5060</a><br>
                          </div>
                          <div>alias="<a
                              href="http://sip.mydomain.net:5060"
                              target="_blank" moz-do-not-send="true">sip.mydomain.net:5060</a>"<br>
                          </div>
                          <div><br>
                          </div>
                          <div>This statement doesn't get executed in
                            the <i>onreply_route</i></div>
                          <div><br>
                          </div>
                          <div><i>onreply_route[MANAGE_REPLY] {</i></div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <blockquote style="margin:0px 0px 0px
                    40px;border:none;padding:0px">
                    <div dir="ltr">
                      <div dir="ltr">
                        <div dir="ltr">
                          <div dir="ltr">
                            <div>
                              <div><i>if(is_first_hop())</i></div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                  <blockquote style="margin:0px 0px 0px
                    40px;border:none;padding:0px">
                    <div dir="ltr">
                      <blockquote style="margin:0px 0px 0px
                        40px;border:none;padding:0px">
                        <div dir="ltr">
                          <div dir="ltr">
                            <div dir="ltr">
                              <div>
                                <div><i>set_contact_alias();  # contact
                                    alias doesn't get set?</i></div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </blockquote>
                    </div>
                  </blockquote>
                  <div dir="ltr"><i>}</i></div>
                  <div dir="ltr"><br>
                  </div>
                  <div><b>is_first_hop()</b></div>
                  <div dir="ltr"><i>"The function returns true if the
                      proxy is first hop after the original sender. For
                      incoming SIP replies, it means that top
                      Record-Route URI is 'myself' and source address is
                      not matching it"</i></div>
                  <div dir="ltr"><br>
                  </div>
                  <div><b>This is the reply.</b></div>
                  <div dir="ltr">
                    <div dir="ltr">2018/10/03 17:03:38.276846 <a
                        href="http://2.2.2.2:62033" target="_blank"
                        moz-do-not-send="true">2.2.2.2:62033</a> -> <a
                        href="http://1.1.1.1:5060" target="_blank"
                        moz-do-not-send="true">1.1.1.1:5060</a></div>
                    <div dir="ltr">SIP/2.0 200 OK</div>
                    <div dir="ltr">Via: SIP/2.0/UDP
                      sip.mydomain.net:5060;branch=z9hG4bK49b3.bfbe15.0;received=1.1.1.1</div>
                    <div dir="ltr">Via: SIP/2.0/UDP
                      10.10.10.10:5060;rport=5060;branch=z9hG4bK1af96136</div>
                    <div dir="ltr"><b>Record-Route</b>: <sip:<a
                        href="http://sip.mydomain.net" target="_blank"
                        moz-do-not-send="true">sip.mydomain.net</a>;lr=on;did=4cc.734></div>
                    <div dir="ltr">Contact: <<a
                        href="http://sip:888@10.17.0.35:62033"
                        target="_blank" moz-do-not-send="true">sip:888@10.17.0.35:62033</a>> </div>
                    <div dir="ltr"><br>
                    </div>
                    <div>Suggestions?</div>
                    <div><br>
                    </div>
                    <div>Thanks.</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          _______________________________________________<br>
          Kamailio (SER) - Users Mailing List<br>
          <a href="mailto:sr-users@lists.kamailio.org" target="_blank"
            moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
          <a
            href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio World Conference -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a>
Kamailio Advanced Training, Nov 12-14, 2018, in Berlin -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a></pre>
  </body>
</html>