[SR-Users] ACKs + BYEs coming from the wrong interface/ip

Boden Garman bpgarman at fastmail.fm
Wed Mar 6 03:00:01 CET 2019


Hello list! 

I am trying to troubleshoot an issue we are having where we sometimes see an ACK in response to a 200 OK (SDP) come from the a different IP address to the rest of dialogue. The client ignore the traffic from the different IP and the call set up fails.

Kamailio is multihomed on two IPs and this client is registered with the first IP address. 

I have done some searching on this and seen a few others with the issue, it seems like it's the ACK in the loose_route() section of WITHINDLG in the default kamailio.cfg file. I tried the force_send_socket solution one other person suggested but this caused issues with other kinds of dialogues, perhaps I did it incorrectly?

Thanks for your time
Boden


Here is my attempt to solve the issue and config snippets 

mhomed=1

# ----- rr params -----
# set next param to 1 to add value to ;lr param (helps with some UAs)
modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 1)

# Handle requests within SIP dialogs
route[WITHINDLG] {
        if (!has_totag()) return;

        # sequential request within a dialog should
        # take the path determined by record-routing
        if (loose_route()) {
                route(DLGURI);

                # this is the attempt to use the right IP
                if ($(route_uri{uri.host}) == VRRP_IP) {
                        force_send_socket(VRRP_IP);
                } else if ($(route_uri{uri.host}) == KAM01_IP) {
                         force_send_socket(KAM01_IP);
                }

                if (is_method("BYE")) {
                        setflag(FLT_ACC); # do accounting ...
                        setflag(FLT_ACCFAILED); # ... even if the transaction fails
                } else if (is_method("ACK")) {
                        # ACK is forwarded statelessly
                        route(NATMANAGE);
                } else if (is_method("NOTIFY")) {
                        # Add Record-Route for in-dialog NOTIFY as per RFC 6665.
                        record_route();
                }

                route(RELAY);
                exit;
        }

        if (is_method("SUBSCRIBE") && uri == myself) {
                # in-dialog subscribe requests
                route(PRESENCE);
                exit;
        }

        if (is_method("ACK")) {
                if (t_check_trans()) {
                        # no loose-route, but stateful ACK;
                        # must be an ACK after a 487
                        # or e.g. 404 from upstream server
                        route(RELAY);
                        exit;
                } else {
                        # ACK without matching transaction ... ignore and discard
                        exit;
                }
        }
        sl_send_reply("404", "Not here");
        exit;
}

For example (please excuse formatting) 
                                                                                                                        
            xxx.xx.xxx.97:5060            xxx.xx.xxx.96:5060           yyy.yyy.102.96:58308           xxx.xx.xxx.27:5060
          ----------w---------          ----------w---------          ----------w---------          ----------w---------
                   x        INVITE (SDP)         x                             x                             x         
                   x --------------------------> x                             x                             x         
                   x  100 trying -- your call is x                             x                             x         
                   x <-------------------------- x                             x                             x         
                   x                             x        INVITE (SDP)         x                             x         
                   x                             x --------------------------> x                             x         
                   x                             x         100 Trying          x                             x         
                   x                             x <-------------------------- x                             x         
                   x                             x         180 Ringing         x                             x         
                   x                             x <-------------------------- x                             x         
                   x         180 Ringing         x                             x                             x         
                   x <-------------------------- x                             x                             x         
                   x                             x        200 OK (SDP)         x                             x         
                   x                             x <-------------------------- x                             x         
                   x        200 OK (SDP)         x                             x                             x         
                   x <-------------------------- x                             x                             x         
                   x             ACK             x                             x                             x         
                   x --------------------------> x                             x                             x         
                   x                             x                             x             ACK             x         
                   x                             x                             x <-------------------------- x         
                   x                             x        200 OK (SDP)         x                             x         
                   x                             x <<<------------------------ x                             x         



More information about the sr-users mailing list