Skip to content
SIP Mastery

Part 6 · Transports / Module 19

SIP over UDP, TCP, TLS, and WebSocket

How SIP messages travel — UDP with its retransmission timers and fragmentation, the 1300-byte rule, TCP connections, framing, and reuse, TLS with SNI and certificate checks, WebSocket in the browser, the transport in Via and in URIs, keepalives, and why a server behind NAT must reuse the client's connection.

IntermediateAdvancedNOC coreDEV core

After this module, you can

  • Explain what SIP does differently over UDP and over a connection.
  • Apply the 1300-byte rule, and predict when a proxy changes the transport.
  • Explain IP fragmentation, and why one lost fragment loses a whole SIP message.
  • Follow a TLS connection to a SIP server, including SNI and the certificate check.
  • Read SIP over WebSocket, with its WSS Via and .invalid addresses.
  • Choose a keepalive for each transport, and explain why a server must reuse a client's connection behind NAT.
On this page10 sections
  1. 19.1UDP: simple, needs retransmission timers, can fragment
  2. 19.2The 1300-byte rule
  3. 19.3TCP: connections, framing, and connection reuse
  4. 19.4TLS: handshake, SNI, certificate checks, port 5061
  5. 19.5WebSocket: SIP in the browser
  6. 19.6The transport in Via and ;transport=; changing transport between hops
  7. 19.7Keepalives: CRLF ping and pong, OPTIONS, TCP keepalive
  8. 19.8Behind NAT, the server must reuse the client’s connection
  9. Common mistakes
  10. Summary

19.1 UDP: simple, needs retransmission timers, can fragment

Module 2 introduced UDP and TCP. Every SIP element must support both:

RFC 3261 §18 · Transport
“All SIP elements MUST implement UDP and TCP. SIP elements MAY implement other protocols.”
Read the section ↗
UDP TCP TLS WebSocket (WSS)
Default port 5060 5060 5061 443 (HTTPS)
Via SIP/2.0/UDP SIP/2.0/TCP SIP/2.0/TLS SIP/2.0/WSS
Lost packets SIP resends: Timers A and E TCP resends TCP resends TCP resends
Message boundaries One message per datagram Content-Length Content-Length One message per WebSocket message
Large messages Fragmented: risky Fine Fine Fine
Encrypted No No Yes Yes
Typical use Many phones and trunks Large messages, some trunks Phones to providers, trunks Browsers (WebRTC)

Over UDP, SIP itself resends lost messages: Timer A doubles the gap from 500 ms, up to seven sends in 32 seconds (Module 8). Over TCP, TLS, and WebSocket, the transport resends lost data, and SIP does not.

RFC 3261 §17.1.1.2 · Formal Description
“The value of 64*T1 is equal to the amount of time required to send seven requests in the case of an unreliable transport.”
Read the section ↗

UDP has a size problem. An IP packet can be at most as large as the MTU of every link on the path: 1500 bytes on Ethernet, less in a VPN tunnel or over PPPoE. A larger UDP datagram is cut into IP fragments. The receiver can rebuild the datagram only when every fragment arrives; if one is lost, the whole SIP message is lost, and SIP must resend all of it. Many firewalls and NAT routers drop fragments after the first, because they carry no port numbers. Then a large message over UDP never arrives at all.

Try different sizes, paths, and losses:

Transport race · the same message over UDP and TCP

Does a 1410-byte INVITE get through?

  • Arrived
  • Lost

RFC 3261 §18.1.1: 1410 bytes is over 1300 and the path MTU is unknown: send it over TCP.

UDP 2 IP fragments per send

  1. send 0 ms✕message lost
  2. resend 500 ms✕message lost
  3. resend 1.5 s✕message lost
  4. resend 3.5 s✕message lost
  5. resend 7.5 s✕message lost
  6. resend 15.5 s✕message lost
  7. resend 31.5 s✕message lost

Never delivered: Timer B ends the transaction after 32 s, and the caller gets 408.

TCP 2 segments, after a handshake

  1. 0 msSYN
  2. 40 msSYN-ACK
  3. 80 msACK
  4. 120 mssegment 1
  5. 120 mssegment 2

Delivered after 160 ms. TCP resends only what was lost, and it never fragments: each segment fits the path.

19.2 The 1300-byte rule

RFC 3261 avoids fragmentation with a simple rule: a large request goes over TCP.

RFC 3261 §18.1.1 · Sending Requests
“If a request is within 200 bytes of the path MTU, or if it is larger than 1300 bytes and the path MTU is unknown, the request MUST be sent using an RFC 2914 [43] congestion controlled transport protocol, such as TCP.”
Read the section ↗
Request size Path MTU known? Transport
Up to 1300 bytes No UDP is allowed
Over 1300 bytes No TCP (or another congestion-controlled transport)
Within 200 bytes of the MTU Yes TCP

The 200 bytes leave room for the response, which can be larger than the request: a 200 OK carries Record-Route values and an SDP answer. The rule applies to each hop. A request that leaves Alice at 1296 bytes can grow over 1300 at Proxy A, which adds its Via and Record-Route. Then Proxy A must send it over TCP, and write TCP in its own Via:

RFC 3261 §18.1.1 · Sending Requests
“If this causes a change in the transport protocol from the one indicated in the top Via, the value in the top Via MUST be changed. This prevents fragmentation of messages over UDP and provides congestion control for larger messages.”
Read the section ↗

Call flow · the proxy switches to TCP

Fixed: the proxy switches to TCP

  • SIP
  • TCP / IP
Alice192.0.2.10Proxy A198.51.100.10Bob203.0.113.2001INVITE (UDP)02100 Trying03TCP handshake04INVITE (TCP)05180 Ringing06180 Ringing
01/06

Alice sends the INVITE over UDP: 1296 bytes, under 1300.

All steps as text
  1. Alice → Proxy A: INVITE (UDP). Alice sends the INVITE over UDP: 1296 bytes, under 1300.
  2. Proxy A → Alice: 100 Trying. Proxy A takes the call.
  3. Proxy A → Bob: TCP handshake. The forwarded INVITE would be over 1300 bytes, so Proxy A opens a TCP connection to Bob first.
  4. Proxy A → Bob: INVITE (TCP). Proxy A writes TCP in its own Via. TCP cuts the stream into segments and resends any segment that goes missing.
  5. Bob → Proxy A: 180 Ringing. Bob answers on the same TCP connection.
  6. Proxy A → Alice: 180 Ringing. Proxy A removes its Via and sends the 180 to Alice over UDP. Each hop chooses its own transport.

So a server that listens on UDP must also listen on TCP, at the same address and port:

RFC 3261 §18.2.1 · Receiving Requests
“For any port and interface that a server listens on for UDP, it MUST listen on that same port and interface for TCP.”
Read the section ↗

Messages grow quickly: video, many codecs, SRTP keys, ICE candidates, and long Via and Record-Route lists from several proxies. Compact header names (Module 4) help a little; TCP or TLS removes the problem.

19.3 TCP: connections, framing, and connection reuse

Over TCP, SIP is a stream of bytes. Several messages can arrive in one TCP segment, and one message can be split over several. The receiver finds where each message ends from Content-Length, which is therefore required (Module 4 has a framing lab):

RFC 3261 §18.3 · Framing
“The Content-Length header field MUST be used with stream oriented transports.”
Read the section ↗

A connection costs a handshake (and a TLS handshake, for TLS), so SIP keeps connections open and reuses them:

RFC 3261 §18 · Transport
“It is RECOMMENDED that connections be kept open for some implementation-defined duration after the last message was sent or received over that connection.”
Read the section ↗
RFC 3261 §18.1.1 · Sending Requests
“If a request is destined to an IP address, port, and transport to which an existing connection is open, it is RECOMMENDED that this connection be used to send the request, but another connection MAY be opened and used.”
Read the section ↗

Responses always go back on the connection the request arrived on:

RFC 3261 §18.2.2 · Sending Responses
“If the "sent-protocol" is a reliable transport protocol such as TCP or SCTP, or TLS over those, the response MUST be sent using the existing connection to the source of the original request that created the transaction, if that connection is still open.”
Read the section ↗

New requests in the other direction are different. Proxy A opens a connection to Proxy B from a random port, so when Proxy B has a request for Proxy A, it opens a second connection, to Proxy A’s port 5060:

RFC 5923 §1 · Introduction
“This frequently causes a pair of SIP entities to use one connection for requests sent in each direction, as shown below.”
Read the section ↗

RFC 5923 lets the two share one connection. The client adds ;alias to its Via; the server may then send its own requests back over that connection. It is safe only with TLS, where the server knows who is at the other end:

RFC 5923 §8.1 · Client Behavior
“The "alias" header field parameter is included in a Via header field value to indicate that the client wants to create a transport layer alias.”
Read the section ↗
RFC 5923 §3 · Applicability Statement
“This memo documents that it is good practice to only reuse those connections where the identity of the sender can be verified by the receiver.”
Read the section ↗

19.4 TLS: handshake, SNI, certificate checks, port 5061

SIP over TLS is SIP over TCP, with a TLS handshake first. The default port is 5061:

RFC 3261 §18.1.1 · Sending Requests
“If the port is absent, the default value depends on the transport. It is 5060 for UDP, TCP and SCTP, 5061 for TLS.”
Read the section ↗
Step What happens What can go wrong
TCP handshake Port 5061 Firewall blocks 5061
ClientHello Versions, ciphers, and SNI: the SIP domain the client wants No SNI: the server may send the certificate for another domain
ServerHello, Certificate The server proves who it is Expired, untrusted CA, or wrong name
Certificate check The client looks for the SIP domain in the certificate (RFC 5922, Module 14) A certificate for www. or the host name only
Finished Keys agreed; SIP flows encrypted —

A server that hosts many SIP domains picks the right certificate from the SNI in the ClientHello:

RFC 5922 §7.8 · Virtual SIP Servers and Certificate Content
“Alternatively, if the TLS client hello "server_name" extension as defined in RFC 4366 [4] is supported, the client SHOULD use that extension to request a certificate corresponding to the specific domain (from the SIP AUS) with which the client is seeking to establish a connection.”
Read the section ↗

Call flow · TLS to the proxy, then REGISTER

SIP over TLS: the handshake and the certificate check

  • SIP
  • TCP / IP
Alice192.0.2.10Proxy Aproxy.atlanta.example01TLS ClientHello02TLS ServerHello, Certificate03TLS Finished04REGISTER (TLS)05200 OK
01/05

Alice opens TCP to port 5061 and starts TLS. SNI names the SIP domain she wants: atlanta.example.

All steps as text
  1. Alice → Proxy A: TLS ClientHello. Alice opens TCP to port 5061 and starts TLS. SNI names the SIP domain she wants: atlanta.example.
  2. Proxy A → Alice: TLS ServerHello, Certificate. The proxy sends its certificate. Alice checks the CA, the dates, and that a SIP identity matches atlanta.example.
  3. Alice → Proxy A: TLS Finished. The handshake is complete. TLS encrypts everything after this.
  4. Alice → Proxy A: REGISTER (TLS). The REGISTER travels inside TLS. Via says TLS, the port is 5061, and the Contact asks for transport=tls.
  5. Proxy A → Alice: 200 OK. The response comes back on the same connection. Alice keeps it open for incoming calls.

The certificate check is the one Module 14 explains: the domain of the URI, not the host name from DNS, must be a SIP identity in the certificate. If it is not, the client closes the connection before any SIP is sent.

RFC 5922 §7.3 · Client Behavior
“If the server is not authenticated, the client MUST close the connection immediately.”
Read the section ↗

19.5 WebSocket: SIP in the browser

A web page cannot open raw UDP or TCP sockets. It can open a WebSocket: a two-way connection that starts as an HTTP request and then “upgrades”. RFC 7118 runs SIP over it, with the subprotocol sip. In practice, it is always secure WebSocket (WSS) on port 443.

RFC 7118 §4.1 · Handshake
“The client MUST include the value "sip" in the Sec-WebSocket-Protocol header in its handshake request.”
Read the section ↗
RFC 7118 §5 · SIP WebSocket Transport
“Each SIP message MUST be carried within a single WebSocket message, and a WebSocket message MUST NOT contain more than one SIP message.”
Read the section ↗

Call flow · a browser registers over WSS

SIP over WebSocket: a browser registers

  • SIP
  • TCP / IP
Aliceweb browserProxy Awss://proxy.atlanta.example01TLS handshake02WebSocket upgrade (GET)03101 Switching Protocols04REGISTER (WSS)05200 OK
01/05

The browser opens TCP and TLS to port 443, as for any HTTPS page.

All steps as text
  1. Alice → Proxy A: TLS handshake. The browser opens TCP and TLS to port 443, as for any HTTPS page.
  2. Alice → Proxy A: WebSocket upgrade (GET). The page asks to turn the HTTPS connection into a WebSocket, with the sip subprotocol.
  3. Proxy A → Alice: 101 Switching Protocols. The proxy agrees: the connection now carries SIP, one SIP message in each WebSocket message.
  4. Alice → Proxy A: REGISTER (WSS). JavaScript cannot learn its own IP address, so the Via and Contact use a random .invalid name. Outbound keeps the connection as the route to Alice.
  5. Proxy A → Alice: 200 OK. Calls for Alice will come back over this WebSocket. If the page closes, the registration is useless.
Over WebSocket
Via SIP/2.0/WSS (or WS without TLS)
URI parameter ;transport=ws
Host in Via and Contact A random .invalid name: JavaScript cannot learn its own IP address
Content-Length Not needed: each WebSocket message holds one SIP message
Incoming calls Only over the same WebSocket, so Outbound (RFC 5626) and GRUU are used
RFC 7118 §5.1 · Via Transport Parameter
“This document defines the value "WS" to be used for requests over plain WebSocket connections and "WSS" for requests over secure WebSocket connections (in which the WebSocket connection is established using TLS [RFC5246] with TCP transport).”
Read the section ↗

The media of a browser call is WebRTC: ICE, DTLS-SRTP, and usually Opus (Modules 18 and 26). A gateway converts it for ordinary SIP phones.

19.6 The transport in Via and ;transport=; changing transport between hops

Two places name a transport, with different meanings:

Where Example Meaning
Via Via: SIP/2.0/TCP proxy.atlanta.example;branch=… The transport this element used for this hop. Each element writes its own
URI parameter <sip:bob@203.0.113.20;transport=tcp> The transport to use to reach this URI
DNS (NAPTR, SRV) _sips._tcp.atlanta.example The transports a domain offers (Module 11)

Each hop chooses its own transport. A call can travel UDP from the phone to the proxy, TCP from proxy to proxy, and TLS to the carrier; the Via list then shows a different transport in each value. A response always uses the transport, and for connections the connection, of its request.

Many phones write ;transport=tls in their Contact. RFC 3261 had already deprecated it, and RFC 5630 confirms that it was never defined in an RFC; servers still accept it. The standard choices are a sips: URI, which requires TLS on every hop, or a sip: URI with TLS chosen by configuration, as a best effort (Module 14).

RFC 5630 §3.1.4 · Usage of the transport=tls URI Parameter and the TLS Via Parameter
“The transport=tls parameter has never been defined in an RFC, but only in some of the Internet drafts between [RFC2543] and [RFC3261].”
Read the section ↗

19.7 Keepalives: CRLF ping and pong, OPTIONS, TCP keepalive

A NAT router forgets a mapping after a quiet period, often 30 to 120 seconds for UDP, and longer for TCP. A firewall closes idle TCP connections. A phone that waits for incoming calls must keep its path open, and must notice when it breaks:

RFC 5626 §3.5 · Keep-Alive Technique
“Each of these mechanisms uses a client-to-server "ping" keep-alive and a corresponding server-to-client "pong" message.”
Read the section ↗
Keepalive Transport What it is Detects a dead path?
CRLF ping and pong TCP, TLS Double CRLF; the server answers a single CRLF Yes, if the server sends pongs (RFC 5626)
STUN UDP A STUN request on the SIP port Yes: and a changed NAT mapping
OPTIONS Any A full SIP request, often from proxies to trunks and gateways Yes: it also checks that SIP works
TCP keepalive TCP The operating system, usually every 2 hours by default Too slow for NAT
WebSocket ping WebSocket A ping frame, when the browser sends one Depends on the browser

Call flow · CRLF and STUN keepalives

Keepalives over TCP and UDP

  • RTCP
  • DNS / STUN / ICE
Alice192.168.1.20NAT router198.51.100.7Proxy B203.0.113.1001keepalive ping (CRLF CRLF)02keepalive pong (CRLF)03keepalive (STUN request)04keepalive (STUN response)
01/04

Every 120 seconds or so, the phone sends a double CRLF on its TCP connection. It keeps the NAT mapping and the connection open.

All steps as text
  1. Alice → Proxy B: keepalive ping (CRLF CRLF). Every 120 seconds or so, the phone sends a double CRLF on its TCP connection. It keeps the NAT mapping and the connection open.
  2. Proxy B → Alice: keepalive pong (CRLF). The proxy answers with a single CRLF. No pong means the connection is dead, and the phone registers again.
  3. Alice → Proxy B: keepalive (STUN request). Over UDP, CRLF is not answered. The phone sends a STUN Binding request on its SIP port instead.
  4. Proxy B → Alice: keepalive (STUN response). The response says which public address and port the proxy sees. If they change, the NAT mapping changed: register again.
RFC 5626 §3.5.2 · STUN Keep-Alive Technique
“To detect this, STUN requests are sent over the same flow that is being used for the SIP traffic.”
Read the section ↗

Outside Outbound, the keep parameter in Via (RFC 6223) asks the next hop to accept keepalives and suggests an interval:

RFC 6223 §1 · Introduction
“This specification defines a new Session Initiation Protocol (SIP) [RFC3261] Via header field parameter, "keep", which allows adjacent SIP entities to explicitly negotiate usage of the NAT keep-alive mechanisms defined in SIP Outbound.”
Read the section ↗

19.8 Behind NAT, the server must reuse the client’s connection

A phone behind NAT can open connections out, but nobody can open a connection in: the NAT router has no mapping for it. So when a call for Alice arrives, the proxy must send the INVITE over the connection that Alice opened when she registered. Opening a new connection to her Contact address fails.

RFC 5626 §7 · Authoritative Proxy Procedures: Forwarding Requests
“If the proxy is co-located with the registrar and stored information about the flow to the UA that created the binding, then the proxy MUST send the request over the same 'logical flow' saved with the binding, since that flow is known to deliver data to the specific target UA instance's network flow that was saved with the binding.”
Read the section ↗
RFC 5923 §3 · Applicability Statement
“SIP entities that can only open a connection in a specific direction -- perhaps because of Network Address Translation (NAT) and firewalls -- reuse their connections using the mechanism described in the outbound document [RFC5626].”
Read the section ↗

The proxy keeps the connection as part of the registration (Outbound uses a flow token in Path for this, Module 12), and the phone keeps it alive with keepalives (19.7). If the connection drops, the phone registers again at once, on a new connection. Module 20 covers NAT for UDP and for the media.

Common mistakes

A large INVITE over UDP is fragmented and dropped

A phone sends a large INVITE over UDP: audio and video codecs, ICE candidates, and a long Allow and Supported list. It fits under 1300 bytes. Proxy A adds its Via and Record-Route, the message grows to 1410 bytes, and Proxy A still sends it over UDP. On a path through a VPN tunnel, the datagram is cut into two IP fragments. A firewall drops the second. Bob’s phone never sees the INVITE; the retransmissions fail the same way; after 32 seconds the caller gets 408. Small calls work, so the failure looks random.

Broken

Broken: a large INVITE over UDP

  • SIP
  • ⚠Problem
Alice192.0.2.10Proxy A198.51.100.10Bob203.0.113.2001INVITE (UDP)02100 Trying03✕INVITE (UDP)04✕INVITE (retransmit)05408 Request Timeout⚠06ACK
01/06

Alice sends a large INVITE: audio, video, and ICE candidates. At 1296 bytes, it still fits in one UDP packet.

All steps as text
  1. Alice → Proxy A: INVITE (UDP). Alice sends a large INVITE: audio, video, and ICE candidates. At 1296 bytes, it still fits in one UDP packet.
  2. Proxy A → Alice: 100 Trying. Proxy A takes the call.
  3. Proxy A → Bob: INVITE (UDP). Proxy A adds its Via and Record-Route: 1410 bytes. The path MTU is 1400, so IP cuts the UDP packet in two.
  4. Proxy A → Bob: INVITE (retransmit). Timer A fires and Proxy A resends the whole INVITE. The firewall drops the same fragment again.
  5. Proxy A → Alice: 408 Request Timeout. After 32 seconds, Timer B ends the transaction. Bob's phone never rang. Problem: The call fails for one reason: the message is too large for UDP.
  6. Alice → Proxy A: ACK. Alice acknowledges the 408 on her hop.

Remember: over 1300 bytes (or within 200 bytes of a known MTU), a request goes over TCP, at every hop. Listen on TCP wherever you listen on UDP. In a capture, look for IP fragments (“Fragmented IP protocol”) and a datagram that never completes. Moving to TCP or TLS for all signaling removes the problem.

The server opens a new TCP/TLS connection to a client behind NAT

A phone behind NAT registers over TCP. When a call arrives for it, the proxy opens a new connection to the Contact address, a private address, or to the NAT router’s public address on port 5060. The router has no mapping for an incoming connection and drops it. Outgoing calls work; incoming calls fail.

Broken: a new connection

Broken: the proxy opens a new connection to Alice

  • SIP
  • TCP / IP
  • ⚠Problem
Alice192.168.1.20NAT router198.51.100.7Proxy B203.0.113.1001TCP handshake02REGISTER (TCP)03REGISTER (TCP)04200 OK05200 OK06✕TCP SYN to port 5060⚠
01/06

Alice's phone opens TCP to the proxy. The NAT router maps 192.168.1.20:51234 to 198.51.100.7:40112.

All steps as text
  1. Alice → Proxy B: TCP handshake. Alice's phone opens TCP to the proxy. The NAT router maps 192.168.1.20:51234 to 198.51.100.7:40112.
  2. Alice → NAT router: REGISTER (TCP). Alice registers over the connection. Her Contact is her private address.
  3. NAT router → Proxy B: REGISTER (TCP). The NAT router changes the IP and TCP headers, not the SIP.
  4. Proxy B → NAT router: 200 OK. The proxy answers on the same connection, as RFC 3261 requires for TCP.
  5. NAT router → Alice: 200 OK. Alice now has a binding at the registrar.
  6. Proxy B → NAT router: TCP SYN to port 5060. A call for Alice arrives, and Proxy B opens a new TCP connection to port 5060 of the NAT router. The router has no mapping for it. Problem: The call for Alice fails, though her connection to the proxy is open.

Remember: send requests for a registered phone over the connection it registered on (RFC 5626 flows, or a proxy setting such as “force connection reuse”). Keep that connection alive with CRLF keepalives, and expire the binding when the connection closes.

The TLS certificate does not match the SIP domain

A provider moves its phones to TLS and installs the certificate it already has for its web site: www.atlanta.example. The phones connect, receive the certificate, look for atlanta.example, and do not find it. They close the connection during the handshake. No SIP is sent, so the SIP logs on the server show nothing; the phones say only “TLS handshake failed”.

Broken: web certificate

Broken: the certificate does not name the SIP domain

  • TCP / IP
  • Error
  • ⚠Problem
Alice192.0.2.10Proxy Aproxy.atlanta.example01TLS ClientHello02TLS ServerHello, Certificate03TLS alert (bad_certificate)⚠
01/03

Alice opens TCP to port 5061 and starts TLS. SNI names the SIP domain she wants: atlanta.example.

All steps as text
  1. Alice → Proxy A: TLS ClientHello. Alice opens TCP to port 5061 and starts TLS. SNI names the SIP domain she wants: atlanta.example.
  2. Proxy A → Alice: TLS ServerHello, Certificate. The proxy sends a certificate for www.atlanta.example only. It is valid, but for the wrong name.
  3. Alice → Proxy A: TLS alert (bad_certificate). Alice's phone rejects the certificate and closes the connection. It sends no SIP at all. Problem: The phone shows "registration failed". The log says only "TLS handshake failed".

Remember: the certificate must name the SIP domain of the URI: URI:sip:atlanta.example or DNS:atlanta.example in subjectAltName, as Module 14 explains. A host name such as sip1.atlanta.example alone is not enough. Test with openssl s_client -connect proxy.atlanta.example:5061 -servername atlanta.example and read the subjectAltName.

Summary

  • Every SIP element supports UDP and TCP. TLS (port 5061) and WebSocket (WSS, port 443) run over TCP.
  • Over UDP, SIP resends lost messages itself; over TCP, TLS, and WebSocket, the transport does.
  • A UDP datagram larger than the path MTU becomes IP fragments; one lost fragment loses the whole message, and firewalls often drop fragments. A request over 1300 bytes therefore goes over TCP, at every hop, and the top Via says so.
  • Over TCP, Content-Length frames each message. Connections are kept open and reused; with TLS, ;alias lets both sides share one.
  • TLS uses SNI and a certificate check against the SIP domain. A wrong certificate stops the connection before any SIP.
  • Via says which transport a hop used; ;transport= says which to use for a URI. transport=tls is common but was never standardised.
  • Keepalives keep NAT mappings and connections open: CRLF ping and pong over TCP, STUN over UDP, OPTIONS between servers.
  • Behind NAT, a server must send requests for a phone over the phone’s own connection.