As far i read on Kamailio reposity, WITHINDLG use loose_route() function.
But on BYE request, no Route headers (corresponding to asterisk 1) are available => BYE request can not be loose routed. Route headers has been remove by loadbalancer to avoid routing injections on my network (by an hacker for example).

Example of BYE request sent from IPBX throught Loadbalancer to Kamailio proxy:

BYE sip:10.0.246.76:5060 SIP/2.0
    Record-Route: <sip:10.0.246.189;r2=on;lr=on;ftag=as08627a3a;socket=udp:91.129.172.36:5060>
    Record-Route: <sip:91.129.172.36;r2=on;lr=on;ftag=as08627a3a;socket=udp:91.129.172.36:5060>
    Via: SIP/2.0/UDP 10.0.246.189;branch=z9hG4bK0d3d.f756947e05f126ea9f04daf00218c6fa.0
    Via: SIP/2.0/UDP 91.129.172.1:3198;received=91.129.172.1;branch=z9hG4bK6896d552;rport=3198
    Max-Forwards: 69
    From: <sip:0450584004@example.net>;tag=as08627a3a
    To: 0482680110 <sip:0481680110@example.net>;tag=0ee03819-900d-4d09-8188-de39ce74afcf
    Call-ID: 25bf2883-640c-4139-aca6-6c3e1170ea60
    CSeq: 102 BYE
    User-Agent: Wazo PBX
    X-Asterisk-HangupCause: Normal Clearing
    X-Asterisk-HangupCauseCode: 16


With:
10.0.246.76 -> Asterisk 1
91.129.172.36 -> Loadbalancer public IP
10.0.246.189 -> Loadbalancer public private

Only Request URI has Asterisk 1 IP address.
If i set more debug on kamailio, message return by kamailio: No transaction match.

2018-04-04 16:36 GMT+02:00 Daniel Tryba <d.tryba@pocos.nl>:
On Wed, Apr 04, 2018 at 11:57:55AM +0200, Loic Chabert wrote:
> Question is simple (but answer will be probably more complex): how can i
> sent in dialog BYE request to ASTERISK 1, and not asterisk 2.

I'm confused, what does your config look like? The normal way to do this
just to t_relay() these, see the route[WITHINDLG] in the default example
config:
https://github.com/kamailio/kamailio/blob/master/etc/kamailio.cfg

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users