[SR-Users] nathelper without usrloc

Daniel-Constantin Mierla miconda at gmail.com
Thu Apr 2 20:59:16 CEST 2020


Hello,

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

Maybe nat_keepalive() needs the original contact URI, not the one
updated by set_contact_alias().

Cheers,
Daniel

On 02.04.20 18:45, Daniel W. Graham wrote:
>
> 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 at lists.kamailio.org> on behalf of
> Sergiu Pojoga <pojogas at gmail.com>
> *Reply-To: *"Kamailio (SER) - Users Mailing List"
> <sr-users at lists.kamailio.org>
> *Date: *Wednesday, April 1, 2020 at 8:58 AM
> *To: *"Kamailio (SER) - Users Mailing List" <sr-users at 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 at cmsinter.net
> <mailto:dan at 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 at gmail.com
>     <mailto:pojogas at 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 at gmail.com <mailto:pojogas at 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 at cmsinter.net <mailto:dan at 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 at evaristesys.com
>                 <mailto:abalashov at 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 at gmail.com <mailto:pojogas at 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 at cmsinter.net
>                 <mailto:dan at cmsinter.net><mailto:dan at cmsinter.net
>                 <mailto:dan at 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 at lists.kamailio.org
>                 <mailto:sr-users at lists.kamailio.org><mailto:sr-users at lists.kamailio.org
>                 <mailto:sr-users at lists.kamailio.org>>
>                 >>
>                 https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>                 >> _______________________________________________
>                 >> Kamailio (SER) - Users Mailing List
>                 >> sr-users at lists.kamailio.org
>                 <mailto:sr-users at lists.kamailio.org>
>                 >>
>                 https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>                 >
>                 >> _______________________________________________
>                 >> Kamailio (SER) - Users Mailing List
>                 >> sr-users at lists.kamailio.org
>                 <mailto:sr-users at 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 at lists.kamailio.org
>                 <mailto:sr-users at lists.kamailio.org>
>                 >
>                 https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>                 _______________________________________________
>                 Kamailio (SER) - Users Mailing List
>                 sr-users at lists.kamailio.org
>                 <mailto:sr-users at lists.kamailio.org>
>                 https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>         _______________________________________________
>         Kamailio (SER) - Users Mailing List
>         sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>         https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>     _______________________________________________
>     Kamailio (SER) - Users Mailing List
>     sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>     https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200402/4d9a71f4/attachment.html>


More information about the sr-users mailing list