Diameter in IMS: Cx, Sh and Rx Call Flows with Messages and AVPs
Cx (UAR, MAR, SAR, LIR, RTR, PPR), Sh (UDR, PUR, SNR, PNR and T-ADS) and Rx (AAR, RAR, STR, ASR) explained with call flow diagrams, key AVPs and common error codes.
Browse all articles
In an IMS core, Diameter carries every conversation with the HSS and the PCRF. Three interfaces do most of the work: Cx between the CSCFs and the HSS, Sh between application servers and the HSS, and Rx between the P-CSCF and the PCRF. This is part 3 of the Solex Network Solutions Diameter series: each interface, its messages, the AVPs that matter, and the call flows you will see in a VoLTE network.
Cx: CSCF to HSS
Cx (TS 29.228 procedures, TS 29.229 protocol; Application-ID 16777216) is how the I-CSCF and S-CSCF talk to the HSS. Dx is the same protocol towards the SLF when there are several HSSs.
Command Code Direction Used for
User-Authorization (UAR/UAA) 300 I-CSCF -> HSS registration status, S-CSCF selection
Server-Assignment (SAR/SAA) 301 S-CSCF -> HSS assign S-CSCF, download profile, deregister
Location-Info (LIR/LIA) 302 I-CSCF -> HSS which S-CSCF serves a called user
Multimedia-Auth (MAR/MAA) 303 S-CSCF -> HSS authentication vectors
Registration-Termination (RTR) 304 HSS -> S-CSCF network-initiated deregistration
Push-Profile (PPR/PPA) 305 HSS -> S-CSCF updated user profile
Cx during registration
- UAR / UAA. The I-CSCF sends UAR with Public-Identity (IMPU), User-Name (IMPI) and Visited-Network-Identifier. For an initial registration the HSS answers with Experimental-Result 2001 DIAMETER_FIRST_REGISTRATION and Server-Capabilities, which the I-CSCF uses to choose an S-CSCF.
- MAR / MAA. The S-CSCF asks for an authentication vector. SIP-Auth-Data-Item carries the scheme (Digest-AKAv1-MD5 for IMS AKA) and SIP-Number-Auth-Items how many vectors. The MAA returns RAND and AUTN (SIP-Authenticate), XRES (SIP-Authorization), and the CK and IK keys.
- 401 and the second REGISTER. The challenge goes to the UE, which answers with RES. On the second REGISTER the UAA returns 2002 DIAMETER_SUBSEQUENT_REGISTRATION with Server-Name, so the request reaches the same S-CSCF.
- SAR / SAA. After checking RES = XRES, the S-CSCF sends SAR with Server-Assignment-Type REGISTRATION (1). The SAA carries User-Data: the service profile XML with the initial filter criteria (iFC) that decide which application servers are involved.
Important Server-Assignment-Type values:
0 NO_ASSIGNMENT 1 REGISTRATION
2 RE_REGISTRATION 3 UNREGISTERED_USER (terminating call to unregistered user)
4 TIMEOUT_DEREGISTRATION 5 USER_DEREGISTRATION
8 ADMINISTRATIVE_DEREGISTRATION 9 AUTHENTICATION_FAILURE
10 AUTHENTICATION_TIMEOUT
Cx for terminating calls, deregistration and profile changes
- LIR / LIA - for a terminating call, the I-CSCF asks which S-CSCF serves the called IMPU. If the user is unregistered but has unregistered services, the HSS returns Server-Capabilities and the S-CSCF later downloads the profile with SAR type UNREGISTERED_USER.
- SAR with USER_DEREGISTRATION - when the UE deregisters (REGISTER with Expires: 0).
- RTR / RTA - the HSS forces deregistration, for example when a subscription is cancelled. The S-CSCF deregisters the user and notifies the UE.
- PPR / PPA - the HSS pushes a changed profile (new iFC, new service) without waiting for re-registration.
Common Cx failures: 5001 USER_UNKNOWN (IMPU or IMPI not provisioned, SIP 404 to the UE), 5002 IDENTITIES_DONT_MATCH (IMPI not linked to the IMPU, SIP 403), 5006 AUTH_SCHEME_NOT_SUPPORTED (the UE or S-CSCF asks for a scheme the HSS does not have), and 3002 UNABLE_TO_DELIVER when the DRA or SLF cannot place the subscriber on an HSS.
Sh: application server to HSS
Sh (TS 29.328 / 29.329; Application-ID 16777217) lets an application server such as the TAS read and write user data in the HSS, and be notified when it changes.
Command Code Direction Used for
User-Data (UDR/UDA) 306 AS -> HSS read data
Profile-Update (PUR/PUA) 307 AS -> HSS write repository (transparent) data
Subscribe-Notifications (SNR) 308 AS -> HSS subscribe / unsubscribe to changes
Push-Notification (PNR/PNA) 309 HSS -> AS data changed
The data requested is selected by Data-Reference. The common values:
0 RepositoryData service settings stored by the AS (transparent data)
10 IMSPublicIdentity 11 IMSUserState 12 S-CSCFName
13 InitialFilterCriteria 14 LocationInformation 15 UserState
16 ChargingInformation 17 MSISDN
T-ADS Information, STN-SR, UE-SRVCC-Capability (used for VoLTE / SRVCC)
The typical TAS flows:
- After registration the S-CSCF sends a third-party REGISTER to the TAS (triggered by iFC). The TAS reads the subscriber's service data with UDR (RepositoryData and MSISDN) and subscribes to changes with SNR.
- When a setting changes (call forwarding, barring) the TAS writes it with PUR. Repository data carries a sequence number; a PUR with a stale number fails with 5105 TRANSPARENT_DATA_OUT_OF_SYNC, so the TAS must read before it writes.
- When data changes in the HSS, every subscribed AS receives a PNR.
- T-ADS (Terminating Access Domain Selection) - for an incoming call, the TAS asks the HSS whether the user can be reached over VoLTE. The HSS asks the MME with an S6a IDR, the IDA reports IMS voice over PS support, RAT type and last activity, and the TAS decides to deliver the call over VoLTE or route it to the CS domain.
Common Sh failures: 5100 USER_DATA_NOT_RECOGNIZED (Data-Reference not supported), 5101 OPERATION_NOT_ALLOWED and 5102 USER_DATA_CANNOT_BE_READ (the AS is not permitted to access that data - check the HSS AS permission list), and 5105 on PUR.
Rx: P-CSCF to PCRF
Rx (TS 29.214; Application-ID 16777236) is how the P-CSCF, acting as the AF (Application Function), asks the PCRF for QoS for a session. The PCRF then uses Gx to tell the PGW to create the bearer.
Command Code Direction Used for
AA (AAR/AAA) 265 P-CSCF -> PCRF create / modify an AF session
Re-Auth (RAR/RAA) 258 PCRF -> P-CSCF notify events (bearer loss, success)
Session-Termination (STR) 275 P-CSCF -> PCRF end the AF session
Abort-Session (ASR/ASA) 274 PCRF -> P-CSCF PCRF ends the AF session
Key AVPs in an AAR:
- Framed-IP-Address / Framed-IPv6-Prefix - the UE address; the PCRF uses it to find the matching Gx session. No match gives 5065 IP-CAN_SESSION_NOT_AVAILABLE.
- Media-Component-Description (grouped) - one per media line: Media-Component-Number, Media-Type (AUDIO, VIDEO), Max-Requested-Bandwidth-UL/DL, Codec-Data, Flow-Status, and Media-Sub-Component with Flow-Description (the IP filter for RTP and RTCP).
- AF-Application-Identifier, Specific-Action (events the P-CSCF wants to be told about), Subscription-Id, Service-URN for emergency calls.
At registration the P-CSCF sends an AAR without media, only to subscribe to signalling-path events (INDICATION_OF_LOSS_OF_BEARER, INDICATION_OF_RELEASE_OF_BEARER), so it learns if the IMS signalling bearer is lost.
During a VoLTE call:
- When the SDP answer arrives (183 Session Progress), the P-CSCF sends AAR with the media description.
- The PCRF authorises it (AAA 2001) and sends Gx RAR to the PGW with Charging-Rule-Install: QCI 1, ARP, guaranteed bit rate and the flow filters.
- The PGW creates the dedicated bearer (GTP Create Bearer Request towards the MME and UE) and reports success with a Gx CCR-U (event SUCCESSFUL_RESOURCE_ALLOCATION).
- The PCRF tells the P-CSCF with an Rx RAR (INDICATION_OF_SUCCESSFUL_RESOURCES_ALLOCATION), so preconditions can be met.
- At call release the P-CSCF sends STR (Termination-Cause DIAMETER_LOGOUT); the PCRF removes the rule on Gx and the dedicated bearer is deleted.
- If the bearer is lost (radio failure, handover problem), the PCRF informs the P-CSCF with RAR or ASR, and the P-CSCF releases the call.
Common Rx failures: 5065 IP-CAN_SESSION_NOT_AVAILABLE (the PCRF cannot bind the Rx session to a Gx session - wrong UE IP, different PCRF for Gx and Rx, or the Gx session was lost), 5063 REQUESTED_SERVICE_NOT_AUTHORIZED (policy refuses the media), 5061 INVALID_SERVICE_INFORMATION (a malformed Media-Component-Description), and 3002 UNABLE_TO_DELIVER when the DRA cannot bind the Rx session to the PCRF that holds the Gx session.
Session binding across Rx and Gx
In a network with several PCRFs, the Rx session for a call must reach the same PCRF that holds the subscriber's Gx session. The DRA does this with session binding: it records which PCRF answered the Gx CCR-I (keyed on UE IP, IMSI or Session-Id) and routes the Rx AAR for that UE IP to the same PCRF. In 5G the same job is done by the BSF (Binding Support Function). A missing or stale binding is the most common cause of 5065 and of 3002 on Rx.
Learn it on a live network
At Solex Network Solutions the IMS, VoLTE and VoNR course walks through every Cx, Sh and Rx message on our own IMS core, with real traces. Start with part 1 of this series if you are new to Diameter.
Learn this hands-on
IMS, VoLTE and VoNR
The IMS core from registration to release: P-CSCF, I-CSCF, S-CSCF, TAS and the SIP and Diameter that binds them, plus VoLTE and VoNR end to end.



Discussion
No comments yet. Start the discussion - questions are welcome.
Leave a comment