What Is SIP? Session Initiation Protocol Guide

Published 2026-05-07Updated 2026-09-26 36 min readSIPPER Team

SIP (Session Initiation Protocol, RFC 3261) is the application-layer signalling protocol that creates, modifies and terminates voice, video and other real-time sessions over IP. This reference explains how SIP works with SDP and RTP, how messages, transactions and dialogs fit together, how registration, authentication, NAT traversal and security behave, and how to troubleshoot real calls one layer at a time.

Analysing SIP: Separate the Layers Before Diagnosing

A common enterprise ticket reads: extension 1001 is registered, it receives an inbound call, the user hears the caller clearly, but the caller hears nothing. Registration status cannot explain this. A successful REGISTER proves only that SIP signalling reaches the registrar; it says nothing about where RTP packets are sent, whether a firewall accepts them, or whether the far end can decode them.

SIP separates session control from the media itself. SIP messages negotiate who talks to whom and with which media description; SDP bodies inside those messages describe addresses, ports and codecs; RTP then carries the audio independently, often along a different network path from the signalling. A fault in one plane can look like a fault in another unless each plane is checked against its own evidence.

A practical model uses four planes. The connectivity plane covers IP routing, DNS resolution, the chosen transport (UDP, TCP, TLS or WebSocket) and firewall state. The signalling plane covers requests, responses, transactions and dialogs. The session-description plane covers SDP: the connection address, the media port, the payload formats and the direction attributes. The media and application plane covers RTP and RTCP delivery, loss, jitter, decoding and what the user actually hears.

Good diagnostic notes record facts per plane rather than conclusions. For example: the INVITE received a 200 OK and the callee received the matching ACK; the SDP answer selected PCMA, payload 8, at 198.51.100.20:41000; RTP from 198.51.100.20 reaches 192.0.2.10, but RTP from 192.0.2.10 never gets past the branch firewall toward 198.51.100.20. A note like this points directly at the component that needs fixing.

An overview separating SIP signalling from call media.
Figure 01: SIP signalling negotiates the session, while RTP carries the call media as a separate flow.

Protocol Roles: SIP, SDP, RTP and RTCP in a VoIP Call

These terms are often used interchangeably in sales material, but each one names a different layer. VoIP is the overall practice of carrying voice over IP. SIP (RFC 3261) is the control protocol. SDP (RFC 8866) is the format that describes media. RTP (RFC 3550) carries the digitised audio. A SIP trunk is a service or interconnection that uses SIP between telephony systems, most often between an enterprise PBX and a provider that reaches the public telephone network.

The working model is simple: SIP coordinates the session, SDP describes the media parameters, and RTP moves the audio. Because these are separate flows, SIP messages may traverse one or more proxies while RTP travels directly between endpoints, or through a media relay such as an SBC, depending on the design. Never assume that the signalling path and the media path are the same.

SIP can traverse a proxy while RTP follows the direct endpoint path in this example.
Figure 02: In this example SIP passes through a proxy while RTP flows directly between the two endpoints.
TermWhat it isWhat it is not
SIPA signalling protocol that establishes, modifies and ends sessions (RFC 3261)The transport or playback of voice
VoIPVoice communication carried over IP networksTied to one mandatory signalling protocol
SIP trunkA SIP interconnection between a PBX and a provider or another systemA fixed registration method or codec policy
PBX, IP-PBX, Cloud PBXA private telephony system; IP describes its networking, cloud describes where it runsOne fixed SIP architecture
SDPA text description of media sessions (RFC 8866), used with the offer/answer model (RFC 3264)A media stream itself
RTP and RTCPReal-time media transport and its companion control and reporting protocol (RFC 3550)A guarantee of bandwidth, delivery or voice quality
SRTP and SRTCPConfidentiality, integrity and replay protection for RTP and RTCP (RFC 3711)Encryption of SIP signalling
SBCA session border control function, usually built as a B2BUAOne universal product or an automatic security guarantee
WebRTCA browser real-time communication architecture and protocol suiteA requirement to use SIP for signalling

SIP Entities: User Agents, Proxy, Registrar, B2BUA and SBC

A user agent (UA) is a logical endpoint function. It acts as a user agent client (UAC) when it sends a request and as a user agent server (UAS) when it receives a request and generates responses. The role is defined per transaction, not per device: an IP phone is a UAC when it sends INVITE and a UAS when it later receives BYE from the other party.

A proxy server receives requests and forwards them toward the target, making routing decisions from the Request-URI, its own policy and DNS. A proxy does not originate or answer calls. A stateful proxy keeps transaction state and can fork a request to several contacts in parallel; it may also insert a Record-Route header so that later requests in the dialog continue to pass through it.

A registrar accepts REGISTER requests and stores bindings between an address of record (AoR) and one or more contact addresses in a location service. Proxies query that location service to find where a user can currently be reached. Many products combine the registrar, location service and proxy in one server, but RFC 3261 treats them as distinct logical roles.

A back-to-back user agent (B2BUA) terminates a call as a UAS on one side and originates a separate call as a UAC on the other. Each side is an independent dialog with its own Call-ID, tags and CSeq numbering. IP-PBXs and session border controllers (SBCs) usually behave as B2BUAs, which lets them hide internal topology, normalise headers between vendors, enforce admission and fraud policy, and anchor or transcode media when the design requires it.

A redirect server is a further role: instead of forwarding a request, it answers with a 3xx response listing alternative contacts that the sender can try itself.

Transport, Addressing and DNS Resolution (RFC 3263)

SIP runs over UDP, TCP, TLS over TCP, SCTP and WebSocket (RFC 7118, used by browser clients). The default port for sip URIs over UDP or TCP is 5060, and the default for TLS is 5061. These defaults apply only when no explicit port is given; any deployment may use other ports.

The transport choice applies to signalling only. Running SIP over TCP or TLS does not move RTP onto TCP; the media still uses the transport described in SDP, which for RTP/AVP and RTP/SAVP is UDP. Likewise, a WebRTC client that signals SIP over a secure WebSocket still sends its media over separate DTLS-SRTP flows, not inside the WebSocket.

UDP is sensitive to message size. RFC 3261 requires a client to use a congestion-controlled transport such as TCP when a request is within 200 bytes of the path MTU, or larger than 1300 bytes when the MTU is unknown. Large INVITEs with long SDP bodies are therefore a real source of IP fragmentation problems on UDP.

Addressing: Address of Record versus Contact URI

An address of record is the stable, public identity of a user, for example sip:1001@example.com. A Contact URI is the concrete address where a particular device is listening right now, for example sip:1001@192.0.2.10:5060. Registration creates the binding between the two, and several devices can register contacts for the same AoR at the same time.

Telephone numbers usually appear either as sip URIs whose user part is a global number such as +6620000000, or as tel URIs defined in RFC 3966. Well-designed systems normalise numbers into one format before making routing decisions.

Next-Hop Resolution with NAPTR, SRV and A or AAAA Records

RFC 3263 defines how a client turns a SIP URI into a next-hop address, port and transport. If the host part is already a numeric IP address, no DNS lookup is needed. If a transport parameter is present but no port, the client skips NAPTR and queries SRV records such as _sip._udp.example.com directly. If an explicit port is present, the client skips both NAPTR and SRV and resolves only the A or AAAA records of the host.

Otherwise the client first queries NAPTR records to learn which transports the domain supports and in what order of preference, then SRV records such as _sips._tcp.example.com or _sip._udp.example.com to obtain prioritised, weighted targets and ports, and finally A or AAAA records to obtain IP addresses. The SRV result also provides the ordered list of fallback servers a client uses when the first one does not respond.

When a call fails before any response arrives, confirm which next hop was actually selected. A phone with a hard-coded port, a stale DNS cache, or a resolver that does not return SRV records may be sending to a different server from the one the administrator expects.

SIP Message Syntax and Header Fields

SIP is a text protocol with a syntax modelled on HTTP. Every message has a start-line, a set of header fields, an empty line marking the end of the headers, and an optional body. A request starts with a Request-Line containing the method, the Request-URI and the SIP version; a response starts with a Status-Line containing the SIP version, a three-digit status code and a reason phrase. Lines end with CRLF, header names are case-insensitive, and compact forms exist, such as v for Via and i for Call-ID.

RFC 3261 section 8.1.1 lists the header fields that every request must contain: To, From, CSeq, Call-ID, Max-Forwards and Via. Contact is additionally required in requests that can create a dialog, such as INVITE, and REGISTER uses Contact to carry the bindings being added or removed.

Keep the Request-URI and the To header apart. Proxies retarget the Request-URI as the request moves toward the device that will answer, while To keeps the logical target the caller originally asked for. Media addresses never appear in these SIP headers; they are carried in the c= and m= lines of the SDP body.

A SIP message divided into start-line, headers, blank line and SDP body.
Figure 03: A SIP message has a start-line, header fields, an empty line and, in this example, an SDP body.
Header or elementPurposeWhat to check
Request-URIThe resource the request is addressed to at this hopNumber format and whether each proxy rewrote it as expected
Via and branchRecords the path for responses; the top branch identifies the transactionA branch starting with z9hG4bK and one Via entry per hop
received and rportSource address and port observed by the next hop (RFC 3261, RFC 3581)Whether responses return to the correct NAT mapping
From, To and tagsLogical originator and target; the tags identify both ends of the dialogFrom tag present on requests, To tag added by the UAS
Call-IDGroups every message of one registration or dialogThe same value throughout a dialog and a new value per call
CSeqSequence number paired with the method nameWhich request a given response belongs to
ContactWhere the sender can be reached directly for later requestsPrivate or unreachable addresses behind NAT
Max-ForwardsRemaining hop count, normally starting at 70483 Too Many Hops caused by routing loops
Record-Route and RouteKeep selected proxies on the path of in-dialog requestsMissing entries that let requests bypass an SBC or PBX
Allow, Supported and RequireAdvertise methods and extension option tagsWhether a needed extension such as 100rel is present
Content-Type and Content-LengthFormat and length in bytes of the bodyLength mismatches after an intermediary edits the body
Authorization and Proxy-AuthorizationCredentials sent in reply to a challengeThe correct header pair for 401 versus 407

SIP Methods and Response Codes

RFC 3261 defines six core methods. INVITE starts a session, or modifies an existing one when sent inside a dialog as a re-INVITE. ACK confirms a final response to INVITE. BYE ends a session. CANCEL asks the server to stop processing a pending request, which in practice means an INVITE that has not been answered. REGISTER adds, refreshes or removes contact bindings. OPTIONS queries capabilities and is widely used as a keepalive or health probe between PBXs, SBCs and providers.

Extensions add further methods. PRACK acknowledges reliable provisional responses (RFC 3262). UPDATE changes session parameters before or after answer without affecting dialog state (RFC 3311). REFER asks the recipient to contact a third party and is the basis of call transfer (RFC 3515). INFO carries application information within a dialog (RFC 6086). SUBSCRIBE and NOTIFY provide event notification (RFC 6665), and MESSAGE carries instant messages (RFC 3428).

Responses are grouped by their first digit: 1xx provisional, 2xx success, 3xx redirection, 4xx request failure, 5xx server failure and 6xx global failure. A response is always interpreted together with the method in its CSeq header. A 200 OK for BYE means the hang-up was accepted; it does not mean that a call was answered.

CodeMeaningTypical situationWhat to inspect next
100TryingThe next hop has received the request and is processing itWhether a provisional or final response follows
180RingingThe destination is alerting the userWhether SDP is present and who generates ringback
183Session ProgressProgress information, often with early mediaThe SDP body, 100rel and the actual RTP
200OKThe request named in CSeq succeededThe CSeq method and the next expected message
302Moved TemporarilyRedirection to other contactsContact values and routing policy
401UnauthorizedChallenge from a registrar or UASWWW-Authenticate and the retried request
403ForbiddenThe server refuses the requestPermissions, identity and policy logs
404Not FoundThe user or number does not exist in that domainRequest-URI, number format and the rejecting hop
407Proxy Authentication RequiredChallenge from a proxyProxy-Authenticate and Proxy-Authorization
408Request TimeoutNo final response was obtained in timeWhich element generated it and what it could reach
480Temporarily UnavailableThe callee is currently unreachable or not registeredRegistration state, reachability and user settings
481Call/Transaction Does Not ExistNo matching dialog or transaction was foundCall-ID, tags, branch and failover routing
486Busy HereThis destination is busyOther forked branches and endpoint state
487Request TerminatedA pending request was ended, usually by CANCELThe CANCEL or other cause that preceded it
488Not Acceptable HereThe offered session is not acceptable at this destinationThe full SDP offer, codecs and SRTP requirements
491Request PendingOverlapping offer/answer operations in one dialogTiming of simultaneous re-INVITE or UPDATE requests
503Service UnavailableThe server is temporarily unable to handle the requestRetry-After, capacity and alternative routes
603DeclineThe callee declines the call at every locationThe element that sent it and any Reason header

Transactions, Dialogs and Sessions

Engineers use five related terms. A message is a single request or response. A transaction is one request plus all responses to it, including retransmissions; client and server identify it by the branch parameter of the top Via header, which in RFC 3261 always begins with the magic cookie z9hG4bK, together with the method. A dialog is a peer-to-peer relationship between two user agents that persists for some time, is created by INVITE or SUBSCRIBE, and is identified by the Call-ID, the local tag and the remote tag.

A session is the media exchange described by SDP. A call leg is informal language for one dialog when a B2BUA or SBC splits an end-to-end call into several dialogs.

When a UAS sends a provisional response other than 100 Trying with a To tag, an early dialog exists; a 2xx final response confirms the dialog. Later requests in that dialog, such as re-INVITE, UPDATE or BYE, reuse the Call-ID and tags, but each is a new transaction with a new branch and, from the sending side, a higher CSeq number. Each side keeps its own CSeq space, so the number in a BYE sent by the callee need not continue the numbering used by the caller.

Forking adds a subtlety. When a proxy forks an INVITE to several phones, every phone that responds with its own To tag creates a separate early dialog sharing the same Call-ID. A proxy may cancel still-pending branches after the first 2xx, but several branches can return 2xx before cancellation takes effect, creating multiple confirmed dialogs. The UAC must ACK each 2xx and send BYE within any unwanted dialog.

Transaction, dialog and session boundaries with identifiers used to follow a call.
Figure 04: Transactions, dialogs and the media session are separate layers, each followed with its own identifiers.

ACK Rules: Non-2xx versus 2xx Final Responses

ACK behaves differently depending on the final response. For a non-2xx final response to INVITE, such as 407, 486 or 487, the ACK belongs to the INVITE transaction: it is sent hop by hop, uses the same branch as the INVITE, and is generated by the transaction layer.

For a 2xx response, the ACK is generated by the UAC core, travels end to end along the dialog route to the Contact of the UAS, and carries a new branch value, so it is not part of the INVITE transaction. Its CSeq number equals that of the INVITE, with the method ACK. If this ACK never arrives, the UAS keeps retransmitting the 200 OK and eventually ends the call, which is the mechanism behind the 32-second drop described in the troubleshooting section.

Registration (REGISTER) and Digest Authentication

REGISTER creates, refreshes or removes contact bindings for an address of record. The requested lifetime is given either in an expires parameter on the Contact or in an Expires header, and the registrar returns the lifetime it actually granted in the 200 OK, which may be shorter than requested. The client must refresh before the granted lifetime ends, and a REGISTER with an expiry of zero removes the binding.

Registration and authentication are separate concerns. Registration answers where a user can currently be reached; authentication answers whether the sender can prove its identity. A binding that expires stops new incoming calls from being routed to that contact, but it does not tear down dialogs that are already established.

Challenging the first request is normal. A registrar that requires credentials answers the first REGISTER with 401 Unauthorized and a WWW-Authenticate header, and the client then sends a new REGISTER containing an Authorization header.

The REGISTER Challenge Sequence

In the example, UA 1001 at 192.0.2.10 sends REGISTER for sip:1001@example.com with CSeq 1 and branch z9hG4bK-reg-1, asking for a 3600-second binding. The registrar replies 401 with CSeq 1 REGISTER and a challenge. The UA then sends a second REGISTER with the same Call-ID and From tag, CSeq 2, a new branch z9hG4bK-reg-2 and an Authorization header. The registrar replies 200 OK with CSeq 2 REGISTER and lists the current contact with its granted expiry.

Because REGISTER is not INVITE, no ACK follows the 401 or the 200. The authenticated retry is an entirely new transaction, which is why both the CSeq number and the branch change.

The REGISTER retry uses a new CSeq and Via branch; this registration sequence contains no ACK.
Figure 05: The REGISTER retry carries a new CSeq and Via branch, and no ACK appears anywhere in the sequence.

Digest Challenges: 401 versus 407, Realm, Nonce and Algorithms

SIP reuses HTTP Digest authentication (RFC 3261 section 22). A registrar or UAS challenges with 401 Unauthorized and WWW-Authenticate, and the client answers with Authorization. A proxy, including an outbound proxy or an SBC acting in a proxy role, challenges with 407 Proxy Authentication Required and Proxy-Authenticate, and the client answers with Proxy-Authorization. Mixing up the two header pairs is a common interoperability fault.

The challenge contains a realm that identifies the protection space and a nonce generated by the server. The client computes a hash over the username, realm, password, nonce, method and request URI, plus the cnonce and nonce count when qop is used. RFC 3261 specified MD5; RFC 8760 adds the SHA-256 and SHA-512/256 algorithms for SIP Digest.

Digest proves knowledge of a shared secret without sending the password in clear text, but it does not encrypt the message and, in the usual auth mode, does not protect headers or body from modification. Confidentiality of SIP signalling requires TLS.

Annotated Example: One Call Traced Message by Message

This walk-through uses documentation addresses so that every value can be followed. UA 1001 is at 192.0.2.10 and UA 1002 is at 198.51.100.20, both in the domain example.com. To keep it short, the messages go directly between the two user agents; with a record-routing proxy in the path, each request would carry one extra Via entry per hop and Route headers learned from Record-Route.

The call uses Call-ID call-a-1001-1002@example.com. UA 1001 puts tag a1001 in From, UA 1002 adds tag b1002 to To in its responses, and those three values identify the dialog. The INVITE transaction uses branch z9hG4bK-call-a-invite and CSeq 1 INVITE. The ACK for the 200 OK uses a new branch, z9hG4bK-call-a-ack, but keeps CSeq number 1 with the method ACK. The BYE is a new transaction with branch z9hG4bK-call-a-bye and CSeq 2 BYE.

The SDP offer in the INVITE advertises media at 192.0.2.10 port 40000 with payload types 0, 8, 111 and 101. The SDP answer in the 200 OK advertises media at 198.51.100.20 port 41000 and keeps payload types 8 and 101. After the ACK, RTP flows between 192.0.2.10:40000 and 198.51.100.20:41000.

StepMessageKey header valuesBody
1INVITE sip:1002@198.51.100.20:5060Via branch z9hG4bK-call-a-invite, From tag a1001, To without tag, CSeq 1 INVITE, Contact sip:1001@192.0.2.10:5060, Max-Forwards 70SDP offer: c=IN IP4 192.0.2.10 and m=audio 40000 RTP/AVP 0 8 111 101
2180 RingingSame branch, Call-ID and CSeq 1 INVITE, with To tag b1002 addedNone
3200 OKSame branch, To tag b1002, CSeq 1 INVITE, Contact sip:1002@198.51.100.20:5060SDP answer: c=IN IP4 198.51.100.20 and m=audio 41000 RTP/AVP 8 101
4ACK sip:1002@198.51.100.20:5060New branch z9hG4bK-call-a-ack, From tag a1001, To tag b1002, CSeq 1 ACKNone
5BYE sip:1002@198.51.100.20:5060New branch z9hG4bK-call-a-bye, same Call-ID and tags, CSeq 2 BYENone
6200 OK to BYEBranch z9hG4bK-call-a-bye, CSeq 2 BYENone

SDP Offer/Answer and Codec Negotiation (RFC 3264, RFC 8866)

SDP is defined in RFC 8866, which obsoletes RFC 4566. SIP uses it with the offer/answer model of RFC 3264: one side sends an offer describing the media it wants to exchange, and the other returns an answer that accepts, adjusts within the permitted rules, or rejects each media stream.

The offer in the example contains v=0; an o= line with the originator, session ID, version and address 192.0.2.10; a session name; c=IN IP4 192.0.2.10; t=0 0; m=audio 40000 RTP/AVP 0 8 111 101; a=rtcp:40001; rtpmap lines mapping 0 to PCMU/8000, 8 to PCMA/8000, 111 to opus/48000/2 and 101 to telephone-event/8000; an fmtp line for 101 with events 0-15; a=ptime:20; and a=sendrecv. The answer uses c=IN IP4 198.51.100.20 and m=audio 41000 RTP/AVP 8 101, selecting PCMA and telephone-event.

Payload types 0 (PCMU, G.711 mu-law) and 8 (PCMA, G.711 A-law) are static assignments from the RTP audio and video profile (RFC 3551). Opus and telephone-event use dynamic payload types in the range 96 to 127 and must be mapped with a=rtpmap in every description. Opus is always described with a 48000 Hz clock and 2 channels in rtpmap, even for mono speech (RFC 7587).

The offer lists formats in order of preference. The answer must contain the same number of m= lines in the same order. For an accepted unicast stream, it must include at least one format from the offer and may also list extra formats not offered; those extras cannot be used to send media until a later offer supports them. It rejects a stream by setting its port to zero. If no acceptable format remains, the UAS typically rejects the INVITE with 488 Not Acceptable Here, or with 606 when the refusal applies everywhere.

The offer includes payloads 0, 8, 111 and 101; this answer retains 8 and 101.
Figure 06: The offer lists payloads 0, 8, 111 and 101; the answer keeps 8 (PCMA) and 101 (telephone-event).
SDP lineMeaning
v=0SDP version, which is always 0
o=Originator, session ID, session version and originator address; the version must increase whenever the description changes
s=Session name
c=Connection address at which the author of the SDP expects to receive media
t=0 0The session has no bounded start or stop time
m=audio 40000 RTP/AVP ...Media type, receive port, transport profile and list of payload formats
a=rtcp:RTCP port, and optionally address, when RTCP does not use the default port (RFC 3605)
a=rtpmap:Maps a payload type to an encoding name, clock rate and channel count
a=fmtp:Format-specific parameters, such as the event range for telephone-event
a=ptime:20Preferred packet duration in milliseconds for media the author receives; a hint, not a mandate
a=sendrecvMedia direction from the point of view of the SDP author: sendrecv, sendonly, recvonly or inactive

Early Offer versus Delayed Offer

With an early offer, the INVITE carries the SDP offer and the answer comes back in a reliable provisional response or in the 200 OK. This is the most common pattern on SIP trunks because the media parameters are known before the call is answered.

With a delayed offer, the INVITE carries no SDP offer. If the UAS places its offer in the 200 OK, the UAC returns the answer in the ACK. If the offer arrives in a reliable provisional response, the UAC must answer in the PRACK instead. Some gateways and SBCs convert between the two patterns, so the pattern seen on one call leg is not necessarily the pattern used on the other.

Basic Call Flow: Successful Setup and Teardown

A successful call between UA 1001 and UA 1002 proceeds in four stages. First, UA 1001 sends INVITE with an SDP offer and CSeq 1. A 100 Trying may come back to stop INVITE retransmissions over UDP; it is hop by hop and is usually generated by the next proxy or by the UAS. UA 1002 alerts its user and sends 180 Ringing.

Second, when the user answers, UA 1002 sends 200 OK with the SDP answer, and UA 1001 confirms it with ACK. The dialog is now confirmed.

Third, RTP flows in both directions between the addresses and ports taken from SDP: 192.0.2.10 port 40000 and 198.51.100.20 port 41000 in the example. Depending on the design, a PBX or SBC may anchor this media instead of letting it flow directly.

Fourth, either side ends the call by sending BYE within the dialog, here UA 1001 with CSeq 2, and the other side answers 200 OK. The sequence INVITE, 180, 200, ACK, media, BYE, 200 is the baseline against which every other flow is compared.

Ringback in this flow is generated locally by the calling phone when it receives a 180 without SDP. Carrier tones and announcements heard before answer use early media, described in a later section.

A successful-call example from INVITE and ACK to BYE, with the corresponding responses.
Figure 07: A successful call from INVITE and ACK through BYE, with each response matched to its request.

Failure and Cancellation Flows: Proxy Challenge, CANCEL and 486 Busy Here

Real deployments see these variants every day, and each still follows the transaction rules: every final response to INVITE is acknowledged, and a new request is always a new transaction.

INVITE Challenged by a Proxy (407)

When UA 1001 places an outbound call through a PBX or SBC acting as an authenticating proxy, the first INVITE, CSeq 1, receives 407 Proxy Authentication Required with a Proxy-Authenticate header. Because 407 is a non-2xx final response to INVITE, UA 1001 sends ACK with CSeq 1 ACK on the same branch, which completes that transaction.

UA 1001 then sends a new INVITE with the same Call-ID and From tag, CSeq 2, a new branch and a Proxy-Authorization header. The call continues normally: 180, 200 OK with CSeq 2 INVITE, ACK with CSeq 2, media, and later BYE with CSeq 3. If the challenge had come from the far-end UAS instead, it would have been 401 with WWW-Authenticate, answered with Authorization, but the sequence of transactions would be the same.

Cancelling Before Answer with CANCEL

If the caller hangs up while the far end is still ringing, UA 1001 sends CANCEL. The CANCEL copies the Request-URI, Call-ID, From, To and the CSeq number of the INVITE, with the method CANCEL, and uses the same top Via branch, so each hop can match it to the pending INVITE. A UAC must not send CANCEL before it has received a provisional response.

The server answers the CANCEL itself with 200 OK, then ends the INVITE with 487 Request Terminated, and UA 1001 acknowledges the 487 with ACK CSeq 1. This sequence has two final responses: 200 OK for CANCEL and 487 for INVITE. Always check the CSeq method: a 200 for CANCEL is not an answer to the call.

Cancellation before answer versus hangup after answer, separating CANCEL and INVITE responses.
Figure 08: CANCEL ends a call that has not been answered; BYE ends a call after the 200 OK and ACK.

When CANCEL and 200 OK Cross

A race occurs when the callee answers at the moment the caller cancels. If the 200 OK for the INVITE was sent before the CANCEL arrived, the CANCEL has no effect on the answered call. UA 1001 must still acknowledge the 200 OK with ACK and then send BYE to end the dialog. The CANCEL receives its own response, typically 200 OK, or 481 if the server no longer holds a matching transaction.

Busy Destination: 486 Busy Here

If the called user is busy, the UAS returns 486 Busy Here. UA 1001 acknowledges it with ACK CSeq 1 and plays a busy indication locally. A 486 applies to that destination only, so a forking proxy may still try other contacts, whereas 600 Busy Everywhere tells the caller that no other destination will succeed.

Early Media, 183 Session Progress and PRACK (RFC 3262)

Callers often hear network audio before anyone answers: carrier ringback, an announcement that the number cannot be reached, or an IVR prompt. This is early media, and it is usually signalled with 183 Session Progress carrying SDP, which lets RTP start before the 200 OK.

A 180 Ringing often causes the calling phone to generate local ringback according to its policy. SDP in a provisional response can establish an early-media session, but it does not guarantee that RTP will arrive or command the phone to stop local ringback. Under RFC 3960 the caller should consider actual media arrival and local policy, for example playing far-end audio and stopping local ringback when media arrives. A wrong choice can produce silent or doubled ringback on trunks.

Provisional responses are normally unreliable: over UDP they are not retransmitted, so a lost 183 can mean lost early SDP. RFC 3262 adds reliability. The UAC indicates support with Supported: 100rel in the INVITE. The UAS may then send 183 with Require: 100rel and an RSeq value, for example RSeq 71, retransmitting it until it is acknowledged. The UAC acknowledges it with PRACK, a new request in the early dialog with its own CSeq, CSeq 2 PRACK in the example, carrying RAck: 71 1 INVITE, which means RSeq 71 of CSeq 1 INVITE. The UAS returns 200 OK to the PRACK.

When the call is answered, the 200 OK for CSeq 1 INVITE completes the INVITE transaction and is acknowledged with ACK CSeq 1. If the SDP answer was already delivered in the reliable 183, the offer/answer exchange for the INVITE is complete; any SDP repeated in the 200 OK must be identical, not a new answer. The later BYE uses CSeq 3.

A reliable 183 example using 100rel, RSeq 71 and PRACK with RAck 71 1 INVITE.
Figure 09: A reliable 183 with 100rel and RSeq 71, acknowledged by a PRACK carrying RAck 71 1 INVITE.

Mid-Dialog Operations: Hold, Transfer and Session Timers

Once a dialog exists, the parties can change it without placing a new call. Three operations matter most on enterprise systems: hold and resume, transfer, and periodic refresh. Each uses a new transaction inside the existing dialog, so the Call-ID and tags stay the same while the branch and CSeq change.

Refresh mechanismState it keeps aliveEvidence to check
Registration refreshThe binding from AoR to Contact at the registrarREGISTER interval, granted expiry and responses
Session timer (RFC 4028)Confirmation that an established session is still aliveSession-Expires, Min-SE, refresher role and re-INVITE or UPDATE
NAT or connection keepaliveA NAT mapping, firewall state or transport connectionKeepalive method, interval and whether the mapping survived

Hold and Resume with re-INVITE

Hold is an SDP change carried in a re-INVITE. To place UA 1002 on hold, UA 1001 sends a re-INVITE with CSeq 2 whose offer uses a=sendonly if it will play music on hold, or a=inactive if no media should flow, and increments the version number in the o= line. UA 1002 answers with a=recvonly or a=inactive respectively. To resume, UA 1001 sends another re-INVITE, CSeq 3, with a=sendrecv and a further o= version increment, and receives sendrecv in the answer.

Direction attributes are always written from the point of view of the side that sends the SDP. If both sides send a re-INVITE at the same time, one of them receives 491 Request Pending and retries after a random delay (RFC 3261 section 14.1).

Call Transfer with REFER (RFC 3515)

REFER asks the recipient to send a request to a third party identified in the Refer-To header, and the recipient reports progress with NOTIFY messages carrying message/sipfrag bodies. In a blind transfer, the transferor sends REFER without first speaking to the target. In an attended, or consultative, transfer, the transferor first calls the target and then sends REFER with a Refer-To URI that includes a Replaces header (RFC 3891), so the new call replaces the consultation dialog.

Many IP-PBXs are B2BUAs, so pressing transfer on a phone often produces REFER only between the phone and the PBX. Toward the SIP trunk, the PBX may instead re-INVITE the existing leg or bridge the media internally. Analyse each leg separately before concluding that transfer is broken.

Session Timers and Other Refresh Mechanisms

Session timers (RFC 4028) let user agents and proxies detect sessions that ended without a BYE. The Session-Expires header gives the interval, Min-SE gives the smallest interval an element will accept, and the refresher parameter says whether the UAC or the UAS performs the refresh. The refresher sends a re-INVITE or UPDATE before the interval expires; if no refresh succeeds, either side should send BYE before expiry. A request with too small an interval is rejected with 422 Session Interval Too Small.

Registration refresh and NAT keepalives are different mechanisms. Keepalives can use CRLF pings or STUN on the SIP flow, as defined by SIP Outbound (RFC 5626), or OPTIONS requests. The interval must be shorter than the idle timeout of every NAT and firewall on the path, and that timeout varies from device to device.

Media Plane: RTP, RTCP, SRTP and DTMF

RTP (RFC 3550) carries encoded media, usually over UDP. Every packet has a payload type that refers to the codec mapping from SDP, a sequence number that lets the receiver detect loss and reordering, a timestamp that drives playout timing and jitter calculation, and an SSRC that identifies the source.

RTCP, also defined in RFC 3550, carries sender and receiver reports with packet counts, cumulative loss, interarrival jitter and the data needed to compute round-trip time. By convention RTP uses an even port and RTCP the next higher odd port, for example 40000 and 40001. SDP can signal a different RTCP port with a=rtcp (RFC 3605), and many modern systems multiplex RTP and RTCP on a single port (RFC 5761).

SRTP (RFC 3711) provides confidentiality, message authentication and replay protection for RTP and RTCP. Its default transforms are AES in counter mode for encryption and HMAC-SHA1 for authentication; AES-GCM was added later in RFC 7714. SRTP keys come from a separate key-management method, commonly SDES crypto attributes inside SDP (RFC 4568), which are only safe when the SIP signalling itself is protected by TLS, or from DTLS-SRTP (RFC 5764), which WebRTC uses.

DTMF methodWhere the digit travelsWhat to verify
In-band audioAs audible dual tones inside the encoded voiceCodec type, compression and tone detection at the receiver
RTP telephone-event (RFC 4733)As a negotiated named-event payload within the RTP streamPayload type mapping, event range, durations and end-of-event marking
SIP INFO (RFC 6086)In the body of an INFO request within the dialogThat both ends agree on the INFO package or body format

DTMF Transport Choices

RFC 4733, which obsoletes RFC 2833, is the most interoperable choice on SIP trunks and with IVRs, because digits are sent as explicit events independent of the voice codec. In-band tones survive G.711 well but are distorted by low-bitrate codecs such as G.729, so they are unreliable whenever compression is used. SIP INFO carries digits in signalling, which works only when both ends and every B2BUA on the path support the same format.

Most DTMF faults are mismatches between legs: one leg negotiates telephone-event on payload 101, another expects payload 96 or SIP INFO, and no element converts between them. Follow a single digit across each leg to find where it disappears.

NAT, Firewalls and the SBC

NAT and stateful firewalls cause more SIP problems than any other network function. SIP and SDP carry IP addresses and ports inside the message: in Via, in Contact, and in the c= and m= lines of SDP. A NAT device rewrites only the outer IP and transport headers, so a phone behind NAT can advertise a private address that the far end cannot reach. Signalling may still work, because responses follow Via, while media fails or flows in one direction only.

Consider a remote extension 1003 with the private address 192.168.1.50 behind a NAT whose public address is 203.0.113.80. Its REGISTER arrives from 203.0.113.80 on a translated port, but its Contact and SDP still say 192.168.1.50. The registrar, PBX or SBC must decide which address to trust at each layer, and the media path must be verified with packet captures rather than inferred from SIP.

In enterprise designs, an SBC at the network border is the usual tool. It acts as a B2BUA, presents its own public addresses in SIP and SDP, anchors media where needed, and hides internal topology. It still has to be configured correctly: an SBC does not by itself guarantee correct routing, codec support or security.

Separate IP, SIP and SDP addresses in a NAT example requiring media-path verification.
Figure 10: The IP header, the SIP headers and the SDP body can each carry different addresses, so the media path must be verified.
MechanismWhat it doesLimits
Via received and rport (RFC 3581)Returns responses to the source address and port actually observedDoes not change Contact or the SDP media addresses
SIP Outbound (RFC 5626)Keeps client-initiated flows open and routes requests back through themRequires support in the client and in the edge proxy or registrar
Connection reuse (RFC 5923)Reuses an established TLS connection for requests in both directionsApplies under defined rules, not to every TCP connection
Symmetric RTP (RFC 4961)The endpoint sends and receives a stream on the same local IP and portEnables latching by the far end but does not itself define it
Media latchingAn SBC or media server sends RTP to the source it observes from the endpointDepends on the endpoint sending first and on anti-hijack policy
STUN (RFC 8489)Discovers the public mapped address and port of a clientDoes not relay media; some NAT behaviours still block the path
TURN (RFC 8656)Provides a relayed transport address on a serverNeeds a reachable relay and adds latency and cost
ICE (RFC 8445)Gathers candidates, tests address pairs and selects a working pathBoth endpoints and the signalling must support it

SIP ALG and Firewall Policy

Many routers and firewalls ship with a SIP application-layer gateway (ALG) that tries to rewrite SIP and SDP addresses in transit. Implementations vary widely, and incomplete rewriting, incorrect Content-Length values or mishandled TCP segments are common. An ALG also cannot read or rewrite SIP carried over TLS. When an SBC, a hosted PBX with its own NAT handling, or SIP Outbound already manages traversal, the usual recommendation is to disable the ALG so that two mechanisms do not rewrite the same messages.

Firewall rules should treat signalling and media separately. Allow only the SIP ports actually in use, for example UDP or TCP 5060 or TLS 5061, restricted to known peers where possible, and allow the RTP port range that the PBX, SBC or phones are configured to use. Check the real range in the device configuration rather than assuming a default, and make sure UDP idle timeouts on the firewall are longer than the refresh and keepalive intervals.

SIP Security: TLS for Signalling and SRTP for Media

Signalling and media are protected separately. SIP over TLS, usually on port 5061, encrypts and integrity-protects signalling hop by hop, between a client and a proxy or between two servers. It protects dialled numbers, identities, Digest challenges and any SRTP keys carried in SDP. The sips URI scheme requests TLS on every hop through to the target resource, including the last hop, under RFC 5630. Current guidance deprecates TLS 1.0 and 1.1 (RFC 8996) and recommends TLS 1.2 or TLS 1.3 (RFC 9325).

TLS does not protect media. Voice is encrypted only when SRTP is negotiated on each media leg, and it is protected end to end only if no B2BUA or SBC in the path decrypts and re-encrypts it. Every TLS connection and every SRTP context therefore has its own termination points, which should be documented in the design.

Because TLS is hop by hop, every proxy or SBC that terminates it can read and alter the SIP messages. Trust in a SIP network is therefore also a question of which elements are trusted, not only of encryption.

Signalling and media protection boundaries, including the example TLS and SRTP termination points.
Figure 11: TLS protects each signalling hop and SRTP protects media, with separate termination points in this example.

Caller Identity and Toll-Fraud Hardening

Within a trust domain, networks assert a verified caller identity with P-Asserted-Identity (RFC 3325), while From remains a value the originating user agent can set freely. Elements at the edge of the trust domain must remove or overwrite untrusted P-Asserted-Identity headers received from outside, and the Privacy header (RFC 3323) controls whether identity is withheld from the called party.

Toll fraud targets PBXs and trunks exposed to the internet. Practical controls include strong, unique SIP credentials; rate limiting and blocking of repeated authentication failures; restricting international and premium destinations by class of service; limiting trunk access to known IP addresses where the provider supports it; and monitoring call volumes and destinations for anomalies.

SIP Trunking, Microsoft Teams Direct Routing and Voice AI

A SIP trunk connects a PBX to a provider over IP instead of analog lines or ISDN primary rate circuits. Direct inward dialling (DID) numbers are mapped to extensions, and numbers are best normalised to E.164 before routing, for example +66 followed by the national number without its leading zero. Depending on the provider, a trunk authenticates either by registering with Digest credentials or by trusted IP address.

Microsoft Teams Direct Routing connects Teams Phone to a SIP trunk through an SBC that Microsoft has certified for that purpose. The Teams side uses SIP over TLS and SRTP, and the SBC translates between that interface and the trunk or PBX, including header, codec and media handling.

Voice AI platforms, such as automated receptionists and speech analytics, usually attach to a call through a SIP interface or a media fork. The same principles apply: separate the signalling interconnect from the media stream, confirm the codec and DTMF method, and measure latency on the media path, because it directly affects how natural the conversation feels.

SIPPER designs and supports SIP trunk, SBC and Teams Direct Routing interconnections for enterprises; the related SIP trunk guide below covers service selection in more detail.

Troubleshooting SIP Calls Layer by Layer

Start with evidence from the right places: packet captures from the phone side, the PBX, the SBC and the provider interface, correlated by Call-ID and time. On B2BUAs the Call-ID changes between legs, so also record timestamps, numbers and any correlation header the system adds.

The table maps common symptoms to likely causes and the first evidence to collect. Work through the planes in order: connectivity, transactions, dialog and routing, SDP, RTP and RTCP, and finally application behaviour.

Inspect connectivity, transactions, dialog/routes, SDP, RTP/RTCP and application behaviour.
Figure 12: Check connectivity, transactions, dialog and routes, SDP, RTP and RTCP, then application behaviour.
SymptomLikely causesEvidence to collectFirst isolation step
REGISTER fails or challenges repeatWrong credentials or realm, algorithm mismatch, stale nonce, wrong registrar or policyChallenges and retries, authentication logs and the effective destinationCompare the first challenge with the next request and its result
Outbound call is rejectedDial plan, permissions, caller identity, destination or service policyRequest-URI, the origin of the response, relevant headers and PBX or provider logsFollow the request to the element that rejects it
200 arrives and the call endsACK routing or reception, an endpoint or application decision, media policyWhich method got 200, ACK at the recipient, retransmissions and BYE or ReasonVerify the accepted dialog before investigating audio
Calls end at a similar elapsed timeSession refresh, transport or NAT timeout, ACK reliability or media timeoutTimelines, Session-Expires, retransmissions and connection stateMatch the teardown to an observed event or configured timer
No audio or one-way audioWrong media destination, filtering, NAT, codec or SRTP mismatch, or a local audio faultBoth SDPs, packets in both directions, decoder and playback stateCompare the LAN and WAN sides, or both sides of the media relay
IVR ignores digitsDTMF method or payload mismatch, timing or media losstelephone-event mappings, or INFO bodies and their responsesTrack one digit across each relevant leg
Hold, resume or transfer failsDirection mismatch, overlapping offer, target refresh, missing extension or policySDP before and after, CSeq, REFER and NOTIFY, and call-leg stateIdentify the first operation whose state diverges
Choppy audio with normal SIPLoss, jitter, congestion, capture loss or endpoint processing limitsRTP and RTCP, interface statistics and endpoint measurementsCompare the same media interval at two points

The 32-Second Call Drop: a 200 OK That Never Gets Its ACK

A classic symptom is a call that connects, carries audio, and then drops about 32 seconds after answer. This is not a configured call-duration limit. It is how RFC 3261 handles an unacknowledged 2xx response: after sending 200 OK to an INVITE, the UAS core retransmits the 200 OK, starting at T1 (500 ms by default) and doubling the interval up to T2 (4 seconds), until the ACK arrives.

If no ACK arrives within 64 times T1, which is 32 seconds with default timers, RFC 3261 says the dialog is confirmed but the UAS should terminate the session with BYE (section 13.3.1.4). Typical causes are an ACK sent to an unreachable Contact or Record-Route address, often a private address behind NAT; a firewall or ALG that drops the ACK; or a transport mismatch between the two sides. Look for repeated 200 OK retransmissions in the capture, because they are the signature of this fault.

Useful Wireshark Display Filters

Filters narrow the view but do not replace reading the whole dialog. Wireshark may need its RTP heuristic enabled, or the SDP present in the same capture, before it decodes RTP. Before sharing a capture outside the organisation, remove or mask Digest credentials, personal identities and phone numbers, and any SRTP key material carried in SDP.

  • sip shows every SIP message in the capture.
  • sip.Call-ID == "call-a-1001-1002@example.com" isolates one call on one leg.
  • sip.CSeq.method == "INVITE" shows INVITE requests and their responses.
  • sip.Status-Code >= 400 lists error responses only.
  • rtp or rtcp shows media and media reports; then use the RTP stream analysis tools to measure loss and jitter.

References and Standards

The core standards used in this article are listed below. Where an older RFC has been replaced, the current document is given first.

  • RFC 3261: SIP, the core protocol.
  • RFC 3262: Reliability of provisional responses (100rel and PRACK).
  • RFC 3263: Locating SIP servers with NAPTR, SRV and A or AAAA records.
  • RFC 3264: The offer/answer model with SDP.
  • RFC 8866: SDP, obsoleting RFC 4566.
  • RFC 3550: RTP and RTCP; RFC 3551: the audio and video profile with static payload types.
  • RFC 3711: SRTP; RFC 7714: AES-GCM for SRTP; RFC 4568 and RFC 5764: SRTP key management.
  • RFC 3581: rport; RFC 5626: SIP Outbound; RFC 5923: connection reuse; RFC 4961: symmetric RTP.
  • RFC 8445, RFC 8489 and RFC 8656: ICE, STUN and TURN.
  • RFC 3311: UPDATE; RFC 3515: REFER; RFC 3891: Replaces; RFC 4028: session timers; RFC 6086: INFO.
  • RFC 4733: DTMF telephone-event, obsoleting RFC 2833; RFC 7587: the Opus RTP payload format.
  • RFC 3325: P-Asserted-Identity; RFC 3323: Privacy; RFC 5630: SIPS; RFC 8760: SHA-2 Digest for SIP; RFC 8996 and RFC 9325: TLS version guidance.
  • RFC 7118: SIP over WebSocket; RFC 6026: corrections to INVITE transaction handling; RFC 6665: SUBSCRIBE and NOTIFY; RFC 3428: MESSAGE; RFC 3966: the tel URI; RFC 3605: the RTCP attribute; RFC 5761: RTP and RTCP multiplexing.

Frequently Asked Questions

Ready to deploy?

SIPPER designs, deploys, and maintains end-to-end enterprise phone systems. Start with a free quote.

Sipper
Sipper Network Communications Co., Ltd. (Head Office)

Tax ID: 0105560159831

99/4 New Connex House, Don Mueang, Phaholyothin Road, Sanambin, Don Mueang, Bangkok 10210
02-098-9500
Hotline Support (24 Hours.): 02-666-9494
Hotline

Quick Links

Our Services

Cloud PBXNetwork InfrastructureCyber SecurityServer SolutionsIT Consulting

Follow Us

Contact Us

02-098-9500
02-666-9494
sales@sipper.co.th