SIP: Session Initiation Protocol
obsoletes
- rfc-2543 — SIP: Session Initiation Protocol
updated by
- rfc-3265 — Session Initiation Protocol (SIP)-Specific Event Notification
- rfc-3853 — S/MIME Advanced Encryption Standard (AES) Requirement for the Session Initiation Protocol (SIP)
- rfc-4320 — Actions Addressing Identified Issues with the Session Initiation Protocol's (SIP) Non-INVITE Transaction
- rfc-4916 — Connected Identity in the Session Initiation Protocol (SIP)
- rfc-5393 — Addressing an Amplification Vulnerability in Session Initiation Protocol (SIP) Forking Proxies
- rfc-5621 — Message Body Handling in the Session Initiation Protocol (SIP)
- rfc-5626 — Managing Client-Initiated Connections in the Session Initiation Protocol (SIP)
- rfc-5630 — The Use of the SIPS URI Scheme in the Session Initiation Protocol (SIP)
- rfc-5922 — Domain Certificates in the Session Initiation Protocol (SIP)
- rfc-5954 — Essential Correction for IPv6 ABNF and URI Comparison in RFC 3261
- rfc-6026 — Correct Transaction Handling for 2xx Responses to Session Initiation Protocol (SIP) INVITE Requests
- rfc-6141 — Re-INVITE and Target-Refresh Request Handling in the Session Initiation Protocol (SIP)
- rfc-6665 — SIP-Specific Event Notification
- rfc-6878 — IANA Registry for the Session Initiation Protocol (SIP) "Priority" Header Field
- rfc-7462 — URNs for the Alert-Info Header Field of the Session Initiation Protocol (SIP)
- rfc-7463 — Shared Appearances of a Session Initiation Protocol (SIP) Address of Record (AOR)
- rfc-8217 — Clarifications for When to Use the name-addr Production in SIP Messages
- rfc-8591 — SIP-Based Messaging with S/MIME
- rfc-8760 — The Session Initiation Protocol (SIP) Digest Access Authentication Scheme
- rfc-8898 — Third-Party Token-Based Authentication and Authorization for Session Initiation Protocol (SIP)
- rfc-8996 — Deprecating TLS 1.0 and TLS 1.1
Extracted elements (28)
INVITE uses a three-way handshake (INVITE / 2xx / ACK) rather than a two-way exchange because sessions require resource allocation (media ports, codec negotiation) and the callee must know the caller received the final response before assuming the session is established. The ACK also handles the long delay between ringing and answering, during which retransmitted 200 OKs would otherwise be ambiguous.
RFC 3261 replaces RFC 2543 strict routing with loose routing, separating the final destination (Request-URI) from intermediate proxies (Route header). Strict routing destroyed the Request-URI when a Route header was present, making it impossible to route to a specific target through a configured proxy set and causing interoperability problems with chained proxies.
SIP elements that implement strict routing (following RFC 2543 rules) will place themselves in the Request-URI rather than a Route header when Record-Route is used, breaking loose-routing proxies. Section 16.12.1.2 defines specific procedures for a loose-routing proxy to detect and correct for a strict-routing proxy in the path.
A proxy MUST NOT forward a request whose Max-Forwards value is zero; it MUST return 483 (Too Many Hops). Every proxy forwarding a request MUST decrement Max-Forwards by exactly one.
A UAS receiving a request with a Require header listing unsupported option tags MUST reject the request with 420 (Bad Extension) and list unrecognized tags in an Unsupported header field. A proxy encountering an unrecognized Proxy-Require tag MUST similarly return 420.
Applications sending SIP messages MUST include SIP-Version 'SIP/2.0'. Implementations MUST send upper-case, though the string is case-insensitive for reception.
Every new request MUST include a Via branch parameter that is unique across space and time. To distinguish RFC 3261 transactions from RFC 2543 ones, the branch value MUST begin with the magic cookie 'z9hG4bK'. This enables reliable transaction matching by all elements.
Implementations MUST accept both long and compact forms of each header name (e.g., 'Via' and 'v', 'From' and 'f', 'To' and 't', 'Contact' and 'm'). A compact form MAY be substituted for the longer form at any time without changing message semantics.
Requests addressed to a SIPS URI MUST be sent over TLS, guaranteeing encrypted transport from caller to the callee's domain. From there, the callee's domain is responsible for securing the final hop per its own policy.
The Request-URI MUST NOT contain unescaped spaces or control characters and MUST NOT be enclosed in angle brackets '<>'. This prevents ambiguity in request-line parsing.
A dialog is a peer-to-peer SIP relationship uniquely identified by the triple: Call-ID, local tag (From tag), and remote tag (To tag). Dialogs are established by 2xx responses to INVITE and persist until terminated by BYE.
Record-Route and Route headers enable proxies to remain in the signaling path for a dialog's lifetime. A proxy inserts a Record-Route entry into INVITE requests; both endpoints accumulate the resulting route set and include it as Route headers in all subsequent dialog requests.
SIP defines six core methods: REGISTER for registering contact information, INVITE/ACK/CANCEL for session setup, BYE for session termination, and OPTIONS for capability queries. Standards-track RFCs may define additional methods.
SIP defines two URI schemes: 'sip:' (insecure) and 'sips:' (requires TLS end-to-end to the target domain). URI comparison rules handle case-insensitivity, default port equivalence (5060 for sip, 5061 for sips), and default transport, ensuring consistent matching across implementations.
The Contact header field carries a SIP/SIPS URI giving a direct route to the sending UA. Unlike Via (used for routing the current response), Contact tells other elements where to send future requests within the dialog, and is the mechanism by which endpoints bypass proxies for mid-dialog messages.
The CSeq header contains a monotonically increasing 32-bit integer and a method name. Each new non-ACK, non-CANCEL request within a dialog MUST increment the CSeq number, providing ordering and retransmission detection across a dialog's lifetime.
The Via header field records each hop's address and branch parameter as a request traverses the network, enabling responses to be routed back along the same path without requiring stateful proxies or DNS lookups on the return path. Each proxy adds its own Via entry and removes it when forwarding responses upstream.
RFC 3261 establishes IANA registries for: SIP Option Tags (Section 27.1), SIP Warn-Codes (Section 27.2), SIP Header Field Names (Section 27.3), SIP Methods and Response Codes (Section 27.4), the 'message/sip' MIME type (Section 27.5), and Content-Disposition parameter values (Section 27.6).
HTTP Digest authentication in SIP does not protect message bodies or most header fields, does not provide mutual authentication unless auth-int QOP is used, and does not prevent man-in-the-middle attacks against the initial challenge. TLS or S/MIME must be used in conjunction with Digest for stronger security guarantees.
Registration hijacking occurs when an attacker forges REGISTER requests to redirect a victim's incoming calls. Mitigation requires authenticating REGISTER requests via HTTP Digest or mutual TLS to ensure only the legitimate user can update location bindings.
S/MIME is specified for protecting SIP message bodies and for tunneling a signed copy of SIP headers inside an encrypted MIME body to prevent proxy modification. This provides end-to-end integrity and confidentiality even when the signaling path traverses untrusted proxies.
SIP is vulnerable to DoS amplification because Via headers can be forged with a third party's IP address, causing SIP elements to flood that address with responses. Implementations SHOULD use TLS (which prevents source-address spoofing) and SHOULD authenticate requests to reduce amplification risk.
Non-INVITE client transactions have states: Trying (request sent, Timer F started), Proceeding (1xx received), Completed (final response received; Timer K absorbs retransmissions on unreliable transport), and Terminated. Timer E drives retransmissions on unreliable transport while in Trying/Proceeding.
The INVITE client transaction has four states: Calling (initial; retransmits INVITE on Timer A for unreliable transport), Proceeding (1xx received), Completed (3xx-6xx received; ACK sent, Timer D started to absorb retransmissions), and Terminated. Timer B in Calling state causes timeout failure if no response arrives.
The INVITE server transaction has four states: Proceeding (retransmits latest provisional on INVITE retransmissions), Completed (3xx-6xx sent; retransmits on Timer G for unreliable transport, awaits ACK), Confirmed (ACK received; Timer I absorbs ACK retransmissions), and Terminated. 2xx responses are passed directly to the TU and bypass the server transaction.
A SIP message consists of a start-line, zero or more header fields, a mandatory empty CRLF line, and an optional message-body: 'start-line *message-header CRLF [message-body]'. The empty CRLF separator line MUST be present even when the body is absent. SIP is text-based using UTF-8.
The Request-Line encodes Method, Request-URI, and SIP-Version separated by single SP characters, terminated by CRLF: 'Method SP Request-URI SP SIP-Version CRLF'. No CR, LF, or linear whitespace is permitted within any element.
The Status-Line encodes SIP-Version, a 3-digit Status-Code, and Reason-Phrase separated by single SP characters, terminated by CRLF: 'SIP-Version SP Status-Code SP Reason-Phrase CRLF'. Status-Code classes 1xx through 6xx indicate provisional, success, redirection, client error, server error, and global failure.