Hello;
    i have trouble with BYE routing and loose routing and kamailio sometimes looping itselft Bye packets.i checked loose routing and bye packet routing here "https://voipmagazine.wordpress.com/2014/12/05/strict-and-loose-routing-of-sip-sequential-requests/" and here http://www.ietf.org/rfc/rfc3261.txt .

i tought that if top route header with lr is itself , next route header will be sent but it sending itself so looping. once , it was happened on INVITE transaction and i disabled register_myself on domain module. , couldnt figure out why it happens.

Kamailio2 and Asterisk has same interface but different port. i put and exit method when looping itself and saved day.


Thanks for helps

Here is call flow

INVITE
UAC---> Kamailio-1:5060 ---> Kamailio2:5061--->Asterisk


BYE
UAC   Kamailio-1:5060    Kamailio-2:5061 <----- Asterisk:5060
                         Kamailio-2:5061 <----- Kamailio-2:5061
                        
Kamailio-2:5061 <----- Kamailio-2:5061
                            .....
                            .....
                            .....

BYE sip:02165783@uacip:5061 SIP/2.0
Via: SIP/2.0/UDP kamailio2-asterisk-ip:5060;branch=z9hG4bK0a96e9e7;rport
Route: <sip:kamailio2-asterisk-ip:5061;lr;ftag=a186f178d9678251c214192a12fae999;did=ec.4872;vsf=AAAAAAkCAwcDAg8LAwQGcHEBFgQeFggAAB4yMDI->,<sip:kamailio1ip;lr;ftag=a186f178d9678251c214192a12fae999>
Max-Forwards: 70
From: <sip:0545402@kamailio1ip>;tag=as5cbb7b4a
To: 902165783 <sip:902165783@kamailio2-asterisk-ip>;tag=a186f178d9678251c214192a12fae999
Call-ID: 462c9c3e105cb2d84b9e47cf79926a55@10.10.0.70
CSeq: 102 BYE
User-Agent: sipgw2
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0