Hello list,
I have several questions about the support of TCP in OpenSER in general, and about the switch/ failover from UDP to TCP in particular.
In my setup, I have several SIP clients registered to a single OpenSER, and they exchange presence messages on a peer-to-peer basis. When the presence document is complex, the size of the message sent exceeds a given limit, and I want my message to be sent over TCP. My clients are registered on the OpenSER, and the REGISTER has been sent over UDP. From now, when client A sends a NOTIFY using TCP to client B, the message is transported over TCP from A to the OpenSER, and is transported over UDP from the OpenSER to B.
So here are my questions : - How can I tell OpenSER to relay the message to B using TCP ? - Do I have something particular to do while registering to tell OpenSER that the client is listening in UDP and TCP ?
Thank you in advance for your answers,
Antoine
Antoine Fressancourt writes:
My clients are registered on the OpenSER, and the REGISTER has been sent over UDP.
if they need tcp, why don't they register using tcp?
you try to play with force_send_socket function.
-- juha
El Martes, 22 de Abril de 2008, Juha Heinanen escribió:
Antoine Fressancourt writes:
My clients are registered on the OpenSER, and the REGISTER has been sent over UDP.
if they need tcp, why don't they register using tcp?
you try to play with force_send_socket function.
That doesn't work. Even if you force a TCP socket it will be not used if there is not a "transport=TCP" parameter in the RURI. I remember trying it and understood (thanks to a comment of you) that the only way to select the protocol is via RFC 3263.
Antoine Fressancourt schrieb:
Hello list,
I have several questions about the support of TCP in OpenSER in general, and about the switch/ failover from UDP to TCP in particular.
Forcing UDP->TCP failover will only work if the client is listening on TCP too - and the proxy knows the port where the client is listening.
If the client has registered using UDP, then the proxy has to use UDP for sending requests to this client.
Thus, if you want TCP you have to make sure that the clients use TCP and openser will automatically use TCP.
you can force some clients to use TCP by adding NAPTR records for you domain with TCP as the preferred protocol.
regards klaus
In my setup, I have several SIP clients registered to a single OpenSER, and they exchange presence messages on a peer-to-peer basis. When the presence document is complex, the size of the message sent exceeds a given limit, and I want my message to be sent over TCP. My clients are registered on the OpenSER, and the REGISTER has been sent over UDP. From now, when client A sends a NOTIFY using TCP to client B, the message is transported over TCP from A to the OpenSER, and is transported over UDP from the OpenSER to B.
So here are my questions :
- How can I tell OpenSER to relay the message to B using TCP ?
- Do I have something particular to do while registering to tell
OpenSER that the client is listening in UDP and TCP ?
Thank you in advance for your answers,
Antoine
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users
Hello Klaus, Iñaki,
I have done some tests after your answers, and here are the results :
- I have tried to register a user with multiple Contact headers, for the same Address of Record in a single REGISTER, specifying the transport used in each Contact Header field, and I only see one entry for each client doing "openserctl ul show". For each entry, the Socket:: value show that the transport layer taken in account is the transport layer used to send the REGISTER message.
- I tried to add "transport=tcp" as a R-URI parameter but unfortunately the message is still sent over UDP from OpenSER to client B.
- About Klaus's remark, I also thought that you could only send SIP messages in UDP to a client registered inUDP but when I went through the 18th paragraph of RFC 3261 ("Transport"), I understood that it was mandatory for a SIP client to listen on the same port in UDP and TCP. I don't have the precise reference but it is the way I understood this part of the RFC. Anyway, I would be ready to register on both protocols using multiple Contact in the REGISTER message, and I would like to avoid having to send a REGISTER in UDP AND a REGISTER in TCP.
Best regards,
Antoine
When I send a REGISTER with a Contact field containing a transport parameter,
2008/4/22 Klaus Darilion klaus.mailinglists@pernau.at:
Antoine Fressancourt schrieb:
Hello list,
I have several questions about the support of TCP in OpenSER in general, and about the switch/ failover from UDP to TCP in particular.
Forcing UDP->TCP failover will only work if the client is listening on TCP too - and the proxy knows the port where the client is listening.
If the client has registered using UDP, then the proxy has to use UDP for sending requests to this client.
Thus, if you want TCP you have to make sure that the clients use TCP and openser will automatically use TCP.
you can force some clients to use TCP by adding NAPTR records for you domain with TCP as the preferred protocol.
regards klaus
In my setup, I have several SIP clients registered to a single OpenSER, and they exchange presence messages on a peer-to-peer basis. When the presence document is complex, the size of the message sent exceeds a given limit, and I want my message to be sent over TCP. My clients are registered on the OpenSER, and the REGISTER has been sent over UDP. From now, when client A sends a NOTIFY using TCP to client B, the message is transported over TCP from A to the OpenSER, and is transported over UDP from the OpenSER to B.
So here are my questions :
- How can I tell OpenSER to relay the message to B using TCP ?
- Do I have something particular to do while registering to tell
OpenSER that the client is listening in UDP and TCP ?
Thank you in advance for your answers,
Antoine
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users
Antoine Fressancourt schrieb:
Hello Klaus, Iñaki,
I have done some tests after your answers, and here are the results :
- I have tried to register a user with multiple Contact headers, for
the same Address of Record in a single REGISTER, specifying the transport used in each Contact Header field, and I only see one entry for each client doing "openserctl ul show". For each entry, the Socket:: value show that the transport layer taken in account is the transport layer used to send the REGISTER message.
- I tried to add "transport=tcp" as a R-URI parameter but
unfortunately the message is still sent over UDP from OpenSER to client B.
- About Klaus's remark, I also thought that you could only send SIP
messages in UDP to a client registered inUDP but when I went through the 18th paragraph of RFC 3261 ("Transport"), I understood that it was mandatory for a SIP client to listen on the same port in UDP and TCP.
Yes, RFC 3261 requires support of UDP and TCP. I think the important part is 18.2.1 Receiving Requests:
A server SHOULD be prepared to receive requests on any IP address, port and transport combination that can be the result of a DNS lookup on a SIP or SIPS URI [4] that is handed out for the purposes of communicating with that server. In this context, "handing out" includes placing a URI in a Contact header field in a REGISTER request or a redirect response, or in a Record-Route header field in a request or response.
Thus, if the URI in the REGISTER contains an IP address, [4=RFC3263] will resolve only to 1 socket.
It is also RECOMMENDED that a server listen for requests on the default SIP ports (5060 for TCP and UDP, 5061 for TLS over TCP) on all public interfaces.
Now it depends on your scenario. If the SIP UAs are behind NAT then: - UA registers a UDP URI: Even if the UA would listen on the same port on TCP it can't be reached from outside due to the NAT -> switching from UDP makes things worse! (I never had any issues with IP fragmentation yet) - UA registers a TCP URI: There is no need to listen on the same UDP port too as the client wants to receive incoming requests via TCP.
If the UAs are not behind NAT then it may be useful to listen to TCP too, but IMO the automatic UDP/TCP translation in a proxy towards a UA is crap. Either clients and NAT should handle IP fragments or should use TCP.
regards klaus
El Tuesday 22 April 2008 16:36:36 Antoine Fressancourt escribió:
- I have tried to register a user with multiple Contact headers, for
the same Address of Record in a single REGISTER, specifying the transport used in each Contact Header field, and I only see one entry for each client doing "openserctl ul show".
Hummm, never tried it but it seems a bug or not supperted RFC 3261 specification since a REGISTER with multiple values in Contact is perfectly valid. I'll try it.
For each entry, the Socket:: value show that the transport layer taken in account is the transport layer used to send the REGISTER message.
Yes, that logic since "socket" field means that exaclty. :)
- I tried to add "transport=tcp" as a R-URI parameter but
unfortunately the message is still sent over UDP from OpenSER to client B.
Where do you do it? I've never tryed adding "transport=tcp" to forward a request to an UDP registered user but have done it forwarding to a IP and works. You should do it **after** lookup(location) in order to add the parameter to the final RURI. Do you do it?
El Tuesday 22 April 2008 16:36:36 Antoine Fressancourt escribió:
- I have tried to register a user with multiple Contact headers, for
the same Address of Record in a single REGISTER, specifying the transport used in each Contact Header field
Hi, be sure of use addr-name URI type (using < >), since "transport" is a URI param and if you use addr-spec the the parameters are considered header parameters so OpenSer don't store them:
Valid: Contact: sip:user@192.168.1.2;transport=TCP
Valid but not useful (no transport URI parameter): Contact: sip:user@192.168.1.2;transport=TCP
El Tuesday 22 April 2008 16:36:36 Antoine Fressancourt escribió:
Hello Klaus, Iñaki,
I have done some tests after your answers, and here are the results :
- I have tried to register a user with multiple Contact headers, for
the same Address of Record in a single REGISTER, specifying the transport used in each Contact Header field, and I only see one entry for each client doing "openserctl ul show".
It works perfectly. I've sent a REGISTER with:
Contact: sip:UDP@192.168.1.2, sip:TCP@192.168.1.3;transport=TCP
and both users appear in location table.
El Tuesday 22 April 2008 15:32:34 Antoine Fressancourt escribió:
So here are my questions :
- How can I tell OpenSER to relay the message to B using TCP ?
You must add "transport=tcp" parameter to the RURI. There is a function to add parameters to the ruri.
- Do I have something particular to do while registering to tell
OpenSER that the client is listening in UDP and TCP ?
If a client registers using TCP it has "transport=tcp" in the REGISTER "Contact" header: sip:user@192.168.1.58;transport=tcp
So you could add this parameter to "Contact" header before save it in location table.
But I've a doubt: when client is behind NAT the "received" column stored in "location" table is: sip:user@PUBLIC_IP;transport=tcp
So I assume that it's neccesary to add also here the "transport=tcp" parameter but have no idea of how to do it. Suggestions? is it necessary or is it enought with the "transport=tcp" in "contact" field?
El Tuesday 22 April 2008 17:45:26 Iñaki Baz Castillo escribió:
- Do I have something particular to do while registering to tell
OpenSER that the client is listening in UDP and TCP ?
If a client registers using TCP it has "transport=tcp" in the REGISTER "Contact" header: sip:user@192.168.1.58;transport=tcp
So you could add this parameter to "Contact" header before save it in location table.
But I've a doubt: when client is behind NAT the "received" column stored in "location" table is: sip:user@PUBLIC_IP;transport=tcp
So I assume that it's neccesary to add also here the "transport=tcp" parameter but have no idea of how to do it. Suggestions? is it necessary or is it enought with the "transport=tcp" in "contact" field?
Afortunatelly I've forgiven an issue: the "socket" field: tcp:IP:5060
so instead of trying to modify the register process, add "transport=tcp" parameter to the RURI when the request goes to one of these users.