Hi All,
I'm using Kamailio version 5.1.9. In cfg file have routing to send out SIP messages from Kamailio stack. In this routing logic added
force_send_socket("tcp:192.168.40.10:5060"); forward()
I'm expecting the send port should be from 5060, but it always pick random port to send out message. my requirement is to send SIP messages from 5060 port instead of picking random port.
Regards, Amarnath
Hello,
try this setting, it will force to re-use the same TCP port:
https://www.kamailio.org/wiki/cookbooks/5.3.x/core#tcp_reuse_port
Cheers,
Henning
-- Henning Westerholt – https://skalatan.de/blog/ Kamailio services – https://gilawa.comhttps://gilawa.com/
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Amarnath K Sent: Friday, April 3, 2020 8:40 AM To: sr-users@lists.kamailio.org Subject: [SR-Users] Query on force_send_socket
Hi All,
I'm using Kamailio version 5.1.9. In cfg file have routing to send out SIP messages from Kamailio stack. In this routing logic added
force_send_socket("tcp:192.168.40.10:5060http://192.168.40.10:5060"); forward()
I'm expecting the send port should be from 5060, but it always pick random port to send out message. my requirement is to send SIP messages from 5060 port instead of picking random port.
Regards, Amarnath
On Fri, Apr 03, 2020 at 12:09:43PM +0530, Amarnath K wrote:
Hi All,
I'm using Kamailio version 5.1.9. In cfg file have routing to send out SIP messages from Kamailio stack. In this routing logic added
force_send_socket("tcp:192.168.40.10:5060"); forward()
I'm expecting the send port should be from 5060, but it always pick random port to send out message. my requirement is to send SIP messages from 5060 port instead of picking random port.
TCP doesn't work like that. Port 5060 is already bound to a listen()ing socket; any new TCP sockets for outbound connections initiated would have to bind to a different local port.
-- Alex
Unless it’s a reply, in which case the socket should already be established, right?
On Fri, 3 Apr 2020 at 10:06, Alex Balashov abalashov@evaristesys.com wrote:
On Fri, Apr 03, 2020 at 12:09:43PM +0530, Amarnath K wrote:
Hi All,
I'm using Kamailio version 5.1.9. In cfg file have routing to send out SIP messages from Kamailio stack. In this routing logic added
force_send_socket("tcp:192.168.40.10:5060"); forward()
I'm expecting the send port should be from 5060, but it always pick random port to send out message. my requirement is to send SIP messages from 5060 port instead of picking random port.
TCP doesn't work like that. Port 5060 is already bound to a listen()ing socket; any new TCP sockets for outbound connections initiated would have to bind to a different local port.
-- Alex
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On Fri, Apr 03, 2020 at 10:08:38AM +0100, David Villasmil wrote:
Unless it’s a reply, in which case the socket should already be established, right?
Indeed -- if I understand you correctly.
I mean, I’m assuming he’s talking about a reply?
On Fri, 3 Apr 2020 at 10:12, Alex Balashov abalashov@evaristesys.com wrote:
On Fri, Apr 03, 2020 at 10:08:38AM +0100, David Villasmil wrote:
Unless it’s a reply, in which case the socket should already be established, right?
Indeed -- if I understand you correctly.
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio will use an ephemeral ports (assigned by the kernel) when making outbound TCP connections, this is recommended for several reasons.
You can google "bind before connect", if you want to find out more about this concept in Linux socket programming, this can be done to force the source port on outbound TCP connections. But comes with some unwanted limitations.
On Thu, Apr 2, 2020 at 11:52 PM Amarnath K ykamarnath@gmail.com wrote:
Hi All,
I'm using Kamailio version 5.1.9. In cfg file have routing to send out SIP messages from Kamailio stack. In this routing logic added
force_send_socket("tcp:192.168.40.10:5060"); forward()
I'm expecting the send port should be from 5060, but it always pick random port to send out message. my requirement is to send SIP messages from 5060 port instead of picking random port.
Regards, Amarnath
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users