SIP / IMS

SIP — Complete Signalling and IMS Guide

A practical theory and troubleshooting guide covering SIP messages, dialogs, transactions, SDP, RTP, IMS, authentication, NAT and call flows.

1. SIP theory

Session Initiation Protocol (SIP) is an application-layer signalling protocol used to create, modify and terminate multimedia sessions over IP. It is standardized by the IETF and was defined in RFC 3261 as the core modern SIP specification.

SIP does not carry the voice/video media itself. It establishes and controls the session; protocols such as SDP describe media parameters and RTP/RTCP carry and monitor media.

2. SIP network architecture

Typical components are User Agents, proxy servers, registrars, redirect servers, location services and gateways. A UA contains UAC behavior (initiating requests) and UAS behavior (responding to requests).

  • Registrar: accepts REGISTER and stores AOR-to-Contact bindings.
  • Proxy: forwards SIP requests/responses and can be stateless or stateful.
  • Redirect server: returns alternate destinations rather than staying in the signalling path.
  • B2BUA: terminates one SIP dialog and creates another; common in service/application gateways.
  • Gateway: interworks SIP with PSTN/ISDN, H.323 or other systems.

3. SIP message structure

A SIP message contains a start line, headers, an empty line and an optional body. Requests have a method and Request-URI; responses contain a status code and reason phrase.

Important headers include Via, Max-Forwards, To, From, Call-ID, CSeq, Contact, Route, Record-Route, Supported, Allow, Authorization and content headers.

4. SIP methods

  • INVITE: starts or changes a session.
  • ACK: confirms the final response to INVITE.
  • BYE: terminates an established dialog.
  • CANCEL: cancels a pending transaction.
  • REGISTER: binds an Address-of-Record to a current Contact.
  • OPTIONS: queries capabilities.
  • REFER: requests call transfer.
  • SUBSCRIBE/NOTIFY: event subscription and notification.
  • MESSAGE: instant messaging.
  • PRACK: reliable provisional responses.
  • UPDATE: session parameter updates before final response.
  • INFO: mid-session application signalling such as DTMF in relevant deployments.

5. Response codes

SIP responses are grouped by class: 1xx informational, 2xx success, 3xx redirection, 4xx client/request error, 5xx server error and 6xx global failure.

Common troubleshooting codes: 100 Trying, 180 Ringing, 183 Session Progress, 200 OK, 401/407 authentication challenge, 403 Forbidden, 404 Not Found, 408 Request Timeout, 480 Temporarily Unavailable, 486 Busy Here, 487 Request Terminated, 500 Server Error, 502 Bad Gateway and 503 Service Unavailable.

6. Transactions vs dialogs

A transaction is a single request plus its responses and is identified using the Via branch and CSeq/method context. A dialog is a longer-lived relationship between endpoints, identified by Call-ID plus local and remote tags.

This distinction is critical in trace analysis: a re-INVITE creates a new transaction inside an existing dialog, while the initial INVITE establishes the dialog.

7. Header fields that matter in traces

  • Via: hop-by-hop path and transaction branch.
  • Max-Forwards: loop protection.
  • From/To: logical direction and dialog tags.
  • Call-ID: session/dialog identity.
  • CSeq: ordering of requests within a dialog.
  • Contact: reachable UA URI.
  • Record-Route/Route: keeps required proxies in the dialog signalling path.
  • Authorization: authentication credentials/response.
  • Content-Type/Length: identify and size the message body.
  • P-Asserted-Identity / P-Preferred-Identity: important 3GPP/IMS identity mechanisms.

8. SDP theory

Session Description Protocol (SDP) describes the media session. It is not the media transport itself. Important fields include v= version, o= origin, s= session name, c= connection address, t= timing, m= media/port/protocol/formats and a= attributes.

Codec negotiation depends on matching compatible payload types, codecs, clock rates, channels and attributes. A SIP call can signal successfully while media fails because the SDP addresses, ports or codec parameters are wrong.

9. RTP and RTCP

RTP carries real-time media such as voice. RTCP provides control/quality information. SIP negotiates the media parameters; RTP then carries packets according to the negotiated SDP.

When troubleshooting voice, separate signalling path (SIP) from media path (RTP). A clean SIP 200 OK does not prove that two-way audio works.

10. Complete basic call flow

Caller                     Proxy / IMS                 Callee
  |                            |                         |
  |---- INVITE + SDP --------->|------------------------>|
  |<--- 100 Trying ------------|                         |
  |<---------------- 180 Ringing -----------------------|
  |<---------------- 200 OK + SDP ----------------------|
  |---------------- ACK -------------------------------->|
  |============= RTP media =============================|
  |---------------- BYE -------------------------------->|
  |<--------------- 200 OK ------------------------------|

Real IMS flows add authentication, routing, Record-Route/Route, policy, service logic and sometimes provisional responses such as 183 with early media.

11. REGISTER and authentication

REGISTER creates or refreshes the binding between an Address-of-Record and the device's current Contact. SIP commonly uses HTTP Digest-style challenge/response authentication, producing 401 or 407 challenges depending on where authentication is applied.

In a trace, verify the first REGISTER, challenge, authenticated REGISTER, final success, expiry and Contact/Path information.

12. SIP in 3GPP IMS

3GPP uses SIP as the call-control protocol for IMS. IMS adds telecom-specific functions, identities, routing and service logic around SIP. Important P-headers and mechanisms include P-Asserted-Identity, P-Preferred-Identity, Service-Route and Path.

In LTE/5G voice, the radio and packet core establish IP connectivity and QoS while IMS/SIP handles the multimedia service signalling. VoLTE and VoNR therefore require both telecom access/core correctness and SIP/IMS correctness.

13. SIP transport and security

SIP can run over UDP, TCP and TLS, with SCTP used in some telecom environments. SIPS indicates SIP over TLS for protected signalling. SIP security can include transport encryption, authentication, integrity and protection of selected message bodies.

Do not assume that encrypted SIP means encrypted RTP; media security is a separate concern, commonly handled using mechanisms such as SRTP in appropriate deployments.

14. NAT traversal

SIP and SDP can contain IP addresses and ports that become invalid across NAT. STUN helps discover mapped addresses; TURN provides relay when direct connectivity fails; ICE coordinates candidate gathering and connectivity checks.

Typical symptom: SIP call establishes but one-way/no-way audio. Check SDP addresses, candidate selection, firewall rules, RTP port ranges and whether the media path is symmetric.

15. Stateless/stateful proxies and forking

A stateless proxy forwards without retaining transaction state. A stateful proxy maintains transaction information, enabling retransmission handling and features such as forking.

Forking sends an INVITE toward multiple possible contacts. When one branch answers, the proxy manages the other branches, commonly cancelling losing branches. This is a frequent source of confusing parallel SIP traces.

16. B2BUA

A B2BUA terminates one SIP side and creates a new SIP side. It is useful for application services, topology hiding, interworking and policy control, but it breaks pure end-to-end SIP semantics and can add state, latency and a failure point.

17. SIP and H.323 / PSTN interworking

SIP is text-based and Internet-oriented, while H.323 is a broader ITU multimedia framework with binary ASN.1/PER encoding and telephony-derived procedures. Gateways can translate signalling and media between systems.

PSTN interworking may involve SIP with ISUP/SS7-related gateway functions. When debugging such calls, identify the signalling boundary where the failure first appears.

18. SIP troubleshooting workflow

  1. Find the first failed transaction, not just the final error.
  2. Check DNS and routing to the next SIP hop.
  3. Verify Via, Contact, Route/Record-Route and Max-Forwards.
  4. Track Call-ID, tags and CSeq across the entire dialog.
  5. Check authentication challenges and credentials.
  6. Compare SDP offer/answer: IP, ports, codec, payload type and direction attributes.
  7. Separate SIP success from RTP success.
  8. For IMS, correlate SIP with registration, bearer/QoS and access-network events.
  9. For NAT issues, inspect ICE/STUN/TURN behavior and firewall rules.

19. Interview and trace quick reference

  • Dialog = Call-ID + local tag + remote tag.
  • Transaction = Via branch + CSeq/method context.
  • REGISTER = location binding.
  • INVITE = session setup/change.
  • ACK = final response confirmation for INVITE.
  • BYE = established-session termination.
  • CANCEL = pending transaction cancellation.
  • SDP = media description.
  • RTP = media.
  • RTCP = media control/quality feedback.
  • Proxy forwards; redirect server points elsewhere; registrar stores bindings; B2BUA terminates and re-originates.

20. References

Primary references include IETF RFC 3261 for SIP and 3GPP TS 23.228 for IMS plus 3GPP TS 24.229 for SIP/SDP call-control procedures in IMS. The supplied SIP study was used as the detailed learning basis for the terminology, flows and troubleshooting structure.