<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Destination uri (for $dd) is set after lookup("location"). If you
    use default config, route[NAT] is executed before.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    On 12/20/10 2:48 PM, Deon Vermeulen wrote:
    <blockquote
      cite="mid:299B9B9C-ECAF-40E1-8869-FC7F5311F48E@gmail.com"
      type="cite">Thanks again.
      <div><br>
      </div>
      <div>So then my config should look something like:</div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div>
        <div># Caller NAT detection route<br>
          route[NAT] {<br>
          #!ifdef WITH_NAT<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;force_rport();<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (nat_uac_test("19")) {<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (method=="REGISTER") {<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fix_nated_register();<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fix_nated_contact();<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setflag(FLT_NATS);</div>
        <div><br>
        </div>
        <div>
          <div style="margin: 0px; font: 12px Courier;"><font
              class="Apple-style-span" face="Helvetica">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #
              If both clients are behind nat we can check to see if they
              are behind the same</font></div>
          <div style="margin: 0px; font: 12px Courier;"><font
              class="Apple-style-span" face="Helvetica">&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#
              external IP and optimize the media path to go directly
              between them</font></div>
          <div style="margin: 0px; font: 12px Courier;"><font
              class="Apple-style-span" face="Helvetica">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
              else&nbsp;&nbsp;if ( $si==$dd || $si==rd)&nbsp;</font><span
              class="Apple-style-span" style="font-family: Helvetica;">{</span></div>
          <div style="margin: 0px; font: 12px Courier;"><font
              class="Apple-style-span" face="Helvetica">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
              &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xlog("L_INFO", "Detected Two Clients Behind
              the Same NAT - Disabling RTPproxy");</font></div>
          <div style="margin: 0px; font: 12px Courier; min-height:
            14px;"><font class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp;
              &nbsp; &nbsp; &nbsp;<br class="webkit-block-placeholder">
            </font></div>
          <div style="margin: 0px; font: 12px Courier;"><font
              class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
              &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Do not use rtpproxy as the clients seem
              to be behind the same NAT</font></div>
          <div style="margin: 0px; font: 12px Courier;"><font
              class="Apple-style-span" face="Helvetica">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
              &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; resetflag(<span class="Apple-style-span"
                style="font-size: medium;">FLT_NATS</span>);</font></div>
          <div style="margin: 0px; font: 12px Courier;"><font
              class="Apple-style-span" face="Helvetica">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
              &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; resetflag(<span class="Apple-style-span"
                style="font-size: medium;">FLT_NATB</span>);</font></div>
          <div style="margin: 0px; font: 12px Courier;"><font
              class="Apple-style-span" face="Helvetica">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
              &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</font></div>
          <div style="margin: 0px; font: 12px Courier;"><font
              class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
              }</font></div>
        </div>
        <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; }</div>
        <div>#!endif<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br>
          }<br>
          <br>
          # RTPProxy control<br>
          route[RTPPROXY] {<br>
          #!ifdef WITH_NAT<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (is_method("BYE")) {<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unforce_rtp_proxy();<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (is_method("INVITE")){<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;force_rtp_proxy();<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!has_totag()) add_rr_param(";nat=yes");<br>
          #!endif<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br>
          }<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Rgds</div>
        <div>Deon</div>
      </div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div><br>
        <div>
          <div>On Dec 20, 2010, at 3:37 PM, Daniel-Constantin Mierla
            wrote:</div>
          <br class="Apple-interchange-newline">
          <blockquote type="cite">
            <div bgcolor="#ffffff" text="#000000"> Hello,<br>
              <br>
              that's a hint for a very old version, where cfg file
              language didn't had support for variables and avpops
              module was used for comparison (as you could see, $dd is
              stored in an avp and them compared with src ip -- no
              longer need for such workaround, just do if($si==$dd)
              ...).<br>
              <br>
              You have to plug the when you force usage of rtp proxy, so
              you skip it in such cases.<br>
              <br>
              Cheers,<br>
              Daniel<br>
              <br>
              On 12/20/10 2:32 PM, Deon Vermeulen wrote:
              <blockquote
                cite="mid:2886DC79-37E8-4F26-BFA1-CF5B796993C0@gmail.com"
                type="cite">Hi Daniel
                <div><br>
                </div>
                <div>Thank you so much for your feedback.</div>
                <div><br>
                </div>
                <div>I came upon the below post, but I'm unable to find
                  the example Norman posted.</div>
                <div><a moz-do-not-send="true"
                    href="http://www.mail-archive.com/users@openser.org/msg01932.html">http://www.mail-archive.com/users@openser.org/msg01932.html</a></div>
                <div><br>
                </div>
                <div>In short the end solution is:</div>
                <div><br>
                </div>
                <div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp;&nbsp;# If
                      both clients are behind nat we can check to see if
                      they are behind the same</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; #
                      external IP and optimize the media path to go
                      directly between them</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">else if
                      ( isflagset(2) and isflagset(3) )</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      {</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; log(1, "Both Clients are behind NAT");</font></div>
                  <div style="margin: 0px; font: 12px Courier;
                    min-height: 14px;"><font class="Apple-style-span"
                      face="Helvetica"><br>
                    </font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; # Store the destination domain into an AVP</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; avp_printf("i:450", "$dd");</font></div>
                  <div style="margin: 0px; font: 12px Courier;
                    min-height: 14px;"><font class="Apple-style-span"
                      face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;<br
                        class="webkit-block-placeholder">
                    </font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; if ( avp_check("i:450", "eq/$src_ip/g") )</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; {</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; &nbsp; &nbsp; xlog("L_INFO", "Detected Two Clients
                      Behind the Same NAT - Disabling Mediaproxy");</font></div>
                  <div style="margin: 0px; font: 12px Courier;
                    min-height: 14px;"><font class="Apple-style-span"
                      face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br
                        class="webkit-block-placeholder">
                    </font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; &nbsp; &nbsp; # Do not use mediaproxy as the clients
                      seem to be behind the same NAT</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; &nbsp; &nbsp; resetflag(2);</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; &nbsp; &nbsp; resetflag(3);</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</font></div>
                  <div style="margin: 0px; font: 12px Courier;
                    min-height: 14px;"><font class="Apple-style-span"
                      face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;<br
                        class="webkit-block-placeholder">
                    </font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      }</font></div>
                </div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div>I haven't tested yet, but would I be right in
                  saying my config should look something like:</div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div>####### Routing Logic ########<br>
                  <br>
                  <br>
                  # Main SIP request routing logic<br>
                  # - processing of any incoming SIP request starts with
                  this route<br>
                  route {<br>
                  <br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# per request initial checks<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;route(REQINIT);<br>
                  <br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# NAT detection<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;route(NAT);<br>
                  <br>
                  <br>
                  <br>
                  <br>
                  # Caller NAT detection route<br>
                  route[NAT] {<br>
                  #!ifdef WITH_NAT<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;force_rport();<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (nat_uac_test("19")) {<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (method=="REGISTER") {<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fix_nated_register();<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fix_nated_contact();<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setflag(FLT_NATS);<br>
                  <br>
                </div>
                <div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; &nbsp; # If both clients are behind nat we can
                      check to see if they are behind the same</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; &nbsp; &nbsp;# external IP and optimize the media path
                      to go directly between them</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; &nbsp; else if ( isflagset(<span
                        class="Apple-style-span" style="font-size:
                        medium;">FLT_NATS</span>) and isflagset(<span
                        class="Apple-style-span" style="font-size:
                        medium;">FLT_NATB</span>) )&nbsp;</font><span
                      class="Apple-style-span" style="font-family:
                      Helvetica;">{</span></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;log(1, "Both Clients are
                      behind NAT");</font></div>
                  <div style="margin: 0px; font: 12px Courier;
                    min-height: 14px;"><font class="Apple-style-span"
                      face="Helvetica"><br>
                    </font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;# Store the destination domain into an AVP</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;avp_printf("i:450",
                      "$dd");</font></div>
                  <div style="margin: 0px; font: 12px Courier;
                    min-height: 14px;"><font class="Apple-style-span"
                      face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;<br
                        class="webkit-block-placeholder">
                    </font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;if ( avp_check("i:450",
                      "eq/$src_ip/g") )&nbsp;</font><span
                      class="Apple-style-span" style="font-family:
                      Helvetica;">{</span></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp;xlog("L_INFO", "Detected Two Clients Behind the
                      Same NAT - Disabling RTPproxy");</font></div>
                  <div style="margin: 0px; font: 12px Courier;
                    min-height: 14px;"><font class="Apple-style-span"
                      face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br
                        class="webkit-block-placeholder">
                    </font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Do not use rtpproxy as
                      the clients seem to be behind the same NAT</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp;&nbsp;resetflag(<span class="Apple-style-span"
                        style="font-size: medium;">FLT_NATS</span>);</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp;resetflag(<span class="Apple-style-span"
                        style="font-size: medium;">FLT_NATB</span>);</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp; &nbsp;
                      &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font></div>
                  <div style="margin: 0px; font: 12px Courier;"><font
                      class="Apple-style-span" face="Helvetica">&nbsp; &nbsp; &nbsp;
                      &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; }</font></div>
                </div>
                <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; }</div>
                <div>#!endif<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br>
                  }<br>
                  <br>
                  # RTPProxy control<br>
                  route[RTPPROXY] {<br>
                  #!ifdef WITH_NAT<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (is_method("BYE")) {<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unforce_rtp_proxy();<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (is_method("INVITE")){<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;force_rtp_proxy();<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!has_totag()) add_rr_param(";nat=yes");<br>
                  #!endif<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br>
                  }<br>
                </div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div>Rgds</div>
                <div>Deon</div>
                <div><br>
                </div>
                <div><br>
                  <div>
                    <div>On Dec 20, 2010, at 2:41 PM, Daniel-Constantin
                      Mierla wrote:</div>
                    <br class="Apple-interchange-newline">
                    <blockquote type="cite">
                      <div>Hello,<br>
                        <br>
                        On 12/20/10 11:25 AM, Deon Vermeulen wrote:<br>
                        <blockquote type="cite">Hi List<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite">Can someone please help
                          me?<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite">I need to implement PBX
                          Services for a customer that has 10 IP Phones
                          at his Main site and then 20 IP Phones located
                          over 5 Branches.<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite">My goal is to have RTP
                          go end to end and not proxied.<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite">I had a look at the
                          below link and tried &nbsp;it, but with no luck.<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"><a
                            moz-do-not-send="true"
href="http://kamailio.org/dokuwiki/doku.php/examples:caller-callee-behind-same-nat">http://kamailio.org/dokuwiki/doku.php/examples:caller-callee-behind-same-nat</a><br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite">Here is a partial output
                          of my kamailio.cfg file if someone would be so
                          kind to help me.<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite">#!ifdef WITH_NAT<br>
                        </blockquote>
                        <blockquote type="cite"># ----- rtpproxy params
                          -----<br>
                        </blockquote>
                        <blockquote type="cite">modparam("rtpproxy",
                          "rtpproxy_sock", "udp:localhost:7722")<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"># ----- nathelper params
                          -----<br>
                        </blockquote>
                        <blockquote type="cite">modparam("nathelper",
                          "natping_interval", 30)<br>
                        </blockquote>
                        <blockquote type="cite">modparam("nathelper",
                          "ping_nated_only", 1)<br>
                        </blockquote>
                        <blockquote type="cite">modparam("nathelper",
                          "sipping_bflag", FLB_NATSIPPING)<br>
                        </blockquote>
                        <blockquote type="cite">modparam("nathelper",
                          "sipping_from", "<a moz-do-not-send="true"
                            href="sip:pinger@x.x.x.x">sip:pinger@x.x.x.x</a>")<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"># params needed for NAT
                          traversal in other modules<br>
                        </blockquote>
                        <blockquote type="cite">modparam("nathelper|registrar",

                          "received_avp", "$avp(RECEIVED)")<br>
                        </blockquote>
                        <blockquote type="cite">modparam("usrloc",
                          "nat_bflag", FLB_NATB)<br>
                        </blockquote>
                        <blockquote type="cite">#!endif<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite">####### Routing Logic
                          ########<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"># Main SIP request
                          routing logic<br>
                        </blockquote>
                        <blockquote type="cite"># - processing of any
                          incoming SIP request starts with this route<br>
                        </blockquote>
                        <blockquote type="cite">route {<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# per request
                          initial checks<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;route(REQINIT);<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# NAT detection<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;route(NAT);<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"># Caller NAT detection
                          route<br>
                        </blockquote>
                        <blockquote type="cite">route[NAT] {<br>
                        </blockquote>
                        <blockquote type="cite">#!ifdef WITH_NAT<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;force_rport();<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
                          (nat_uac_test("19")) {<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
                          (method=="REGISTER") {<br>
                        </blockquote>
                        <blockquote type="cite">
                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fix_nated_register();<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else
                          {<br>
                        </blockquote>
                        <blockquote type="cite">
                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fix_nated_contact();<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                        </blockquote>
                        <blockquote type="cite">
                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setflag(FLT_NATS);<br>
                        </blockquote>
                      </div>
                    </blockquote>
                    <div><br>
                    </div>
                    <br>
                    <blockquote type="cite">
                      <div>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                        </blockquote>
                        <blockquote type="cite">#!endif<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br>
                        </blockquote>
                        <blockquote type="cite">}<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"># RTPProxy control<br>
                        </blockquote>
                        <blockquote type="cite">route[RTPPROXY] {<br>
                        </blockquote>
                        <blockquote type="cite">#!ifdef WITH_NAT<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
                          (is_method("BYE")) {<br>
                        </blockquote>
                        <blockquote type="cite">
                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unforce_rtp_proxy();<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if
                          (is_method("INVITE")){<br>
                        </blockquote>
                        <blockquote type="cite">
                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;force_rtp_proxy();<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
                          (!has_totag()) add_rr_param(";nat=yes");<br>
                        </blockquote>
                        <blockquote type="cite">#!endif<br>
                        </blockquote>
                        <blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return;<br>
                        </blockquote>
                        <blockquote type="cite">}<br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        <blockquote type="cite"><br>
                        </blockquote>
                        what you have to do is to check if the source is
                        natted and $si==$dd, then callee and caller are
                        behind same nat (if there is one level of nat),
                        so you don't force rtpproxy usage.<br>
                        <br>
                        Cheers,<br>
                        Daniel<br>
                        <br>
                        -- <br>
                        Daniel-Constantin Mierla<br>
                        Kamailio (OpenSER) Advanced Training<br>
                        Jan 24-26, 2011, Irvine, CA, USA<br>
                        <a moz-do-not-send="true"
                          href="http://www.asipto.com/">http://www.asipto.com</a><br>
                        <br>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </blockquote>
              <br>
              <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.asipto.com/">http://www.asipto.com</a></pre>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
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
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
<a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
  </body>
</html>