<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>When a phone registers, its traffic comes to one of the two
      sockets. When that phone is called, after lookup location, the
      socket associated to the registration of the target user is
      selected. So you do not need to do anything special for calling
      between phones.</p>
    <p>When calling to a PSTN/foreign provider via a trunk or so, you
      can set the socket to be used for outgoing leg via
      $fs/force_send_sock()/set_send_sock(). Some modules such as
      dispatcher have also the option to set the outgoing socket...</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 05.12.18 23:04, Kjeld Flarup wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:777413b4-5537-1a09-c8f7-7ba2807a3dd1@liberalismen.dk">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>So I could do something like this:<br>
      </p>
      <p>listen=192.168.2.9:5070 advertise 20.30.40.50:5070<br>
        listen=192.168.2.9:5050</p>
      <p>However when I do an invite to 192.168.2.32, would Kamailio
        choose 5050 or 5070?<br>
        Same when inviting to 40.40.40.40<br>
      </p>
      <p>If I were to listen to another local IP, then the routing table
        in Linux could perhaps dictate which connection to use.</p>
      <p><br>
      </p>
      <pre class="moz-signature" cols="72">-------------------- Med Liberalistiske Hilsner ----------------------
   Civilingeniør, Kjeld Flarup - Mit sind er mere åbent end min tegnebog
   Sofienlundvej 6B, 7560 Hjerm, Tlf: 40 29 41 49
   Den ikke akademiske hjemmeside for liberalismen - <a class="moz-txt-link-abbreviated" href="http://www.liberalismen.dk" moz-do-not-send="true">www.liberalismen.dk</a>

</pre>
      <div class="moz-cite-prefix">On 12/5/18 6:10 PM, Sergiu Pojoga
        wrote:<br>
      </div>
      <blockquote type="cite"
cite="mid:CAJZsGCnEqX=dg_Y82qGcDqZOO+_PNkZNjQrr0dPRz0EhnA86hA@mail.gmail.com">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        <div dir="ltr">For whatever reason my initial impression was if
          it was possible for external devices to connect without port
          forwarding...
          <div><br>
          </div>
          <div>I stand corrected.</div>
          <div><br>
          </div>
        </div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr">On Wed, Dec 5, 2018 at 11:30 AM
            Daniel-Constantin Mierla <<a
              href="mailto:miconda@gmail.com" moz-do-not-send="true">miconda@gmail.com</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0 0 0&#xA;
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF">
              <p>It is not about an external network interface, but
                external traffic/devices. The NAT in this case is a port
                forwarding firewall, like Amazon or Google cloud, where
                you have a local address on server and the firewall is
                forwarding by port all traffic from an assigned public
                address.</p>
              <p>Such scenario is quite common in enterprise
                environment, the devices on local network connect by
                private IP, and the external devices connect to the
                firewall ip and this one does port forwarding.</p>
              <p>Cheers,<br>
                Daniel<br>
              </p>
              <div class="m_3836549193775748302moz-cite-prefix">On
                05.12.18 16:56, Sergiu Pojoga wrote:<br>
              </div>
              <blockquote type="cite">
                <div dir="ltr">Slightly confused here... didn't he say
                  that Kamailio and PBX are behind NAT? If so, what
                  external interface are we talking about?</div>
                <br>
                <div class="gmail_quote">
                  <div dir="ltr">On Wed, Dec 5, 2018 at 9:18 AM
                    Daniel-Constantin Mierla <<a
                      href="mailto:miconda@gmail.com" target="_blank"
                      moz-do-not-send="true">miconda@gmail.com</a>>
                    wrote:<br>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0 0
                    0&#xA; .8ex;border-left:1px #ccc
                    solid;padding-left:1ex">Hello,<br>
                    <br>
                    you do not need a second kamailio, the same instance
                    can listen on<br>
                    multiple sockets. You can also use a single ip, just
                    listen on one port<br>
                    for traffic from local network and on another port
                    for external traffic<br>
                    (this socket with advertise address).<br>
                    <br>
                    If the router cannot handle dns query based on local
                    traffic, most<br>
                    devices support so called outbound proxy address,
                    you can set that to<br>
                    the sip server address with ip.<br>
                    <br>
                    Cheers,<br>
                    Daniel<br>
                    <br>
                    On 05.12.18 13:02, Kjeld Flarup wrote:<br>
                    > That might work, provided that the router can
                    handle a local DNS.<br>
                    ><br>
                    > It would, however still require adding an extra
                    Kamailio instance with<br>
                    > another IP. Plus a branch of the invite to both
                    local and public<br>
                    > instance. Plus an extra location table.<br>
                    ><br>
                    > -------------------- Med Liberalistiske Hilsner
                    ----------------------<br>
                    >    Civilingeniør, Kjeld Flarup - Mit sind er
                    mere åbent end min tegnebog<br>
                    >    Sofienlundvej 6B, 7560 Hjerm, Tlf: 40 29 41
                    49<br>
                    >    Den ikke akademiske hjemmeside for
                    liberalismen - <a href="http://www.liberalismen.dk"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">www.liberalismen.dk</a><br>
                    ><br>
                    > On 12/5/18 12:11 PM, Daniel Tryba wrote:<br>
                    >> On Wed, Dec 05, 2018 at 09:40:38AM +0100,
                    Kjeld Flarup wrote:<br>
                    >>> Yes, the Phones may be on either local
                    LAN (Wifi) and Internet via<br>
                    >>> mobile<br>
                    >>> data.<br>
                    >> How about use different local address, 1
                    with an advertise for external<br>
                    >> clients, 1 without. Have local DNS resolv
                    to the 1 ip without advertise.<br>
                    >><br>
                    >>
                    _______________________________________________<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>
                    ><br>
                    > _______________________________________________<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>
                    <br>
                    -- <br>
                    Daniel-Constantin Mierla -- <a
                      href="http://www.asipto.com" rel="noreferrer"
                      target="_blank" moz-do-not-send="true">www.asipto.com</a><br>
                    <a href="http://www.twitter.com/miconda"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">www.twitter.com/miconda</a>
                    -- <a href="http://www.linkedin.com/in/miconda"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">www.linkedin.com/in/miconda</a><br>
                    Kamailio World Conference -- <a
                      href="http://www.kamailioworld.com"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">www.kamailioworld.com</a><br>
                    Kamailio Advanced Training, Nov 12-14, 2018, in
                    Berlin -- <a href="http://www.asipto.com"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">www.asipto.com</a><br>
                    <br>
                    <br>
                    _______________________________________________<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>
              </blockquote>
              <pre class="m_3836549193775748302moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="m_3836549193775748302moz-txt-link-abbreviated" href="http://www.asipto.com" target="_blank" moz-do-not-send="true">www.asipto.com</a>
<a class="m_3836549193775748302moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a class="m_3836549193775748302moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" target="_blank" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio World Conference -- <a class="m_3836549193775748302moz-txt-link-abbreviated" href="http://www.kamailioworld.com" target="_blank" moz-do-not-send="true">www.kamailioworld.com</a>
Kamailio Advanced Training, Nov 12-14, 2018, in Berlin -- <a class="m_3836549193775748302moz-txt-link-abbreviated" href="http://www.asipto.com" target="_blank" moz-do-not-send="true">www.asipto.com</a></pre>
            </div>
          </blockquote>
        </div>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
      </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-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>
    <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>