<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Am 11.01.2013 02:12, schrieb Richard
      Brady:<br>
    </div>
    <blockquote
cite="mid:CAN5esQ+T=ZzQkVu6RDRCszNSN7ftP6m6ru5pu4AofDqyNHayMw@mail.gmail.com"
      type="cite">Hi Klaus
      <div><br>
      </div>
      <div>Thanks for posting the &nbsp;working solution.</div>
      <div><br>
      </div>
      <div>You are right that mhomed=1 won't help if the sockets both
        have same IP address. </div>
    </blockquote>
    <br>
    That's true.<br>
    <blockquote
cite="mid:CAN5esQ+T=ZzQkVu6RDRCszNSN7ftP6m6ru5pu4AofDqyNHayMw@mail.gmail.com"
      type="cite">
      <div>Though I think if you used it with two different IPs and the
        correct routing tables on the OS then it would work. <br>
      </div>
    </blockquote>
    <br>
    I have not tried it, but I think it depends on the actual setup.<br>
    <br>
    If both IP addresses are in the same subnet, then it might work if
    Linux uses the "local" IP address for local calls and the "external"
    IP address for external call (i think this can be done with having
    the local as eth0 and the external as eth0.1 and specyfing the
    default gateway for eth0.1 instead for eth0.)<br>
    <br>
    If the two IP addresses are in different subnets, then mhomed=1
    should indeed work and the force_send_socket() calls could be
    removed.<br>
    <br>
    regards<br>
    Klaus<br>
    <br>
    <blockquote
cite="mid:CAN5esQ+T=ZzQkVu6RDRCszNSN7ftP6m6ru5pu4AofDqyNHayMw@mail.gmail.com"
      type="cite">
      <div><br>
      </div>
      <div>In any case your solution is a good one.&nbsp;</div>
      <div><br>
      </div>
      <div>Richard</div>
      <div><br>
        <div class="gmail_quote">On 7 January 2013 15:45, Klaus Darilion
          <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:klaus.mailinglists@pernau.at" target="_blank">klaus.mailinglists@pernau.at</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all!
            <div class="im"><br>
              <br>
              On 04.01.2013 18:57, Ovidiu Sas wrote:<br>
              <blockquote class="gmail_quote" style="margin:0 0 0
                .8ex;border-left:1px #ccc solid;padding-left:1ex">
                Hello Klauss,<br>
                <br>
                I use record_route_preset for this kind of scenarios:<br>
                <a moz-do-not-send="true"
href="http://kamailio.org/docs/modules/3.3.x/modules_k/rr.html#id2550086"
                  target="_blank">http://kamailio.org/docs/modules/3.3.x/modules_k/rr.html#id2550086</a><br>
                That was the main reason that I enhanced
                record_route_preset with the<br>
                second parameter (see the Note on string2).<br>
                <br>
                I haven't tried your idea with two sockets. &nbsp;Let us know
                if it's working.<br>
                If you need to use the same port on the internal and
                external<br>
                interface, you could add a new IP to the host and listen
                on two<br>
                sockets on the same port and force the socket when
                sending a request<br>
                out.<br>
                listen=udp:10.10.0.2<br>
                listen=udp:10.10.0.3 advertise pu.bl.ic.ip<br>
              </blockquote>
              <br>
            </div>
            I did some basic tests (incoming, outgoing, on/off-hold).
            The service provider's SIP trunk was an Asterisk with NAT
            traversal disabled. Kamailio was NATed 1:1 to the public IP
            address (exclusively, without port translation). I tested
            Kamailio only doing near-end NAT-traversal (taking care of
            its own NAT).<br>
            <br>
            I used two IP addresses for the two sockets, but I must
            works also with a single IP address and different ports.<br>
            <br>
            Conclusion: works :-)<br>
            <br>
            Following is the setup how I tested it (if you need to add
            far-end NAT traversal (SIP clients behind another NAT) then
            it will more complex).<br>
            <br>
            regards<br>
            Klaus<br>
            <br>
            <br>
            # Service Provider for SIP Trunk: &nbsp; &nbsp; &nbsp; &nbsp; 5.5.5.5<br>
            # public IP address of Kamailio/rtpproxy: 3.3.3.3<br>
            # rtpproxy binds to 10.10.0.3<br>
            listen=udp:10.10.0.2<br>
            listen=udp:10.10.0.3 advertise <a moz-do-not-send="true"
              href="http://3.3.3.3:5060" target="_blank">3.3.3.3:5060</a><br>
            mhomed=0<br>
            <br>
            route[RELAY] {<br>
            &nbsp; &nbsp; &nbsp; &nbsp; if (src_ip == 5.5.5.5) {<br>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; force_send_socket("10.10.0.2");<br>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rtpproxy_manage("","10.10.0.3");<br>
            &nbsp; &nbsp; &nbsp; &nbsp; } else {<br>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; force_send_socket("10.10.0.3");<br>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rtpproxy_manage("","3.3.3.3");<br>
            &nbsp; &nbsp; &nbsp; &nbsp; }<br>
            &nbsp; &nbsp; &nbsp; &nbsp; ...<br>
            &nbsp; &nbsp; &nbsp; &nbsp; t_relay();<br>
            }<br>
            <br>
            <br>
            onreply_route {<br>
            &nbsp; &nbsp; &nbsp; &nbsp; if (src_ip == 5.5.5.5) {<br>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; force_send_socket("10.10.0.2");<br>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rtpproxy_manage("","10.10.0.3");<br>
            &nbsp; &nbsp; &nbsp; &nbsp; } else {<br>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; force_send_socket("10.10.0.3");<br>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rtpproxy_manage("","3.3.3.3");
            <div class="HOEnZb">
              <div class="h5"><br>
                &nbsp; &nbsp; &nbsp; &nbsp; }<br>
                }<br>
                <br>
                <br>
                _______________________________________________<br>
                SIP Express Router (SER) and Kamailio (OpenSER) -
                sr-users mailing list<br>
                <a moz-do-not-send="true"
                  href="mailto:sr-users@lists.sip-router.org"
                  target="_blank">sr-users@lists.sip-router.org</a><br>
                <a moz-do-not-send="true"
                  href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                  target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </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>
  </body>
</html>