Hello,
the tcp_reuse port setting is mainly using if Kamailio is acting as UAC, and needs an existing connection to be able to re-use something.
The RFC specify how its normally should done from a client :
18.1.1 Sending Requests
[..]
For reliable transports, the response is normally sent on the
connection on which the request was received. Therefore, the client
transport MUST be prepared to receive the response on the same
connection used to send the request. Under error conditions, the
server may attempt to open a new connection to send the response. To
handle this case, the transport layer MUST also be prepared to
receive an incoming connection on the source IP address from which
the request was sent and port number in the "sent-by" field.[..]
Not sure what the other side is, but maybe you can discuss that with them.
Cheers,
Henning
From: Maarten Ureel <maarten@youreal.eu>
Sent: Wednesday, August 3, 2022 2:09 PM
To: Henning Westerholt <hw@gilawa.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Subject: RE: set source port of TCP socket in Contact header
I tried the tcp_reuse_port but it doesn’t seem to change the source port. It’s always random indeed as you say.
See also screenshot from sngrep:
https://i.imgur.com/gp7WQ1C.png
The problem is that, further down the call, the other party sends the BYE to the port that is specified in the Contact header, so e.g. in the screenshot I would like to put 48952 in the Contact
header – or have it always be 5060 indeed.
Van: Henning Westerholt <hw@gilawa.com>
Verzonden: woensdag 3 augustus 2022 13:28
Aan: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
CC: Maarten Ureel <maarten@youreal.eu>
Onderwerp: RE: set source port of TCP socket in Contact header
Hello,
Not sure if I completely understand the issue.
Kamailio will either use a random source port, or the port 5060 if you specify the tcp_reuse_port core configuration.
Cheers,
Henning
From: sr-users <sr-users-bounces@lists.kamailio.org>
On Behalf Of Maarten Ureel
Sent: Tuesday, August 2, 2022 4:53 PM
To: sr-users@lists.kamailio.org
Subject: [SR-Users] set source port of TCP socket in Contact header
Hello
I want to set the correct source port in an outgoing message over TCP. Is it possible? I can’t find a pseudo-variable for this.
Currently we have no port number in the contact header, and the other party is sending their BYE to port 5060 instead of to the source port from which the outgoing TCP connection was made.
Regards
Maarten