Skip to main content

Sh Interface (Subscriber Data Retrieval)

๐Ÿ“– Back to Main Documentation

The Sh interface provides access to subscriber profile data from the HSS/Repository via Diameter.

Core Documentationโ€‹

Call Processing Integrationโ€‹

Monitoringโ€‹


Sh Interface (Subscriber Data Retrieval)โ€‹

The Sh interface is used to retrieve subscriber profile data from the HSS/Repository before processing calls. This data includes subscriber identities, services, and MMTel configuration.

What is the Sh Interface?โ€‹

The Sh interface is a 3GPP-standardized Diameter interface between the TAS and HSS/Repository (Repo). It provides real-time access to:

  • IMS subscriber identities (IMPI/IMPU)
  • Call forwarding settings (MMTel-Config)
  • Subscriber service authorization
  • S-CSCF assignment

When Sh Lookups Occurโ€‹

Sh Lookups Happen On:

  • MT Calls: Lookup called party (destination subscriber)
  • MO Calls: Lookup calling party (source subscriber)
  • Emergency Calls: Lookup calling party (for location/identity)

In every case the TAS issues exactly one UDR per call leg. Both MO and MT use the same multi-Data-Reference UDR shape โ€” only the metric labels differ.

Multi-Data-Reference UDR (Notif-Eff)โ€‹

Per 3GPP TS 29.328 ยง6.1.1.1, when both the AS and the HSS support the Notif-Eff feature (negotiated via the Supported-Features AVP), a single UDR may carry multiple Data-Reference AVPs and the HSS responds with one UDA whose User-Data-Sh is a single <Sh-Data> document concatenating the per-reference subtrees as siblings. TAS relies on this โ€” every Sh lookup fetches the full set of references the system knows how to consume in one round-trip.

Data-References requested (TS 29.328 Table 7.6.1)โ€‹

RefElementUsed by TAS to populate
0RepositoryData (with Service-Indication = "MMTEL-Services")call_forward_all_destination, call_forward_not_reachable_destination, no_reply_timer
10IMSPublicIdentityims_public_identity, msisdn
11IMSUserStateims_user_state (raw enum value from TS 29.328 ยง7.6.3)
12SCSCFNamescscf_address, scscf_domain
13InitialFilterCriteria(body returned to TAS but not currently surfaced as a dialplan variable)
14LocationInformationlocation_rat_type, location_mme_name, location_vplmn_id, location_age_seconds
15UserStateuser_state (raw enum value from TS 29.328 ยง7.6.7)
17MSISDN(cross-checked against IMPU)
32IMSIimsi
33IMSPrivateUserIdentityims_private_identity, ims_domain (parsed from suffix)

All of the single-string fields are surfaced to the dialplan as raw string variables โ€” TAS does not interpret their values. See the Dialplan Variables Set from Sh Data table below for the full list.

Example UDA body (sanitised)โ€‹

A successful merged response in the live trace looks like this โ€” the per-reference subtrees appear under one <Sh-Data> wrapper in the order the references were requested:

[debug] Fetched caller data for +614xxxxxxxx
(Data-Ref [0, 10, 11, 12, 13, 14, 15, 17, 32, 33],
SI="MMTEL-Services"): 4453 bytes

<?xml version="1.0" encoding="UTF-8"?>
<Sh-Data>
<RepositoryData></RepositoryData>
<PublicIdentifiers>
<IMSPublicIdentity>sip:+614xxxxxxxx@ims.mnc001.mcc999.3gppnetwork.org</IMSPublicIdentity>
<IMSPublicIdentity>tel:+614xxxxxxxx</IMSPublicIdentity>
</PublicIdentifiers>
<ShIMSData>
<IMSUserState>1</IMSUserState>
</ShIMSData>
<ShIMSData>
<SCSCFName>sip:scscf01.ims.mnc001.mcc999.3gppnetwork.org:5060</SCSCFName>
</ShIMSData>
<IMSSubscription>
<PrivateID>9999990000xxxxx@ims.mnc001.mcc999.3gppnetwork.org</PrivateID>
<ServiceProfile>
... InitialFilterCriteria entries ...
</ServiceProfile>
</IMSSubscription>
<ShIMSData>
<LocationInformation>
<RAT-Type>eutran</RAT-Type>
<MMEName>mme01.epc.mnc001.mcc999.3gppnetwork.org</MMEName>
<VPLMNId>999001</VPLMNId>
<AgeOfLocationInformation>NNNN</AgeOfLocationInformation>
</LocationInformation>
</ShIMSData>
<IMSPrivateUserIdentity>9999990000xxxxx@ims.mnc001.mcc999.3gppnetwork.org</IMSPrivateUserIdentity>
</Sh-Data>

How parsers consume the merged bodyโ€‹

The TAS does not walk the XML tree. Each per-reference parser is independent and tag-based: it searches the merged body for a specific element name (e.g. <SCSCFName>, <IMSPublicIdentity>, <CallForwardUnconditional>, <CallForwardNoReplyTimer>, the not-reachable cp:rule block) and pulls out only the value it cares about. Subtrees that the parser does not recognise are silently ignored.

The result of each parser is a partial subscriber-data map; the partials are merged in order over a defaults map. This makes the lookup robust to heterogeneous HSS implementations and partial responses โ€” see the graceful degradation section below.

Data Retrieved from Sh Interfaceโ€‹

The TAS issues a single multi-Data-Reference UDR per call leg (see Multi-Data-Reference UDR (Notif-Eff) above for the request shape and the merged response). The fields the TAS extracts from the merged <Sh-Data> body fall into three groups:

1. IMS Identities:

  • IMPI (Private Identity): parsed from the <IMSPrivateUserIdentity> element. Format: {IMSI}@{IMS-domain}. The TAS splits on @ to recover the IMSI and the IMS domain independently.
  • IMPU (Public Identity): parsed from the <IMSPublicIdentity> element. Format: sip:+{MSISDN}@{IMS-domain}. The MSISDN is stripped of the leading + and surfaced as the msisdn dialplan variable.

2. S-CSCF Assignment:

  • S-CSCF server name and domain where the subscriber is currently registered, parsed from the <SCSCFName> element (Data-Reference 12). Used by the MT dialplan to route the INVITE directly to the registered S-CSCF rather than fanning out into the IMS realm.
  • Note: the canonical XML element name in TS 29.328 Annex D is SCSCFName (no hyphen). The hyphenated form "S-CSCF" only appears in spec prose.

3. MMTel Services (Multimedia Telephony Configuration):

  • Returned inside <RepositoryData> keyed by Service-Indication = "MMTEL-Services".
  • Subscriber-specific call forwarding rules:
    • Call Forward All (CFA): Unconditional forwarding to another number
    • Call Forward Busy (CFB): Forward when subscriber is busy
    • Call Forward No Reply (CFNRy): Forward after timeout (timer value extracted from <CallForwardNoReplyTimer>)
    • Call Forward Not Reachable (CFNRc): Forward when subscriber is offline/unregistered (extracted from the not-reachable <cp:rule> inside the MMTel-Services repository document)

What is MMTel-Config?โ€‹

MMTel-Config is the subscriber's Multimedia Telephony service configuration stored as transparent (repository) data in the HSS, keyed by Service-Indication = "MMTEL-Services". It is fetched as part of the same multi-Data-Reference UDR as the identity lookup (Data-Reference 0 plus the service indication AVP). The document follows the OMA / 3GPP simservs XCAP schema and typically contains a complete-communication-diversion block with one or more cp:rule entries (busy, noanswer, unregistered, notreachable), an optional <NoReplyTimer> value, and other MMTel sub-services such as Communication Barring and Identity Presentation.

Common MMTel Services TAS recognises:

  • CDIV (Communication Diversion): Call forwarding rules โ€” the only block currently parsed end-to-end into dialplan variables. The notreachable rule populates call_forward_not_reachable_destination and <NoReplyTimer> populates no_reply_timer.
  • OIP (Originating Identity Presentation): Caller ID presentation rules (returned in the body but not currently consumed).
  • TIP (Terminating Identity Presentation): Called party number rules (returned in the body but not currently consumed).

Dialplan Variables Set from Sh Dataโ€‹

After a successful Sh lookup, these variables are populated:

VariableSourceExample ValueDescription
ims_private_identityIMPI9999990000xxxxx@ims.mnc001.mcc999.3gppnetwork.orgPrivate user identity for authentication
ims_public_identityIMPUsip:+614xxxxxxxx@ims.mnc001.mcc999.3gppnetwork.orgPublic user identity for routing
msisdnIMPU (parsed)614xxxxxxxxSubscriber number (+ stripped)
imsiIMPI (parsed)9999990000xxxxxIMSI from private identity
ims_domainIMPI/IMPUims.mnc001.mcc999.3gppnetwork.orgIMS domain
scscf_addressSCSCFNamesip:scscf01.ims.mnc001.mcc999.3gppnetwork.org:5060 or "none"S-CSCF server address (registered)
scscf_domainSCSCFName (parsed)scscf01.ims.mnc001.mcc999.3gppnetwork.org or "none"S-CSCF host (registered)
call_forward_all_destinationMMTel CDIVnumeric or "none"CFA destination number
call_forward_not_reachable_destinationMMTel CDIVnumeric or config defaultCFNRc destination (voicemail)
no_reply_timerMMTel CDIVseconds, or config defaultTimeout before CFNRy activates
ims_user_stateIMSUserState (Data-Ref 11)"0"/"1"/"2"/"3" or "none"IMS registration state enum. 1 = REGISTERED, 0 = NOT_REGISTERED, 2 = AUTHENTICATION_PENDING, 3 = REGISTERED_UNREG_SERVICES (TS 29.328 ยง7.6.3). Raw string, TAS does not interpret.
user_stateUserState (Data-Ref 15)raw string or "none"CS/PS user state (TS 29.328 ยง7.6.7). Raw string, TAS does not interpret.
location_rat_typeLocationInformation/RAT-Type"eutran", "utran", "geran", "wlan", ... or "none"Radio access technology of the last known registration.
location_mme_nameLocationInformation/MMENameMME FQDN or "none"MME host serving the subscriber.
location_vplmn_idLocationInformation/VPLMNIdMCCMNC digit string or "none"Visited PLMN identifier (useful for roaming detection in the dialplan).
location_age_secondsLocationInformation/AgeOfLocationInformationnumeric string or "none"Seconds since the location information was last reported to the HSS.

Priority: Sh Data vs Configuration Defaultsโ€‹

The TAS uses this priority order for call forwarding data:

  1. MMTel-Config from Sh โ€” highest priority, subscriber-specific settings.
  2. HLR Data from SS7 MAP โ€” overrides Sh for MT calls if roaming or call forwarding is active in the visited network. See SS7 MAP.
  3. Configuration Defaults โ€” lowest priority, used when neither Sh nor HLR provides a value (or when the corresponding subtree was missing from the Sh response โ€” see graceful degradation below). The defaults are configured in runtime.exs under config :tas โ€” call_forward_not_reachable_destination and default_no_reply_timer.

What Happens When Sh Lookup Failsโ€‹

Whole-request failure scenarios:

  1. Subscriber Not Provisioned in HSS:

    • HSS returns Experimental-Result-Code 5001 (DIAMETER_ERROR_USER_UNKNOWN)
    • TAS treats the call leg as unresolvable
    • hangup_case variable set to "UNALLOCATED_NUMBER"
    • Call rejected with appropriate SIP response
  2. HSS Unreachable / Timeout:

    • Sh request times out (default: 5000ms, see Diameter request_timeout in runtime.exs)
    • Error logged and metric recorded
    • Call leg fails the same way as case (1)
  3. HSS does not support multi-Data-Reference UDRs:

    • HSS either returns an error or drops the request silently (HSS-dependent)
    • From the TAS side this looks like case (1) or (2) โ€” the lookup fails wholesale and the call leg is rejected
    • The HSS must implement the Notif-Eff feature for TAS to function. See TS 29.328 ยง6.1.1.1 for the feature definition.

Graceful per-subtree degradationโ€‹

When the UDR itself succeeds (Result-Code: 2001) but individual subtrees of the merged <Sh-Data> body are missing, TAS does not fail the call. Each per-reference parser is independent and falls back to a defined default when its tag is absent. Operators only have to worry about whole-request failures (above); partial-data degradation is automatic and observable in the debug logs.

Subtree missingResult
<SCSCFName> (Data-Ref 12)scscf_address and scscf_domain set to "none"
<IMSPrivateUserIdentity> (Data-Ref 33)ims_private_identity, imsi, ims_domain set to "none"
<CallForwardUnconditional> inside MMTel RepositoryDatacall_forward_all_destination set to "none"
not-reachable/<cp:rule> block inside MMTel RepositoryDatacall_forward_not_reachable_destination falls back to Tas.Config.call_forward_not_reachable_destination()
<CallForwardNoReplyTimer> inside MMTel RepositoryDatano_reply_timer falls back to Tas.Config.default_no_reply_timer()
Empty <RepositoryData></RepositoryData>All MMTel-derived fields fall back to config defaults
Empty/absent <IMSUserState>, <LocationInformation>, <InitialFilterCriteria>Currently no dialplan side-effect (parsed but not yet plumbed)

The only hard requirement is that the response contains an <IMSPublicIdentity> element. If that tag is missing the lookup returns {:error, :sh_parse_failed} and the call leg is treated as unresolvable (same downstream behaviour as case 1 above). Every other field is "ask freely, take what you can get".

This makes TAS resilient to heterogeneous HSS deployments: an HSS that implements Notif-Eff but only populates IMSPublicIdentity, MSISDN and SCSCFName (for example) will still produce a working call; the dialplan just falls back to config defaults for the MMTel-derived variables.

Monitoring Sh Interfaceโ€‹

Key Metrics:

# Sh lookup success rate
rate(subscriber_data_lookups_total{result="success"}[5m]) /
rate(subscriber_data_lookups_total[5m]) * 100

# Sh lookup latency (P95)
histogram_quantile(0.95,
rate(subscriber_data_duration_milliseconds_bucket[5m]))

# Sh error rate
rate(subscriber_data_lookups_total{result="error"}[5m])

Alert Thresholds:

  • P95 latency > 100ms: Slow HSS responses
  • Error rate > 5%: HSS connectivity issues
  • Error rate > 20%: Critical HSS failure

Troubleshooting:

  1. Check Diameter peer status in Web UI (/diameter)
  2. Test Sh lookup in Web UI (/sh_test) with known subscriber
  3. Review logs for "Subscriber Data" errors
  4. Verify HSS/Repository is reachable from TAS
  5. Check subscriber_data_lookups_total metric for patterns

Testing Sh Interfaceโ€‹

Use the Web UI Sh Test tool (/sh_test):

  1. Navigate to /sh_test in Control Panel
  2. Enter subscriber MSISDN (e.g., +614xxxxxxxx)
  3. Click "Query Sh"
  4. Review returned data:
    • IMPI/IMPU identities
    • S-CSCF assignment
    • MMTel services
    • Call forwarding configuration

Common Test Scenarios:

  • Verify newly provisioned subscribers are in HSS
  • Check call forwarding settings for specific subscriber
  • Validate S-CSCF assignment after IMS registration
  • Test HSS connectivity and response times