<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>can you try with add_contact_alias() instead of
      set_contact_alias()? The second one updates the contact URI in a
      way that is visible for the couple of local modules immediately,
      typically needed when having dialog/presence module in that
      instance (still no changes to the header itself, it uses some
      internal mechanism to signal contact value should be taken from a
      special field). The first one uses the lumps system that makes the
      changes over the contact URI not visible immediately (unless
      msg_apply_changes() is used).</p>
    <p>Maybe nat_keepalive() needs the original contact URI, not the one
      updated by set_contact_alias().</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 02.04.20 18:45, Daniel W. Graham
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:D292EE8A-2A38-4557-A758-877B3F39154D@exchange.intra.cmsinter.net">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
      <div class="WordSection1">
        <p class="MsoNormal">I was able to fix all issues, but have one
          partially lingering.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">For register only, if I apply:
          set_contact_alias() with nat_keepalive(), keepalives are not
          sent. Removing set_contact_alias() fixes this.
          <o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">I *shouldn’t need this if the pbx was
          saving received and rport params as a result of
          add_path_received().<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Can anyone explain why these two functions
          conflict?<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Test scenario -<o:p></o:p></p>
        <p class="MsoNormal"># Doesn’t result in register keepalive –<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">route[NATDETECT] {<o:p></o:p></p>
        <p class="MsoNormal">    force_rport();<br>
              set_contact_alias();  # removal of this enables keepalive<br>
              nat_keepalive();<br>
              return;<br>
          }<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">I’ve tested this with and without calls to
          handle_ruri_alias() elsewhere in cfg script with same result.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">-dan<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div style="border:none;border-top:solid #B5C4DF
          1.0pt;padding:3.0pt 0in 0in 0in">
          <p class="MsoNormal"><b><span
                style="font-size:12.0pt;color:black">From: </span></b><span
              style="font-size:12.0pt;color:black">sr-users
              <a class="moz-txt-link-rfc2396E" href="mailto:sr-users-bounces@lists.kamailio.org"><sr-users-bounces@lists.kamailio.org></a> on behalf of
              Sergiu Pojoga <a class="moz-txt-link-rfc2396E" href="mailto:pojogas@gmail.com"><pojogas@gmail.com></a><br>
              <b>Reply-To: </b>"Kamailio (SER) - Users Mailing List"
              <a class="moz-txt-link-rfc2396E" href="mailto:sr-users@lists.kamailio.org"><sr-users@lists.kamailio.org></a><br>
              <b>Date: </b>Wednesday, April 1, 2020 at 8:58 AM<br>
              <b>To: </b>"Kamailio (SER) - Users Mailing List"
              <a class="moz-txt-link-rfc2396E" href="mailto:sr-users@lists.kamailio.org"><sr-users@lists.kamailio.org></a><br>
              <b>Subject: </b>Re: [SR-Users] nathelper without usrloc<o:p></o:p></span></p>
        </div>
        <div>
          <p class="MsoNormal"><o:p> </o:p></p>
        </div>
        <div>
          <p class="MsoNormal">Nothing else comes to mind based on info
            provided. May be you can send some sip traffic captures and
            elaborate?
            <o:p></o:p></p>
          <div>
            <p class="MsoNormal"><o:p> </o:p></p>
          </div>
          <div>
            <p class="MsoNormal">Regards,<o:p></o:p></p>
          </div>
          <div>
            <p class="MsoNormal">--Sergiu <o:p></o:p></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <div>
            <p class="MsoNormal">On Tue, Mar 31, 2020 at 10:29 PM Daniel
              W. Graham <<a href="mailto:dan@cmsinter.net"
                moz-do-not-send="true">dan@cmsinter.net</a>> wrote:<o:p></o:p></p>
          </div>
          <blockquote style="border:none;border-left:solid #CCCCCC
            1.0pt;padding:0in 0in 0in
            6.0pt;margin-left:4.8pt;margin-right:0in">
            <div>
              <p class="MsoNormal">Thanks, yeah I had already changed
                that, but registration works with either. I’m not asking
                for a solution, just looking for suggestions on anything
                that needs attention, so I appreciate your pointers. 
                <o:p></o:p></p>
              <div>
                <p class="MsoNormal"><o:p> </o:p></p>
              </div>
              <div>
                <p class="MsoNormal" style="margin-bottom:12.0pt">-dan<o:p></o:p></p>
                <div>
                  <div>
                    <p class="MsoNormal">On Mar 31, 2020, at 8:55 PM,
                      Sergiu Pojoga <<a
                        href="mailto:pojogas@gmail.com" target="_blank"
                        moz-do-not-send="true">pojogas@gmail.com</a>>
                      wrote:<o:p></o:p></p>
                  </div>
                </div>
                <div>
                  <blockquote
                    style="margin-top:5.0pt;margin-bottom:5.0pt">
                    <p class="MsoNormal"><o:p> </o:p></p>
                  </blockquote>
                </div>
                <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
                  <div>
                    <div>
                      <p class="MsoNormal">Oh and almost forgot - try <b>add_path_received()</b>
                        instead of add_path()<o:p></o:p></p>
                      <div>
                        <p class="MsoNormal"><o:p> </o:p></p>
                      </div>
                      <div>
                        <p class="MsoNormal">Good luck!<o:p></o:p></p>
                      </div>
                    </div>
                    <p class="MsoNormal"><o:p> </o:p></p>
                    <div>
                      <div>
                        <p class="MsoNormal">On Tue, Mar 31, 2020 at
                          8:48 PM Sergiu Pojoga <<a
                            href="mailto:pojogas@gmail.com"
                            target="_blank" moz-do-not-send="true">pojogas@gmail.com</a>>
                          wrote:<o:p></o:p></p>
                      </div>
                      <blockquote style="border:none;border-left:solid
                        #CCCCCC 1.0pt;padding:0in 0in 0in
                        6.0pt;margin-left:4.8pt;margin-right:0in">
                        <div>
                          <p class="MsoNormal">A lot of things may not
                            be 'right' here, unfortunately your question
                            is too broad to answer and too little info,
                            the topology is indeed non-default and I
                            doubt someone will present you with a final
                            solution (there's business support, if
                            you're looking for that). <o:p></o:p></p>
                          <div>
                            <p class="MsoNormal"><o:p> </o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal">Otherwise, if I were to
                              just throw a guess: <o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal">-
                              try fix_nated_register() (instead of
                              set_contact_alias) just for Register
                              method on the way to the registrar<o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal">- in the Registrar,
                              make sure the Contact's Path address is
                              correct<o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal"><o:p> </o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal">Cheers,<o:p></o:p></p>
                          </div>
                          <div>
                            <p class="MsoNormal">--Sergiu<o:p></o:p></p>
                          </div>
                        </div>
                        <p class="MsoNormal"><o:p> </o:p></p>
                        <div>
                          <div>
                            <p class="MsoNormal">On Tue, Mar 31, 2020 at
                              7:34 PM Daniel W. Graham <<a
                                href="mailto:dan@cmsinter.net"
                                target="_blank" moz-do-not-send="true">dan@cmsinter.net</a>>
                              wrote:<o:p></o:p></p>
                          </div>
                          <blockquote
                            style="border:none;border-left:solid #CCCCCC
                            1.0pt;padding:0in 0in 0in
                            6.0pt;margin-left:4.8pt;margin-right:0in">
                            <p class="MsoNormal">It did help, I read
                              that a couple times already but something
                              is still not right, and its only because
                              of the decoupling of the registrar. I need
                              to do more debugging and see if Im loosing
                              the flag value. Hoping something sticks
                              out that someone sees and can point me in
                              the right direction. <br>
                              <br>
                              -dan<br>
                              <br>
                              On Mar 31, 2020, at 7:15 PM, Alex Balashov
                              <<a
                                href="mailto:abalashov@evaristesys.com"
                                target="_blank" moz-do-not-send="true">abalashov@evaristesys.com</a>>
                              wrote:<br>
                              > <br>
                              > Daniel,<br>
                              > <br>
                              > Might this article be of aid?<br>
                              > <br>
                              > <a
href="http://www.evaristesys.com/blog/server-side-nat-traversal-with-kamailio-the-definitive-guide/"
                                target="_blank" moz-do-not-send="true">
http://www.evaristesys.com/blog/server-side-nat-traversal-with-kamailio-the-definitive-guide/</a><br>
                              > <br>
                              > -- Alex<br>
                              > <br>
                              >> On Tue, Mar 31, 2020 at
                              11:12:23PM +0000, Daniel W. Graham wrote:<br>
                              >> <br>
                              >> It does but doesn't work as well
                              as kamailio, and since the proxy is the
                              entry point.<br>
                              >> <br>
                              >> The biggest issue here isnt the
                              keepalive, as I did have that working. The
                              main issue is the routing of messages,
                              utilizing set_contact_alias and
                              handle_ruri_alias, as Ive been unable to
                              get ack and bye messages to make it past
                              the proxy. I’m assuming these functions
                              are not being used at the right locations
                              or I need to rely on another mechanism to
                              accomplish it. I also question my use of
                              the PBX flag and the natmanage logic.<br>
                              >> <br>
                              >> -dan<br>
                              >> <br>
                              >> On Mar 31, 2020, at 7:01 PM,
                              Sergiu Pojoga <<a
                                href="mailto:pojogas@gmail.com"
                                target="_blank" moz-do-not-send="true">pojogas@gmail.com</a>>
                              wrote:<br>
                              >> <br>
                              >> <br>
                              >> Hi Daniel,<br>
                              >> <br>
                              >> From what you are describing, my
                              understanding is that the Registrar is the
                              PBX, kamailio is acting as an edge proxy.
                              If so, doesn't the PBX/registrar have NAT
                              traversal/keepalive mechanisms of its own?<br>
                              >> <br>
                              >> Regards,<br>
                              >> --Sergiu<br>
                              >> <br>
                              >> On Tue, Mar 31, 2020 at 1:55 PM
                              Daniel W. Graham <<a
                                href="mailto:dan@cmsinter.net"
                                target="_blank" moz-do-not-send="true">dan@cmsinter.net</a><mailto:<a
                                href="mailto:dan@cmsinter.net"
                                target="_blank" moz-do-not-send="true">dan@cmsinter.net</a>>>
                              wrote:<br>
                              >> I’ve been missing with this for a
                              while and seem to be missing something.
                              Any suggestions on what is missing here?<br>
                              >> <br>
                              >> Trying to use set_contact_alias()
                              and handle_ruri_alias() from nathelper
                              module and nat_keepalive from
                              nat_traversal module, without registrar.<br>
                              >> <br>
                              >> I had register keepalive working,
                              that has since broke. When register
                              keepalive was working, I was able to place
                              call in either direction but ACK and BYE
                              was not being routed past kamailio.<br>
                              >> <br>
                              >> Registrations are forwarded to
                              the PBX using add_path() and is working.<br>
                              >> <br>
                              >> Also not included below is the
                              routing to the PBX, that is just setting
                              $du and t_relay, and is also working.<br>
                              >> <br>
                              >> Topology is: UA1 -> NAT ->
                              kamailio -> PBX -> UA2<br>
                              >> <br>
                              >> Using default config file as the
                              example, modified with above changes. I
                              also removed RTP config as that is a
                              non-issue.<br>
                              >> <br>
                              >> request_route {<br>
                              >>    ……<br>
                              >>    # FLAG MESSAGES FROM PBX<br>
                              >>        setflag(FLT_PBX);<br>
                              >>    route(NATDETECT);<br>
                              >>    ……<br>
                              >> <br>
                              >> route[NATDETECT] {<br>
                              >>            if
                              (nat_uac_test("19")) {<br>
                              >> force_rport();<br>
                              >>                       
                              set_contact_alias();<br>
                              >>                       
                              nat_keepalive();<br>
                              >>            }<br>
                              >>            return;<br>
                              >> }<br>
                              >> <br>
                              >> route[WITHINDLG] {<br>
                              >>            if (!has_totag())
                              return;<br>
                              >>                        if
                              (loose_route()) {<br>
                              >>                                 
                                route(DLGURI);<br>
                              >>                        } else if
                              ( is_method("ACK") ) {<br>
                              >>                                 
                                route(NATMANAGE);<br>
                              >>                        } else if
                              ( is_method("NOTIFY") ) {<br>
                              >>                                 
                                record_route();<br>
                              >>                        }<br>
                              >>            route(RELAY);<br>
                              >>            exit;<br>
                              >>            }<br>
                              >> <br>
                              >>            if
                              (is_method("SUBSCRIBE") && uri ==
                              myself) {<br>
                              >>                       
                              route(PRESENCE);<br>
                              >>                        exit;<br>
                              >>            }<br>
                              >>            if ( is_method("ACK")
                              ) {<br>
                              >>                        if (
                              t_check_trans() ) {<br>
                              >>                                 
                                route(RELAY);<br>
                              >>                                 
                                exit;<br>
                              >>                        } else {<br>
                              >>                                 
                                exit;<br>
                              >>                        }<br>
                              >>            }<br>
                              >>           
                              sl_send_reply("404","Not here");<br>
                              >>            exit;<br>
                              >> }<br>
                              >> <br>
                              >> route[NATMANAGE] {<br>
                              >>        if(isflagset(FLT_PBX)) {<br>
                              >>            handle_ruri_alias();<br>
                              >>    }<br>
                              >>    if(!isflagset(FLT_PBX)) {<br>
                              >>        set_contact_alias();<br>
                              >>    }       return;<br>
                              >> }<br>
                              >> <br>
                              >> route[DLGURI] {<br>
                              >>            if(!isdsturiset()) {<br>
                              >>                       
                              handle_ruri_alias();<br>
                              >>            }<br>
                              >>            return;<br>
                              >> }<br>
                              >> <br>
                              >> branch_route[MANAGE_BRANCH] {<br>
                              >>            route(NATMANAGE);<br>
                              >> }<br>
                              >> <br>
                              >> onreply_route[MANAGE_REPLY] {<br>
                              >>           
                              if(status=~"[12][0-9][0-9]") {<br>
                              >>                       
                              route(NATMANAGE);<br>
                              >>            }<br>
                              >> }<br>
                              >> failure_route[MANAGE_FAILURE] {<br>
                              >>            route(NATMANAGE);<br>
                              >> <br>
                              >>            if (t_is_canceled())
                              exit;<br>
                              >> <br>
                              >> <br>
                              >> -dan<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><mailto:<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"
                                target="_blank" moz-do-not-send="true">
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><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"
                                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"
                                target="_blank" moz-do-not-send="true">
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                              > <br>
                              > <br>
                              > -- <br>
                              > Alex Balashov | Principal | Evariste
                              Systems LLC<br>
                              > <br>
                              > Tel: +1-706-510-6800 /
                              +1-800-250-5920 (toll-free)<br>
                              > Web: <a
                                href="http://www.evaristesys.com/"
                                target="_blank" moz-do-not-send="true">http://www.evaristesys.com/</a>,
                              <a href="http://www.csrpswitch.com/"
                                target="_blank" moz-do-not-send="true">http://www.csrpswitch.com/</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"
                                target="_blank" moz-do-not-send="true">
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><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"
                                target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><o:p></o:p></p>
                          </blockquote>
                        </div>
                      </blockquote>
                    </div>
                    <p class="MsoNormal">_______________________________________________<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"
                        target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><o:p></o:p></p>
                  </div>
                </blockquote>
              </div>
            </div>
            <p class="MsoNormal">_______________________________________________<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"
                target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><o:p></o:p></p>
          </blockquote>
        </div>
      </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">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></pre>
  </body>
</html>