The loose_route() function changes the next-hop address and "absorbs"
the appropriate Route header field(s), but it doesn't route the SIP
request.
Your block of code is missing the t_relay() function call. I don't see
anything wrong with the BYE, so adding that line of code - I hope -
should work for you.

James

On Thu, 2 Nov 2023 at 14:12, Ali Taher <[email protected]> wrote:
>
> Hi Yuriy,
>
>
>
> Thanks, I used what you suggested below, and still getting 1 as result for 
> loose_route(), but BYE message is not routed anywhere.
>
>
>
> Regards,
>
>
>
> From: Yuriy G <[email protected]>
> Sent: Thursday, November 2, 2023 3:05 PM
> To: Kamailio (SER) - Users Mailing List <[email protected]>
> Cc: James Browne <[email protected]>; Ali Taher <[email protected]>
> Subject: Re: [SR-Users] Re: SIP Proxy : BYE next hop
>
>
>
> loose_route returns result in the $rc variable
> Return code should be handed like this:
>
> https://www.kamailio.org/wikidocs/cookbooks/5.6.x/pseudovariables/#rc-returned-code
>
>
>
> чт, 2 нояб. 2023 г. в 13:27, Ali Taher via sr-users 
> <[email protected]>:
>
> Hi James,
>
> Here are my listen directives:
> listen=udp:192.168.1.2:5060
> listen=tcp: 192.168.1.2:5060
>
> knowing that:
> Kamailio IP: 192.168.1.2
> SBC IP: 192.168.1.1
> Caller IP: 192.168.1.5
>
> -----Original Message-----
> From: Ali Taher via sr-users <[email protected]>
> Sent: Thursday, November 2, 2023 1:42 PM
> To: James Browne <[email protected]>; Kamailio (SER) - Users Mailing List 
> <[email protected]>
> Cc: Ali Taher <[email protected]>
> Subject: [SR-Users] Re: SIP Proxy : BYE next hop
>
> Hi James,
>
> Yes I'm using loose_route() and it's returning 1, but BYE message is not 
> routed anywhere.
>
> Frame 6213: 673 bytes on wire (5384 bits), 673 bytes captured (5384 bits) 
> Ethernet II, Src: Cisco_f8:19:ff (00:22:bd:f8:19:ff), Dst: VMware_bf:27:0b 
> (00:50:56:bf:27:0b) Internet Protocol Version 4, Src: 192.168.1.5, Dst: 
> 192.168.1.2 User Datagram Protocol, Src Port: 16368, Dst Port: 5060 Session 
> Initiation Protocol (BYE)
>     Request-Line: BYE sip:192.168.1.1:5060;transport=udp SIP/2.0
>     Message Header
>         Via: SIP/2.0/UDP 
> 192.168.1.5:16368;branch=z9hG4bK-d87543-c147891e677a1f19-1--d87543-;rport
>         Max-Forwards: 70
>         Route: <sip:192.168.1.2;lr;ftag=7d4a7c3c>
>         Route: <sip:192.168.1.1:5060;ipcs-line=43354518;lr;transport=udp>
>         Contact: <sip:[email protected]:16368>
>         To: "121"<sip:[email protected]>;tag=gtyrzghr-CC-1047-OFC-39
>         From: "69079514"<sip:[email protected]>;tag=7d4a7c3c
>         Call-ID: 085d9048b81abc1eNDUwODVhMjI2NDk5NDM3YmZiZWZiYzI0YWZkOTU1Njc.
>         [Generated Call-ID: 
> 085d9048b81abc1eNDUwODVhMjI2NDk5NDM3YmZiZWZiYzI0YWZkOTU1Njc.]
>         CSeq: 2 BYE
>         User-Agent: eyeBeam release 1003s stamp 31159
>         Reason: SIP;description="User Hung Up"
>         Content-Length: 0
>
> Here is routing block related to BYE:
> if (is_method("BYE")) {
> xlog("L_INFO","INSIDE BYE");
> $var(loose) = loose_route();
> xlog("L_INFO","LOOSE : $var(loose)");
> }
>
>
> Regards,
>
> -----Original Message-----
> From: James Browne <[email protected]>
> Sent: Thursday, November 2, 2023 12:31 PM
> To: Kamailio (SER) - Users Mailing List <[email protected]>
> Cc: Ali Taher <[email protected]>
> Subject: Re: [SR-Users] SIP Proxy : BYE next hop
>
> Hello
> Did you call the loose_route() function for the BYE? It should just work; 
> that's one of the basics of how kamailio works, so I'll be very surprised if 
> there's somehow a bug in kamailio.
> If that does not work, perhaps send a list of the listen directives in the 
> kamailio.cfg, along with the headers of the two SIP BYE messages (incoming 
> and outgoing) and I'll see what I can figure out for you.
>
> James
>
> On Thu, 2 Nov 2023 at 09:35, Ali Taher via sr-users 
> <[email protected]> wrote:
> >
> > Hello all,
> >
> >
> >
> > I’m using Kamailio as SIP proxy between session manager and SBC.
> >
> > I came across an issue in BYE request where the SBC sent in the header
> > list of Routes where first route is Kamailio IP, and the second is SM
> > IP, in addition to other routes (last route is the caller party)
> >
> > What Kamailio did is to route the BYE to the address set in the 
> > Request-URI, which is the caller party.
> >
> > What should be done instead is that Kamailio should remove the Route header 
> > including its own IP, and route the BYE to the next hop which is in this 
> > case the SM IP.
> >
> >
> >
> > How to accomplish that?
> >
> >
> >
> > Following is the Route header in the BYE request coming from SBC:
> >
> > [truncated]Route:
> > <sip:KAMAILIO_IP;lr;ftag=xxxxxxxxxxxxxxxxxxxxxxx>,<sip:SM1@SM_IP;trans
> > port=udp;lr;av-asset-uid=xxxxxxxxxx>,<sip:127.0.0.2:15060;transport=ud
> > p;ibmsid=local.xxxxxxxxxxxx_xxxxxxxxx_xxxxxxxxx;lr;ibmdrr>,sips:127.0.
> > 0.2:15061;ibmsid=local.xxxxxxxxxx_xxxxxxxxxx_xxxxxxxx;lr;ibmdrr,
> > sip:SM1@SM_IP;transport=tls;lr;av-asset-uid=xxxxxx,
> > sip:CALLER_PARTY_IP:5061;transport=tls;lr
> >
> >
> >
> > Regards,
> >
> > __________________________________________________________
> > Kamailio - Users Mailing List - Non Commercial Discussions To
> > unsubscribe send an email to [email protected]
> > Important: keep the mailing list in the recipients, do not reply only to 
> > the sender!
> > Edit mailing list options or unsubscribe:
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to