<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    <div class="moz-cite-prefix">On 6/22/12 1:33 AM, Richard Brady
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAN5esQKswyyh8y-VM-Xe2nKj0px1hiXkdNkiHx5LvF24T9uREA@mail.gmail.com"
      type="cite">Hi folks
      <div><br>
      </div>
      <div>I've configured Kamailio as a simply multi-homed proxy
        offering NAT traversa, TCP connection management, etc to
        FreeSWICH behind it. FreeSWITCH acts as the registrar.</div>
      <div><br>
      </div>
      <div>
        I'm trying to understand the default config and the following
        things don't make sense to me (I can't find documentation on
        these):</div>
      <div><br>
      </div>
      <div>1. The nat=yes flag. What does it mean exactly and why is it
        on the RR and not on the Contact/R-URI? Also, when double RR is
        enabled, why does it get added to both headers?</div>
    </blockquote>
    <br>
    it used to be in contact, but some times can get in troubles if the
    UA does not recognize it's address in the r-uri. Having it in
    record-/route headers does not interact with UAs, is just proxy's
    job. The parameter is used to detect if a call is natted, used
    mainly for re-INVITEs, where the destination user may not be present
    in r-uri.<br>
    <br>
    <br>
    <blockquote
cite="mid:CAN5esQKswyyh8y-VM-Xe2nKj0px1hiXkdNkiHx5LvF24T9uREA@mail.gmail.com"
      type="cite">
      <div><br>
      </div>
      <div>2. The FLT_NATS and FLB_NATB flags. I'd like to know what
        this stands for, I guess "flag for transaction - NAT" and "flag
        for branch - NAT" but what do the S and the B stand for? More
        importantly what do these flags mean? Is it correct to say that
        the first indicates the UAC / A-leg / requester is behind NAT
        and the second that the UAS / B-leg / responder is behind NAT?</div>
    </blockquote>
    yes, for initial invite is the case.<br>
    <br>
    <blockquote
cite="mid:CAN5esQKswyyh8y-VM-Xe2nKj0px1hiXkdNkiHx5LvF24T9uREA@mail.gmail.com"
      type="cite">
      <div><br>
      </div>
      <div>3. In the&nbsp;the NATMANAGE route of the&nbsp;default config we have:</div>
      <div><br>
      </div>
      <div>&nbsp; &nbsp; &nbsp; &nbsp; if (is_request()) {</div>
      <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(has_totag()) {</div>
      <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(check_route_param("nat=yes")) {</div>
      <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setbflag(FLB_NATB);</div>
      <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
      <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
      <div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>
      <div><br>
      </div>
      <div>Which to me means "if the message is a request inside an
        existing dialog ..." and I'm thinking, isn't this a bit late in
        the dialog to be setting NAT flags? I would expect to set the
        flag for the A-leg on the incoming request, and the flag for the
        B-leg on the incoming reply. I can't point in waiting for the
        ACK to try and work out whether this leg is behind NAT. And also
        it seem this set of if statements will also match incoming
        requests from the A-leg, so why are we setting a brach flag?
        Does that leg also also get the properties of a branch?</div>
    </blockquote>
    <br>
    B-leg behind the nat is detected based on location record. When B
    registers, it is detected being behind nat and FLB_NATB is saved in
    location and restored upon lookup(...).<br>
    <blockquote
cite="mid:CAN5esQKswyyh8y-VM-Xe2nKj0px1hiXkdNkiHx5LvF24T9uREA@mail.gmail.com"
      type="cite">
      <div><br>
      </div>
      <div>4. When I get a 200 OK coming from behind NAT it is not
        subjected to fix_nated_contact(), and this seems to be because
        it doesn't have the FLB_NATB flag set:</div>
      <div><br>
      </div>
      <div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; if (is_reply()) {</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(isbflagset(FLB_NATB)) {</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fix_nated_contact();</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>
      </div>
      <div><br>
      </div>
    </blockquote>
    The contact does not need a fix when it is a public address. When it
    is behind a nat, the fix will replace it with the ip and port of the
    nat router. There is another option for this, adding a parameter to
    the contact with the ip/port of the nat.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <br>
    <blockquote
cite="mid:CAN5esQKswyyh8y-VM-Xe2nKj0px1hiXkdNkiHx5LvF24T9uREA@mail.gmail.com"
      type="cite">
      <div>Any help clarifying would be much appreciated.</div>
      <div><br>
      </div>
      <div>Thanks,</div>
      <div>Richard</div>
      <div><br>
      </div>
      <div>
        <div>--</div>
        <div>Richard Brady</div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.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-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - <a class="moz-txt-link-freetext" href="http://asipto.com/u/katu">http://asipto.com/u/katu</a>
Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - <a class="moz-txt-link-freetext" href="http://asipto.com/u/kpw">http://asipto.com/u/kpw</a></pre>
  </body>
</html>