I was able to fix all issues, but have one partially lingering.

 

For register only, if I apply: set_contact_alias() with nat_keepalive(), keepalives are not sent. Removing set_contact_alias() fixes this.

 

I *shouldn’t need this if the pbx was saving received and rport params as a result of add_path_received().

 

Can anyone explain why these two functions conflict?

 

Test scenario -

# Doesn’t result in register keepalive –

 

route[NATDETECT] {

    force_rport();
    set_contact_alias();  # removal of this enables keepalive
    nat_keepalive();
    return;
}

 

I’ve tested this with and without calls to handle_ruri_alias() elsewhere in cfg script with same result.

 

-dan

 

From: sr-users <sr-users-bounces@lists.kamailio.org> on behalf of Sergiu Pojoga <pojogas@gmail.com>
Reply-To: "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Date: Wednesday, April 1, 2020 at 8:58 AM
To: "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Subject: Re: [SR-Users] nathelper without usrloc

 

Nothing else comes to mind based on info provided. May be you can send some sip traffic captures and elaborate?

 

Regards,

--Sergiu 

 

On Tue, Mar 31, 2020 at 10:29 PM Daniel W. Graham <dan@cmsinter.net> wrote:

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. 

 

-dan

On Mar 31, 2020, at 8:55 PM, Sergiu Pojoga <pojogas@gmail.com> wrote:

 

Oh and almost forgot - try add_path_received() instead of add_path()

 

Good luck!

 

On Tue, Mar 31, 2020 at 8:48 PM Sergiu Pojoga <pojogas@gmail.com> wrote:

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).

 

Otherwise, if I were to just throw a guess: 

- try fix_nated_register() (instead of set_contact_alias) just for Register method on the way to the registrar

- in the Registrar, make sure the Contact's Path address is correct

 

Cheers,

--Sergiu

 

On Tue, Mar 31, 2020 at 7:34 PM Daniel W. Graham <dan@cmsinter.net> wrote:

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.

-dan

On Mar 31, 2020, at 7:15 PM, Alex Balashov <abalashov@evaristesys.com> wrote:
>
> Daniel,
>
> Might this article be of aid?
>
> http://www.evaristesys.com/blog/server-side-nat-traversal-with-kamailio-the-definitive-guide/
>
> -- Alex
>
>> On Tue, Mar 31, 2020 at 11:12:23PM +0000, Daniel W. Graham wrote:
>>
>> It does but doesn't work as well as kamailio, and since the proxy is the entry point.
>>
>> 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.
>>
>> -dan
>>
>> On Mar 31, 2020, at 7:01 PM, Sergiu Pojoga <pojogas@gmail.com> wrote:
>>
>>
>> Hi Daniel,
>>
>> 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?
>>
>> Regards,
>> --Sergiu
>>
>> On Tue, Mar 31, 2020 at 1:55 PM Daniel W. Graham <dan@cmsinter.net<mailto:dan@cmsinter.net>> wrote:
>> I’ve been missing with this for a while and seem to be missing something. Any suggestions on what is missing here?
>>
>> Trying to use set_contact_alias() and handle_ruri_alias() from nathelper module and nat_keepalive from nat_traversal module, without registrar.
>>
>> 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.
>>
>> Registrations are forwarded to the PBX using add_path() and is working.
>>
>> Also not included below is the routing to the PBX, that is just setting $du and t_relay, and is also working.
>>
>> Topology is: UA1 -> NAT -> kamailio -> PBX -> UA2
>>
>> Using default config file as the example, modified with above changes. I also removed RTP config as that is a non-issue.
>>
>> request_route {
>>    ……
>>    # FLAG MESSAGES FROM PBX
>>        setflag(FLT_PBX);
>>    route(NATDETECT);
>>    ……
>>
>> route[NATDETECT] {
>>            if (nat_uac_test("19")) {
>> force_rport();
>>                        set_contact_alias();
>>                        nat_keepalive();
>>            }
>>            return;
>> }
>>
>> route[WITHINDLG] {
>>            if (!has_totag()) return;
>>                        if (loose_route()) {
>>                                    route(DLGURI);
>>                        } else if ( is_method("ACK") ) {
>>                                    route(NATMANAGE);
>>                        } else if ( is_method("NOTIFY") ) {
>>                                    record_route();
>>                        }
>>            route(RELAY);
>>            exit;
>>            }
>>
>>            if (is_method("SUBSCRIBE") && uri == myself) {
>>                        route(PRESENCE);
>>                        exit;
>>            }
>>            if ( is_method("ACK") ) {
>>                        if ( t_check_trans() ) {
>>                                    route(RELAY);
>>                                    exit;
>>                        } else {
>>                                    exit;
>>                        }
>>            }
>>            sl_send_reply("404","Not here");
>>            exit;
>> }
>>
>> route[NATMANAGE] {
>>        if(isflagset(FLT_PBX)) {
>>            handle_ruri_alias();
>>    }
>>    if(!isflagset(FLT_PBX)) {
>>        set_contact_alias();
>>    }       return;
>> }
>>
>> route[DLGURI] {
>>            if(!isdsturiset()) {
>>                        handle_ruri_alias();
>>            }
>>            return;
>> }
>>
>> branch_route[MANAGE_BRANCH] {
>>            route(NATMANAGE);
>> }
>>
>> onreply_route[MANAGE_REPLY] {
>>            if(status=~"[12][0-9][0-9]") {
>>                        route(NATMANAGE);
>>            }
>> }
>> failure_route[MANAGE_FAILURE] {
>>            route(NATMANAGE);
>>
>>            if (t_is_canceled()) exit;
>>
>>
>> -dan
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users@lists.kamailio.org<mailto:sr-users@lists.kamailio.org>
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users@lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users@lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Alex Balashov | Principal | Evariste Systems LLC
>
> Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
> Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users