Skip to main content

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.

PropertyValue
Application ID16777302
Specification3GPP TS 29.219
HSS rolePCRF (Diameter client for SLR/STR, server for SNR)
PeerOCS (Online Charging System)
TransportTCP 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 AVPNatureMaps toRole
Policy-Counter-Identifier (2901)Static - names the counterA Charging Rule name in the HSS databaseSelects which charging rule the counter governs
Policy-Counter-Status (2902)Dynamic - changes at thresholdsAn enforcement actionDecides 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 enforced installs the named charging rule (Charging-Rule-Install over 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-Identifier must match a charging rule name, and the OCS must emit those exact names with the status enforced when 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}
]
}
ParameterTypeRequiredDefaultDescription
application_nameAtomYes-Internal name for the interface. Must be :sy for the Sy application.
application_dictionaryAtomYes-Diameter dictionary module. Must be :diameter_gen_3gpp_sy (3GPP TS 29.219).
vendor_specific_application_idsListYes-Advertises the Sy application at capabilities exchange. See below.
vendor_idIntegerYes-Vendor ID. 10415 for 3GPP.
auth_application_idIntegerYes-Authentication application ID. 16_777_302 for Sy.
acct_application_idInteger | nilNonilAccounting 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
}
ParameterTypeRequiredDefaultDescription
enabledBooleanNofalseMaster 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-Identifier is set to the exact name of a Charging Rule defined in the HSS, and the counter reports the status enforced when 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, or sta
  • direction - incoming (received from the OCS) or outgoing (sent to the OCS)
  • result - sent, received, success, or error

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 - install or remove
  • result - success or error (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

CommandAbbreviationCodeDirectionPurpose
Spending-Limit-RequestSLR8388635PCRF -> OCSRequest policy counter status; subscribe to changes
Spending-Limit-AnswerSLA8388635OCS -> PCRFReturn current counter status
Spending-Status-Notification-RequestSNR8388636OCS -> PCRFNotify a counter status change
Spending-Status-Notification-AnswerSNA8388636PCRF -> OCSAcknowledge a notification
Session-Termination-RequestSTR275PCRF -> OCSClose the Sy session (final report)
Session-Termination-AnswerSTA275OCS -> PCRFConfirm session closure

All commands carry Application-ID 16777302, including the re-used STR/STA (RFC 6733 session termination).

Key AVPs

AVPCodeTypeDescription
Policy-Counter-Identifier2901UTF8StringNames a policy counter. Bound to a Charging Rule name in OmniHSS.
Policy-Counter-Status2902UTF8StringOperator-defined status label for the counter. Drives the enforcement action.
Policy-Counter-Status-Report2903GroupedOne counter's identifier + status (+ any pending statuses).
SL-Request-Type2904EnumeratedINITIAL_REQUEST (0) for the first request, INTERMEDIATE_REQUEST (1) thereafter.
Pending-Policy-Counter-Information2905GroupedA future status and the time it becomes current.
Pending-Policy-Counter-Change-Time2906TimeWhen a pending status takes effect.
SN-Request-Type2907Unsigned32Bitmask on an SNR. Bit 0 = normal report, bit 1 = abort (OCS asks to end the Sy session).
Subscription-Id443GroupedSubscriber identity (IMSI and/or MSISDN) on the SLR.

Result Codes

CodeNameMeaning
2001DIAMETER_SUCCESSRequest processed successfully
5030DIAMETER_USER_UNKNOWNOCS does not know the subscriber; the Sy session is not created
5570DIAMETER_ERROR_UNKNOWN_POLICY_COUNTERSOne or more requested policy counters are unknown to the OCS
4241DIAMETER_ERROR_NO_AVAILABLE_POLICY_COUNTERSThe 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.