Sy Interface (Spending Limit Control)
Overview
The Sy interface connects the HSS (acting as the PCRF, Policy and Charging Rules Function) to an external OCS (Online Charging System) for subscriber spending limit control. It lets the PCRF base its policy decisions - for example which charging rule to apply, or whether to throttle a subscriber - on the status of policy counters that the OCS maintains for each subscriber (data allowance consumed, spend against a monthly cap, and so on).
The OmniHSS PCRF installs charging rules and QoS over Gx and authorizes IMS media over Rx. Over Sy it subscribes to the status of a subscriber's policy counters at the OCS and is notified when they change, so those Gx decisions can account for the subscriber's current spend and quota.
Sy is defined by 3GPP TS 29.219 and uses Diameter application ID 16777302.
| Property | Value |
|---|---|
| Application ID | 16777302 |
| Specification | 3GPP TS 29.219 |
| HSS role | PCRF (Diameter client for SLR/STR, server for SNR) |
| Peer | OCS (Online Charging System) |
| Transport | TCP or SCTP, port 3868 |
Sy vs Gy. Sy is not online charging. Gy (TS 32.299) is where the PGW asks the OCS to grant credit for live traffic. Sy is a separate, lightweight interface where the PCRF subscribes to the status of the OCS's policy counters and is notified when they change, so it can adjust policy. The OCS is the server on both.
Architecture
The HSS is the Sy client: it opens an Sy session to the OCS when it first needs spend status for a subscriber, and tears it down when the subscriber's last data session ends. The OCS is the Sy server: it answers status requests and, whenever a counter's status changes, notifies the PCRF so it can re-apply policy over Gx.
Policy Counters and Charging Rules
The OCS maintains one or more policy counters per subscriber. Each counter has:
- a Policy-Counter-Identifier (AVP 2901) - a stable name for the counter, and
- a Policy-Counter-Status (AVP 2902) - a label describing where the counter currently sits (for example
active,over_quota,throttled). The set of status values is not defined by 3GPP; it is configured jointly by the operator on both the OCS and the PCRF (TS 29.219 §3.1).
OmniHSS binds these to the charging rules already in its database:
| Sy AVP | Nature | Maps to | Role |
|---|---|---|---|
Policy-Counter-Identifier (2901) | Static - names the counter | A Charging Rule name in the HSS database | Selects which charging rule the counter governs |
Policy-Counter-Status (2902) | Dynamic - changes at thresholds | An enforcement action | Decides what to do with that rule now: install, remove, or select a tier |
The identifier is stable for the life of the counter, so on its own it cannot express "under quota" versus "over quota". The status is the value that changes when the subscriber crosses a threshold, so it drives the action:
- the fixed status
enforcedinstalls the named charging rule (Charging-Rule-Installover Gx); - any other status removes it (
Charging-Rule-Remove).
Sy carries no charging rules of its own. Sy has no Charging-Rule, QoS or Flow AVPs - those exist only on Gx. The OCS therefore cannot hand the PCRF a rule definition; it can only name the rule (via the counter identifier) and signal when to apply it (via the status). The rule definition itself is provisioned in the HSS. This is why
Policy-Counter-Identifiermust match a charging rule name, and the OCS must emit those exact names with the statusenforcedwhen the rule is to be applied.
Sy Session Lifecycle
An Sy session is per subscriber, not per data bearer. The PCRF keeps one Sy session (identified by a single Diameter Session-Id) for a subscriber for as long as any of that subscriber's data sessions depends on spend status (TS 29.219 §4.4.1).
- Establish (SLR, INITIAL_REQUEST). On the first Gx CCR-I where the subscriber's policy depends on spend status, the PCRF opens the Sy session and requests the relevant policy counters. The OCS answers with the current status of each in the SLA.
- Update (SLR, INTERMEDIATE_REQUEST). If the PCRF later needs additional counters, it re-uses the same Sy session with an intermediate request.
- Notify (SNR / SNA). When a counter's status changes, the OCS sends a Spending-Status-Notification-Request. The PCRF acknowledges with an SNA and applies the change over Gx.
- Terminate (STR / STA). When the subscriber's last data session ends, the PCRF closes the Sy session with a Session-Termination-Request.
Message Flows
Flow 1: Initial Spending Limit Report at PDN Setup
The PCRF folds the spend-derived rules into the same CCA-I it already builds for the Gx session. If the OCS does not answer in time, the PCRF falls back to the APN's default policy so a Sy outage never blocks attach.
Flow 2: Spending Status Change (OCS -> PCRF -> Gx RAR)
This re-uses the PCRF's existing Gx Re-Auth machinery - the same path that installs VoLTE dedicated bearers - to push the spend-driven policy change to the PGW without waiting for the next CCR.
Flow 3: Sy Session Termination
Configuration
Sy Application
The Sy application is registered on the HSS Diameter service alongside Gx and Rx (config/runtime.exs):
%{
application_name: :sy,
application_dictionary: :diameter_gen_3gpp_sy,
vendor_specific_application_ids: [
%{vendor_id: 10415, auth_application_id: 16_777_302, acct_application_id: nil}
]
}
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
application_name | Atom | Yes | - | Internal name for the interface. Must be :sy for the Sy application. |
application_dictionary | Atom | Yes | - | Diameter dictionary module. Must be :diameter_gen_3gpp_sy (3GPP TS 29.219). |
vendor_specific_application_ids | List | Yes | - | Advertises the Sy application at capabilities exchange. See below. |
vendor_id | Integer | Yes | - | Vendor ID. 10415 for 3GPP. |
auth_application_id | Integer | Yes | - | Authentication application ID. 16_777_302 for Sy. |
acct_application_id | Integer | nil | No | nil | Accounting application ID. Not used by Sy; set to nil. |
Sy Settings
Sy behaviour is configured under the :hss, :sy key (config/runtime.exs):
config :hss,
sy: %{
enabled: false
}
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
enabled | Boolean | No | false | Master switch. When true, the PCRF opens a per-subscriber Sy session on Gx CCR-I. When false, Sy is completely bypassed. |
The Policy-Counter-Status value that installs the named charging rule is the fixed convention enforced; any other value removes the rule. This is agreed with the OCS and is not configurable.
OCS Routing
The HSS does not pin an OCS host or realm. Originated SLR and STR carry the HSS's own Destination-Realm and no Destination-Host, and are routed by realm plus the Sy Application-Id (16777302). Whichever peer advertises the Sy application in that realm receives the request - typically the DRA, which forwards to an available OCS. This works identically whether the OCS is reached through the DRA or peered directly, and it lets the routing layer pick among multiple OCSs.
The only requirement is that a peer advertising the Sy application exists in the realm. In a DRA deployment that is the DRA peer already configured for the HSS; no Sy-specific peer entry is needed.
Policy Counter Mapping
For the identifier-to-rule binding to work, the operator configures both ends consistently:
- On the OCS: each policy counter's
Policy-Counter-Identifieris set to the exactnameof a Charging Rule defined in the HSS, and the counter reports the statusenforcedwhen that rule should be applied. - On the HSS: the referenced charging rules exist in the database.
See Policy Counters and Charging Rules for the mapping model.
Metrics
Sy exposes Prometheus metrics alongside the other HSS interface metrics (see Metrics & Monitoring).
Metric: hss_sy_messages_total
Type: Counter
Description: Sy messages processed, by command, direction and result.
Labels:
command-slr,sla,snr,sna,str, orstadirection-incoming(received from the OCS) oroutgoing(sent to the OCS)result-sent,received,success, orerror
Metric: hss_sy_policy_updates_total
Type: Counter
Description: Gx charging-rule changes driven by a Sy policy counter status, by action and result.
Labels:
action-installorremoveresult-successorerror(the outcome of the Gx RAR to the PGW)
Example queries:
# Sy notification rate from the OCS
rate(hss_sy_messages_total{command="snr", direction="incoming"}[5m])
# Rate of throttle/enforcement rule installs driven by spending limits
rate(hss_sy_policy_updates_total{action="install", result="success"}[5m])
# Sy Gx RAR failure ratio
sum(rate(hss_sy_policy_updates_total{result="error"}[5m]))
/ sum(rate(hss_sy_policy_updates_total[5m]))
Reference
Commands
| Command | Abbreviation | Code | Direction | Purpose |
|---|---|---|---|---|
| Spending-Limit-Request | SLR | 8388635 | PCRF -> OCS | Request policy counter status; subscribe to changes |
| Spending-Limit-Answer | SLA | 8388635 | OCS -> PCRF | Return current counter status |
| Spending-Status-Notification-Request | SNR | 8388636 | OCS -> PCRF | Notify a counter status change |
| Spending-Status-Notification-Answer | SNA | 8388636 | PCRF -> OCS | Acknowledge a notification |
| Session-Termination-Request | STR | 275 | PCRF -> OCS | Close the Sy session (final report) |
| Session-Termination-Answer | STA | 275 | OCS -> PCRF | Confirm session closure |
All commands carry Application-ID 16777302, including the re-used STR/STA (RFC 6733 session termination).
Key AVPs
| AVP | Code | Type | Description |
|---|---|---|---|
Policy-Counter-Identifier | 2901 | UTF8String | Names a policy counter. Bound to a Charging Rule name in OmniHSS. |
Policy-Counter-Status | 2902 | UTF8String | Operator-defined status label for the counter. Drives the enforcement action. |
Policy-Counter-Status-Report | 2903 | Grouped | One counter's identifier + status (+ any pending statuses). |
SL-Request-Type | 2904 | Enumerated | INITIAL_REQUEST (0) for the first request, INTERMEDIATE_REQUEST (1) thereafter. |
Pending-Policy-Counter-Information | 2905 | Grouped | A future status and the time it becomes current. |
Pending-Policy-Counter-Change-Time | 2906 | Time | When a pending status takes effect. |
SN-Request-Type | 2907 | Unsigned32 | Bitmask on an SNR. Bit 0 = normal report, bit 1 = abort (OCS asks to end the Sy session). |
Subscription-Id | 443 | Grouped | Subscriber identity (IMSI and/or MSISDN) on the SLR. |
Result Codes
| Code | Name | Meaning |
|---|---|---|
| 2001 | DIAMETER_SUCCESS | Request processed successfully |
| 5030 | DIAMETER_USER_UNKNOWN | OCS does not know the subscriber; the Sy session is not created |
| 5570 | DIAMETER_ERROR_UNKNOWN_POLICY_COUNTERS | One or more requested policy counters are unknown to the OCS |
| 4241 | DIAMETER_ERROR_NO_AVAILABLE_POLICY_COUNTERS | The OCS has no policy counters for the subscriber |
Codes 5570 and 4241 are Sy-specific Experimental-Result-Code values (TS 29.219 §5.5); 5030 is defined by RFC 4006.
Related Documentation
- PCRF - Gx and Rx policy control that Sy feeds into
- Diameter Protocols - Message flows across all HSS interfaces
- Architecture - Overall HSS architecture