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
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
-- 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 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
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
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://gilawa.comhttps://gilawa.com/
From: sr-users <sr-users-bounces@lists.kamailio.orgmailto:sr-users-bounces@lists.kamailio.org> On Behalf Of Maarten Ureel Sent: Tuesday, August 2, 2022 4:53 PM To: sr-users@lists.kamailio.orgmailto: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
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.1https://datatracker.ietf.org/doc/html/rfc3261#section-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
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://gilawa.comhttps://gilawa.com/
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.commailto:hw@gilawa.com> Verzonden: woensdag 3 augustus 2022 13:28 Aan: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> CC: Maarten Ureel <maarten@youreal.eumailto: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
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://gilawa.comhttps://gilawa.com/
From: sr-users <sr-users-bounces@lists.kamailio.orgmailto:sr-users-bounces@lists.kamailio.org> On Behalf Of Maarten Ureel Sent: Tuesday, August 2, 2022 4:53 PM To: sr-users@lists.kamailio.orgmailto: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
We see that the other party is indeed establishing a connection to port 5060, but for some reason after 1 second Kamailio is sending SYN,ACK Retransmission.
Any clues?
I also tried using TOPOS module to update contact header properly, but this does not even seem to add transport=tcp to the contact header, while the INVITE is being sent out over TCP.
Regards
Van: Henning Westerholt hw@gilawa.com Verzonden: woensdag 3 augustus 2022 19:36 Aan: Maarten Ureel maarten@youreal.eu; Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Onderwerp: RE: set source port of TCP socket in Contact header
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.1https://datatracker.ietf.org/doc/html/rfc3261#section-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
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://gilawa.comhttps://gilawa.com/
From: Maarten Ureel <maarten@youreal.eumailto:maarten@youreal.eu> Sent: Wednesday, August 3, 2022 2:09 PM To: Henning Westerholt <hw@gilawa.commailto:hw@gilawa.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto: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.commailto:hw@gilawa.com> Verzonden: woensdag 3 augustus 2022 13:28 Aan: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> CC: Maarten Ureel <maarten@youreal.eumailto: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
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://gilawa.comhttps://gilawa.com/
From: sr-users <sr-users-bounces@lists.kamailio.orgmailto:sr-users-bounces@lists.kamailio.org> On Behalf Of Maarten Ureel Sent: Tuesday, August 2, 2022 4:53 PM To: sr-users@lists.kamailio.orgmailto: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
Hello,
if topos is an option, you could try to set the contact header according to your needs, e.g. by this: https://kamailio.org/docs/modules/5.5.x/modules/topos.html#topos.p.contact_h...
Cheers,
Henning
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://gilawa.comhttps://gilawa.com/
From: Maarten Ureel maarten@youreal.eu Sent: Tuesday, August 9, 2022 12:00 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
We see that the other party is indeed establishing a connection to port 5060, but for some reason after 1 second Kamailio is sending SYN,ACK Retransmission.
Any clues?
I also tried using TOPOS module to update contact header properly, but this does not even seem to add transport=tcp to the contact header, while the INVITE is being sent out over TCP.
Regards
Van: Henning Westerholt <hw@gilawa.commailto:hw@gilawa.com> Verzonden: woensdag 3 augustus 2022 19:36 Aan: Maarten Ureel <maarten@youreal.eumailto:maarten@youreal.eu>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> Onderwerp: RE: set source port of TCP socket in Contact header
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.1https://datatracker.ietf.org/doc/html/rfc3261#section-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
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://gilawa.comhttps://gilawa.com/
From: Maarten Ureel <maarten@youreal.eumailto:maarten@youreal.eu> Sent: Wednesday, August 3, 2022 2:09 PM To: Henning Westerholt <hw@gilawa.commailto:hw@gilawa.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto: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.commailto:hw@gilawa.com> Verzonden: woensdag 3 augustus 2022 13:28 Aan: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org> CC: Maarten Ureel <maarten@youreal.eumailto: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
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://gilawa.comhttps://gilawa.com/
From: sr-users <sr-users-bounces@lists.kamailio.orgmailto:sr-users-bounces@lists.kamailio.org> On Behalf Of Maarten Ureel Sent: Tuesday, August 2, 2022 4:53 PM To: sr-users@lists.kamailio.orgmailto: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