Haphil
Haphil

Reputation: 1250

What needs to be done to change the SIP transport protocol in-between an established dialog?

Given a SIP dialog (INVITE, 200 OK, ACK) has been established via TCP. How can it be switched to UDP?

I would assume it could be done via RE-INVITE, changing the Via- and the Contact-Header.


Note that in rfc3665#3.7#F9 the RE-INVITE changes the IP address, so I assume the transport protocol could be switched as well..

Upvotes: 1

Views: 1504

Answers (2)

Bucq
Bucq

Reputation: 1021

You can switch freely between transports when sending (or receiving) SIP messages. Even within a dialog. The type of transport isn't set for a dialog when it is established.

The type of transport used for a certain message can indeed be reflected in the Via and Contact headers, URIs etc. But that doesn't mean a SIP message with 'UDP' in the Via header has been sent/received via UDP: if a TCP connection exists between 2 SIP endpoints it makes perfect sense to use this connection for UDP messages too. Upgrading the transport is always allowed, downgrading isn't.

The only thing you have to keep in mind is security. When using sips-URIs, TLS etc. this can/will place restrictions on the type of transport you are allowed to use for communication.

Upvotes: 0

AymericM
AymericM

Reputation: 1745

rfc3665#3.7#F9 does not help for your use-case because it focus on explaining what's happening when the IP for media needs to be updated.

Every SIP transaction is independent and any transport can be used for each of them. However, if you update a dialog (transport, contact), it can be done by re-INVITE, but may also be done via UPDATE.

I would assume it could be done via RE-INVITE, changing the Via- and the Contact-Header.

This looks correct to me. In practice:

Via: SIP/2.0/UDP XXX.XXX.XXX.XXX:XXXX;branch=z9hG4bKlkld5l
Contact: <sip:[email protected]:XXXX>

should be modified to

Via: SIP/2.0/TCP YYY.YYY.YYY.YYY:YYYY;branch=z9hG4bKlkld5l
Contact: <sip:[email protected]:YYYY>

And in real life, you could also use and/or mofidy transport=UDP in Contact and rport parameter in Via.

SIDENOTE: Switching from TCP to UDP is strongly not recommended. Only switching from UDP to TCP is supposed to provide benefits.

Upvotes: 0

Related Questions