<!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 text="#000000" bgcolor="#ffffff">
    <tt>Hello Simon,<br>
      <br>
      Most probably it is a mistake on the way you do record_routing
      (for initial INVITE) and loose_route (for sequential requests).
      All sequential requests are driven by this mechanism. If the case,
      check how it suppose to work :<br>
      &nbsp;&nbsp;&nbsp; <a class="moz-txt-link-freetext" href="http://www.opensips.org/Documentation/Webinars#toc12">http://www.opensips.org/Documentation/Webinars#toc12</a>&nbsp; (5.5)<br>
      <br>
      Basically you need to do record_route() for INVITE and
      loose_route() for ACK - OpenSIPS will take care of changing the
      interface for the ACK after the loose_route() call.<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <br>
    On 10/25/2013 07:42 PM, Simon Quigley wrote:
    <blockquote
cite="mid:CABCte3A7Xp4svkTgqAxjw-tbp2rZ8zJn0zD1TCX1YKKE=6md1A@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>Hello,<br>
                  <br>
                </div>
                I'm trying to use OpenSIPS as a TCP to UDP proxy, (with
                the registrar module disabled) connecting all sorts of
                devices from different IP addresses over TCP to a UDP
                switch.<br>
                <br>
                So far I've managed to get OpenSIPS configured to change
                the contact header, and the SDP, append the transport,
                and forward the packets correctly, for making an
                outbound call (from TCP device to UDP switch).<br>
                <br>
              </div>
              I've got incoming to work somewhat (from UDP switch to TCP
              device), the INVITE will pass, and the TRYING/RINGING gets
              back to the switch, however the issue I'm having is that
              the OK packet from the TCP device is sent to the switch,
              which responds with the ACK, however the contact header is
              wrong, and OpenSIPS is trying to sent the ACK to the
              internal non routable IP of the device.<br>
              <br>
              As a result the call comes up, but the device has an ACK
              timeout and drops the call.<br>
              <br>
            </div>
            I'm having difficulties working out how to get the contact
            header mangled sufficiently for the OK/ACK to contain the
            routable IP of the TCP device, rather than it's
            internal/behind NAT IP.<br>
            <br>
          </div>
          I've tried removing the header, using loose_route, using
          t_relay, and (am currently attempting) to use route(relay).<br>
          <br>
        </div>
        <div>Also of relevance, is the fact that I'm running OpenSIPS on
          a Google Compute VM, so it's behind 1 to 1 NAT, with a non
          routable IP on the VM, but I have assigned a static routable
          IP to the 1 to 1 NAT, and I have DNS pointing to this routable
          IP.<br>
        </div>
        <div><br>
        </div>
        Here's my config file, excluding default values/routes etc:<br>
        <br>
        listen=udp:[internal VM IP]:5060<br>
        listen=tcp:[internal VM IP]:5060<br>
        <br>
        disable_tcp=no<br>
        <br>
        advertised_address="[DNS name]"<br>
        alias="[DNS name]"<br>
        <br>
        route{<br>
        &nbsp;&nbsp;&nbsp; if (src_ip != "[switch ip]"){<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # from device<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (is_method("INVITE")) {<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fix_nated_sdp("7");<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (is_method("OPTIONS")){<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit;<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
        <br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fix_nated_contact();<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; forward ("udp:[switch ip]:5060");<br>
        &nbsp;&nbsp;&nbsp; }<br>
        <br>
        &nbsp;&nbsp;&nbsp; else if (src_ip == "[switch ip]"){<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # from switch<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (is_method("INVITE")) {<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fix_nated_sdp("7");<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (is_method("ACK")) {<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fix_nated_contact();<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
        <br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; # mangle to TCP<br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $du = $ru + ";transport=tcp";<br>
        <br>
        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; route(relay);<br>
        &nbsp;&nbsp;&nbsp; }<br>
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>
        }<br>
        <br clear="all">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>Is the issue perhaps related to the fact I'm not
                    recording a route, so it doesn't know how to
                    correctly route the response, or am I just missing
                    something obvious?<br>
                    <br>
                  </div>
                  <div>Thanks,<br>
                    Simon<br>
                  </div>
                  <div><br>
                    -- <br>
                    Simon Quigley, Systems Engineer<br>
                    Versature Corp. &nbsp;| &nbsp;<a moz-do-not-send="true"
                      value="+18774983772">877-498-3772 x128</a><br>
                    <br>
                    Follow us on Twitter - <a moz-do-not-send="true"
                      href="http://twitter.com/Versature"
                      target="_blank">http://twitter.com/Versature</a><br>
                    Check out the Versature Blog - <a
                      moz-do-not-send="true"
                      href="http://inside.versature.com" target="_blank">http://inside.versature.com</a>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </body>
</html>