<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>I pushed a commit to master branch trying to catch the use of
      add_local_rport() in the event route and trigger a rebuild of via.
      If you have time to test with master branch, let us know if works
      or not.</p>
    <p>Your solution is ok as well.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 11.11.20 21:28, Jetse Verschuren
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAB8_nh4VmNqffk9G_380nUYhAueOJSfcOtqsFVYFqC4BR9ujqg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Thanks for your quick response,</div>
        <div><br>
        </div>
        <div>Unfortunately add_local_rport() didn't work, but
          event_route[tm:loal-request] did work. In the end I manually
          changed the header (see below), not the prettiest solution,
          but it works.</div>
        <div><br>
        </div>
        <div>event_route [tm:local-request] {<br>
                  xlog("L_INFO", "Routing locally generated $rm to
          $ru\n");<br>
          <br>
                  if (is_method("REGISTER")) {<br>
                          xlog("L_INFO", "Adding rhost parameter to
          REGISTER request\n");<br>
                          # Add rport parameter to Via header<br>
                          assign_hf_value("Via", "$hdr(Via);rport");<br>
                  }<br>
          }<br>
        </div>
        <div><br>
        </div>
        <div>Thanks again,<br>
        </div>
        <div>
          <div>
            <div dir="ltr" class="gmail_signature"
              data-smartmail="gmail_signature">
              <div dir="ltr">Jetse<br>
              </div>
            </div>
          </div>
          <br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Nov 11, 2020 at 9:42
          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:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div>
            <p>Hello,</p>
            <p>try to catch uac registrations requests inside
              event_route[tm:local-requests] and use add_local_rport()
              for them -- not sure it works because I haven't tracked in
              the code, given that add_local_rport() was intended for
              forwarding incoming requests, but it is a chance it does.</p>
            <p>Cheers,<br>
              Daniel<br>
            </p>
            <div>On 11.11.20 08:38, Jetse Verschuren wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="auto">
                <div dir="ltr">
                  <div>Hi,</div>
                  <div><br>
                  </div>
                  <div>I'm currently trying to connect Kamailio, running
                    in docker, to my FritzBox. The FritzBox is the modem
                    provided by my ISP, with a builtin voip server which
                    I can use to dial out (basically a PSTN gateway). In
                    my setup I have a custom router/firewall/NAT between
                    the FritzBox and the server.<br>
                  </div>
                  <div dir="auto">When I connect LinPhone to the
                    FritzBox, from behind the NAT, it works fine. But
                    when I use the Kamailio uac remote registration,  I
                    don't get a response. After some investigation with
                    wireshark, I found that the the SIP response from
                    the FritzBox comes on the wrong port, and gets
                    rejected by the NAT. The request comes from port
                    1025, but the response is sent to port 5060. I
                    compared the requests from LinPhone and Kamailio,
                    and combined with some research, found it probably
                    was the rport option in the VIA header. From what I
                    read, it basically signals the uas to use the source
                    port to reply to, instead of the port indicated in
                    the request, which would be necessary to effectively
                    go through a NAT.</div>
                  <div dir="auto">After reading a lot of documentation
                    (and even parts of the source), I wasn't able to
                    find an option to enable this option. Is there some
                    option I completely missed, or is it not possible?
                    Or am I completely wrong in my "diagnosis"?</div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">Thanks in advance,</div>
                  <div>
                    <div dir="ltr">
                      <div dir="ltr">Jetse<br>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
            </blockquote>
            <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank" moz-do-not-send="true">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank" moz-do-not-send="true">https://www.paypal.me/dcmierla</a></pre>
          </div>
        </blockquote>
      </div>
    </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>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
  </body>
</html>