Hello Daniel,
Here more clear trace https://www.dropbox.com/s/2z6ck71ulidqelh/kamailio-BYE-flow.png?dl=0
BYE send by kamailio to wrong freeswitch box.

Slava



From: "volga629" <volga629@skillsearch.ca>
To: "sr-users" <sr-users@lists.sip-router.org>
Sent: Wednesday, 9 November, 2016 20:09:53
Subject: Re: [SR-Users] BYE dispatcher

Hello Daniel,
Please check this sip call flow picture https://www.dropbox.com/s/itdewdg3ph7xcyx/kamailio-fs-BYE-flow.gif?dl=0
Kamilio send BYE to incorrect freeswitch which already responded to BYE from leg one.


Slava.


From: "volga629" <volga629@skillsearch.ca>
To: "sr-users" <sr-users@lists.sip-router.org>
Sent: Wednesday, 9 November, 2016 19:11:56
Subject: Re: [SR-Users] BYE dispatcher

Hello Everyone,
Here are full  trace call.

https://paste.fedoraproject.org/476607/14787290/


Slava.


From: "volga629" <volga629@skillsearch.ca>
To: "sr-users" <sr-users@lists.sip-router.org>
Sent: Wednesday, 9 November, 2016 13:17:34
Subject: Re: [SR-Users] BYE dispatcher

Based on this out put Freeswitch send BYE to kamailio and  Route present then kamailio forward BYE to client and no routes. Then client reply 481.  Do I need add it ?  Is this tag= problem ?

24 is freeswtich and 27 kamailio.

IP (tos 0x0, ttl 64, id 56723, offset 0, flags [none], proto UDP (17), length 704)
10.18.130.24.5160 > 10.18.130.27.sip: [udp sum ok] UDP, length 676
E.......@..B
...
....(....8.BYE sip:4300@client_public_ip:49383 SIP/2.0
Via: SIP/2.0/UDP 10.18.130.24:5160;rport;branch=z9hG4bKm80c0USSKv5Bp
Route: <sip:10.18.130.27;r2=on;lr=on;ftag=SXt3DQQ90a0Dj>
Route: <sip:proxy_public_ip:5084;r2=on;lr=on;ftag=SXt3DQQ90a0Dj>
Max-Forwards: 70
From: "Test Extension" <sip:4300@sip.company.tld>;tag=SXt3DQQ90a0Dj
To: <sip:4300@client_public_ip:49383>;tag=719973534
Call-ID: 1abc150b-2141-1235-b5ad-5254003e39bb
CSeq: 99019404 BYE
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Reason: Q.850;cause=16;text="NORMAL_CLEARING"
Content-Length: 0


IP (tos 0x10, ttl 64, id 36705, offset 0, flags [none], proto UDP (17), length 700)
proxy_public_ip.llrp > client_public_ip.49383: [bad udp cksum 0x4d15 -> 0x34be!] UDP, length 672
E....a..@..d.E.\c.........M.BYE sip:4300@client_public_ip:49383 SIP/2.0
Via: SIP/2.0/UDP proxy_public_ip:5084;branch=z9hG4bK3ea6.0c594485bff5b216f30af0f6172cb2b9.0
Via: SIP/2.0/UDP 10.18.130.24:5160;received=10.18.130.24;rport=5160;branch=z9hG4bKm80c0USSKv5Bp
Max-Forwards: 69
From: "Test Extension" <sip:4300@sip.company.tld>;tag=SXt3DQQ90a0Dj
To: <sip:4300@client_public_ip:49383>;tag=719973534
Call-ID: 1abc150b-2141-1235-b5ad-5254003e39bb
CSeq: 99019404 BYE
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Reason: Q.850;cause=16;text="NORMAL_CLEARING"
Content-Length: 0


IP (tos 0x0, ttl 52, id 7731, offset 0, flags [none], proto UDP (17), length 638)
client_public_ip.49383 > proxy_public_ip.llrp: [udp sum ok] UDP, length 610
E..~.3..4...c....E.\.....j..SIP/2.0 481 Call Leg/Transaction Does Not Exist
Via: SIP/2.0/UDP proxy_public_ip:5084;branch=z9hG4bK3ea6.0c594485bff5b216f30af0f6172cb2b9.0
Via: SIP/2.0/UDP 10.18.130.24:5160;received=10.18.130.24;rport=5160;branch=z9hG4bKm80c0USSKv5Bp
From: "Test Extension" <sip:4300@sip.company.tld>;tag=SXt3DQQ90a0Dj
To: <sip:4300@client_public_ip:49383>;tag=719973534
Call-ID: 1abc150b-2141-1235-b5ad-5254003e39bb
CSeq: 99019404 BYE
Supported: replaces, path, eventlist
User-Agent: Grandstream Wave 1.2.2
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0

Slava.



From: "volga629" <volga629@skillsearch.ca>
To: "sr-users" <sr-users@lists.sip-router.org>
Sent: Wednesday, 9 November, 2016 13:07:11
Subject: Re: [SR-Users] BYE dispatcher

Hello Everyone,
I cleared registrations and tried again and issue still present.
Client reply with 481.

IP (tos 0x0, ttl 52, id 7731, offset 0, flags [none], proto UDP (17), length 638)
client_pub_ip.49383 > proxy_pub_ip.llrp: [udp sum ok] UDP, length 610
E..~.3..4...c....E.\.....j..SIP/2.0 481 Call Leg/Transaction Does Not Exist
Via: SIP/2.0/UDP proxy_pub_ip:5084;branch=z9hG4bK3ea6.0c594485bff5b216f30af0f6172cb2b9.0
Via: SIP/2.0/UDP 10.18.130.24:5160;received=10.18.130.24;rport=5160;branch=z9hG4bKm80c0USSKv5Bp
From: "Test Extension" <sip:4300@sip.company.tld>;tag=SXt3DQQ90a0Dj
To: <sip:4300@client_pub_ip:49383>;tag=719973534
Call-ID: 1abc150b-2141-1235-b5ad-5254003e39bb
CSeq: 99019404 BYE
Supported: replaces, path, eventlist
User-Agent: Grandstream Wave 1.2.2
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0

Slava.


From: "volga629" <volga629@skillsearch.ca>
To: miconda@gmail.com, "sr-users" <sr-users@lists.sip-router.org>
Sent: Wednesday, 9 November, 2016 12:28:32
Subject: Re: [SR-Users] BYE dispatcher

Hello Everyone,
I changed dispatcher algorithm  from 0 to 1 and start working as expected. Yes group 0 is accepted.

route[DISPATCHER] {
if(!ds_select_dst("0", "1")) {
xlog("L_ERROR","ERROR: Proxy Mapping - Desitnation for $fd not found...request dropped \n");
sl_send_reply("404","Desitination Not Found \n");
drop();
} else {
$var(did) = 1;
}
if($var(did)) {
if (!t_relay()) {
sl_reply_error();
}
#forward();
}

t_on_failure("DISPATCHER_FAIL_ROUTE");
exit;
}

Slava.


From: "Daniel-Constantin Mierla" <miconda@gmail.com>
To: "sr-users" <sr-users@lists.sip-router.org>
Sent: Wednesday, 9 November, 2016 04:33:33
Subject: Re: [SR-Users] BYE dispatcher

Hello,


On 08/11/16 20:42, Slava Bendersky wrote:
Hello Everyone,
My setup is kamailio as proxy  with few boxes of freeswitch in the LAN. Having issue with BYE when extensions register on different freeswitch boxes. Here are some trace of the call.
Not sure if this tag= miss match or routing.

Dispatcher use group 0 with option 4 (round robin).

is group value 0 accepted? I think this may create problems if a function returns the group in the config as return code -- iirc, this was changed maybe for lcr or permissions.

On the other hand, the registrations are quite independent in SIP in relation with calls. The BYE should be routed based on record-routing to the freeswitch that was involved in routing initial INVITE, with no relation to new registrations from end devices. Is the BYE sent to the freeswitch that got the initial BYE.

Cheers,
Daniel
-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - http://www.asipto.com

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users