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