Skip to main content

Diameter Online Charging (Gy/Ro Interface)

Online Charging System (OCS) Interface


Table of Contents

  1. Overview
  2. 3GPP Charging Architecture
  3. Gy/Ro Interface Basics
  4. Credit Control Messages
  5. Online Charging Flows
  6. Bearer Charging Control
  7. Multiple Services Credit Control
  8. Configuration
  9. Message Flows
  10. Error Handling
  11. Integration with Gx
  12. Troubleshooting

Overview

The Gy interface (also called Ro interface in IMS contexts) connects PGW-C to the Online Charging System (OCS) for real-time credit control. This enables:

  • Prepaid Charging - Real-time credit authorization and deduction
  • Real-time Credit Control - Grant quota before service delivery
  • Service-Based Charging - Different charging for voice, data, SMS, etc.
  • Immediate Account Updates - Credit balance updates in real-time
  • Service Denial - Block service when credit exhausted

Online vs. Offline Charging

AspectOnline Charging (Gy/Ro)Offline Charging (Gz/Rf)
TimingReal-time, before serviceAfter service delivery
Use CasePrepaid subscribersPostpaid subscribers
Credit CheckYes, before granting serviceNo, bill generated later
SystemOCS (Online Charging System)CGF/CDF (Charging Data Function)
RiskNo revenue lossRisk of unpaid bills
ComplexityHigh (real-time requirements)Lower (batch processing)
User ImpactService denied if no creditService always available

See also: Data CDR Format for offline charging records (postpaid billing)

See also: Session Management for complete PDN session lifecycle including charging integration

Gy in the Network Architecture

Key Functions

FunctionDescription
Credit AuthorizationRequest quota from OCS before allowing traffic
Quota ManagementTrack granted units (bytes, time, events)
Credit Depletion DetectionMonitor remaining quota
Re-authorizationRequest additional quota when threshold reached
Service TerminationStop service when credit exhausted
Final SettlementReport actual usage upon session end

3GPP Charging Architecture

Charging Reference Points

Charging Trigger Function (CTF)

PGW-C acts as a CTF (Charging Trigger Function), responsible for:

  1. Detecting chargeable events - Session start, data usage, session end
  2. Requesting credit authorization - Before allowing service
  3. Tracking quota consumption - Monitor granted units
  4. Generating charging events - Trigger credit requests
  5. Enforcing credit control - Block traffic when quota exhausted

Online Charging Function (OCF)

The OCS implements the OCF (Online Charging Function):

  1. Account balance management - Track subscriber credit
  2. Rating - Determine price per unit (per MB, per second, etc.)
  3. Credit reservation - Reserve credit for granted quota
  4. Credit deduction - Deduct upon usage report
  5. Policy decisions - Grant or deny based on balance

Gy/Ro Interface Basics

3GPP Reference

  • Specification: 3GPP TS 32.299 (Charging architecture)
  • Protocol: 3GPP TS 32.251 (PS domain charging)
  • Diameter Application ID: 4 (Gy/Ro - Credit Control Application)
  • Base Protocol: RFC 4006 (Diameter Credit Control Application)

Session Concept

Each UE PDN connection requiring online charging has a Gy/Ro session identified by a Session-ID. This session:

  • Created when bearer requires online charging (CCR-Initial)
  • Updated when quota is consumed (CCR-Update)
  • Terminated when session ends (CCR-Termination)

Session ID Format

Session-ID: <Origin-Host>;<high32>;<low32>[;<optional>]
Example: omni-pgw_c.epc.mnc999.mcc999.3gppnetwork.org;9876543210;12345;gy

Components:

  • Origin-Host: PGW-C's Diameter identity
  • high32: High 32 bits of unique identifier
  • low32: Low 32 bits of unique identifier
  • optional: Additional identifier (e.g., "gy" to distinguish from Gx)

Credit Control Messages

Message Types

CCR-Initial (Credit Control Request - Initial)

When: UE creates a PDN connection and bearer requires online charging

Purpose:

  • Request initial credit authorization from OCS
  • Reserve quota for service delivery
  • Establish Gy/Ro session

Key AVPs Sent by PGW-C:

AVP NameAVP CodeTypeDescription
Session-Id263UTF8StringUnique Gy session identifier
Auth-Application-Id258Unsigned324 (Credit Control)
Origin-Host264DiamIdentPGW-C's Diameter identity
Origin-Realm296DiamIdentPGW-C's Diameter realm
Destination-Realm283DiamIdentOCS's realm
CC-Request-Type416Enumerated1 = INITIAL_REQUEST
CC-Request-Number415Unsigned32Sequence number (starts at 0)
Subscription-Id443GroupedUE identifier (IMSI/MSISDN)
Service-Context-Id461UTF8StringCharging context identifier
Multiple-Services-Credit-Control456GroupedService-specific credit requests
Requested-Service-Unit437GroupedRequested quota (bytes, time, etc.)
Used-Service-Unit446GroupedUsed quota (0 for initial)
Service-Identifier439Unsigned32Service type identifier
Rating-Group432Unsigned32Charging category identifier

Example CCR-I Structure:

CCR (Command Code: 272, Request)
├── Session-Id: "pgw_c.example.com;123;456;gy"
├── Auth-Application-Id: 4
├── Origin-Host: "omni-pgw_c.epc.mnc999.mcc999.3gppnetwork.org"
├── Origin-Realm: "epc.mnc999.mcc999.3gppnetwork.org"
├── Destination-Realm: "epc.mnc999.mcc999.3gppnetwork.org"
├── CC-Request-Type: INITIAL_REQUEST (1)
├── CC-Request-Number: 0
├── Subscription-Id (Grouped)
│ ├── Subscription-Id-Type: END_USER_IMSI (1)
│ └── Subscription-Id-Data: "310260123456789"
├── Subscription-Id (Grouped)
│ ├── Subscription-Id-Type: END_USER_E164 (0)
│ └── Subscription-Id-Data: "15551234567"
├── Service-Context-Id: "32251@3gpp.org"
├── Multiple-Services-Credit-Control (Grouped)
│ ├── Service-Identifier: 1
│ ├── Rating-Group: 100
│ └── Requested-Service-Unit (Grouped)
│ └── CC-Total-Octets: 10000000 (request 10 MB)
└── Used-Service-Unit (Grouped)
└── CC-Total-Octets: 0 (no usage yet)

CCA-Initial (Credit Control Answer - Initial)

Sent by: OCS in response to CCR-I

Purpose:

  • Grant or deny credit authorization
  • Provide quota for service delivery
  • Specify rating and charging parameters

Key AVPs Received by PGW-C:

AVP NameAVP CodeDescription
Result-Code268Success (2001) or error code
Multiple-Services-Credit-Control456Service-specific credit grants
Granted-Service-Unit431Granted quota (bytes, time, etc.)
Validity-Time448Quota validity period (seconds)
Result-Code268Per-service result code
Final-Unit-Indication430Action when quota exhausted
Volume-Quota-Threshold-Threshold for re-authorization

Success Response Example:

CCA (Command Code: 272, Answer)
├── Session-Id: "pgw_c.example.com;123;456;gy"
├── Result-Code: DIAMETER_SUCCESS (2001)
├── Origin-Host: "ocs.example.com"
├── Origin-Realm: "example.com"
├── Auth-Application-Id: 4
├── CC-Request-Type: INITIAL_REQUEST (1)
├── CC-Request-Number: 0
└── Multiple-Services-Credit-Control (Grouped)
├── Result-Code: DIAMETER_SUCCESS (2001)
├── Service-Identifier: 1
├── Rating-Group: 100
├── Granted-Service-Unit (Grouped)
│ └── CC-Total-Octets: 10000000 (granted 10 MB)
├── Validity-Time: 3600 (quota valid for 1 hour)
└── Volume-Quota-Threshold: 8000000 (re-auth at 8 MB used, 80%)

CCR-Update (Credit Control Request - Update)

When:

  • Granted quota threshold reached (e.g., 80% consumed)
  • Validity time expires
  • Service change requires re-authorization
  • Tariff time change

Purpose:

  • Request additional quota
  • Report usage of previously granted quota
  • Update charging parameters

Key Differences from CCR-I:

  • CC-Request-Type: UPDATE_REQUEST (2)
  • CC-Request-Number incremented
  • Used-Service-Unit contains actual usage
  • Requested-Service-Unit for more quota

Example CCR-U Structure:

CCR (Command Code: 272, Request)
├── Session-Id: "pgw_c.example.com;123;456;gy"
├── Auth-Application-Id: 4
├── Origin-Host: "omni-pgw_c.epc.mnc999.mcc999.3gppnetwork.org"
├── Origin-Realm: "epc.mnc999.mcc999.3gppnetwork.org"
├── Destination-Realm: "epc.mnc999.mcc999.3gppnetwork.org"
├── CC-Request-Type: UPDATE_REQUEST (2)
├── CC-Request-Number: 1
└── Multiple-Services-Credit-Control (Grouped)
├── Service-Identifier: 1
├── Rating-Group: 100
├── Used-Service-Unit (Grouped)
│ └── CC-Total-Octets: 8000000 (8 MB used so far)
└── Requested-Service-Unit (Grouped)
└── CC-Total-Octets: 10000000 (request another 10 MB)

CCA-Update (Credit Control Answer - Update)

Sent by: OCS in response to CCR-U

Purpose:

  • Grant additional quota (if credit available)
  • Acknowledge usage
  • Update charging parameters

Possible Outcomes:

1. More Quota Granted:

CCA (Update)
└── Multiple-Services-Credit-Control
├── Result-Code: DIAMETER_SUCCESS (2001)
├── Granted-Service-Unit
│ └── CC-Total-Octets: 10000000 (another 10 MB)
└── Validity-Time: 3600

2. Final Quota (Credit Exhausted):

CCA (Update)
└── Multiple-Services-Credit-Control
├── Result-Code: DIAMETER_SUCCESS (2001)
├── Granted-Service-Unit
│ └── CC-Total-Octets: 1000000 (only 1 MB left)
└── Final-Unit-Indication
└── Final-Unit-Action: TERMINATE (0)

3. No Credit Available:

CCA (Update)
├── Result-Code: DIAMETER_CREDIT_LIMIT_REACHED (4012)
└── Multiple-Services-Credit-Control
├── Result-Code: DIAMETER_CREDIT_LIMIT_REACHED (4012)
└── Final-Unit-Indication
└── Final-Unit-Action: TERMINATE (0)

CCR-Termination (Credit Control Request - Termination)

When:

  • UE detaches
  • PDN connection deleted
  • Session terminated for any reason

Purpose:

  • Final usage report
  • Close Gy/Ro session
  • Final settlement

Key Differences:

  • CC-Request-Type: TERMINATION_REQUEST (3)
  • Used-Service-Unit contains final usage
  • No Requested-Service-Unit (no more quota needed)
  • Includes Termination-Cause

Example CCR-T Structure:

CCR (Command Code: 272, Request)
├── Session-Id: "pgw_c.example.com;123;456;gy"
├── Auth-Application-Id: 4
├── Origin-Host: "omni-pgw_c.epc.mnc999.mcc999.3gppnetwork.org"
├── Origin-Realm: "epc.mnc999.mcc999.3gppnetwork.org"
├── Destination-Realm: "epc.mnc999.mcc999.3gppnetwork.org"
├── CC-Request-Type: TERMINATION_REQUEST (3)
├── CC-Request-Number: 5
├── Termination-Cause: DIAMETER_LOGOUT (1)
└── Multiple-Services-Credit-Control (Grouped)
├── Service-Identifier: 1
├── Rating-Group: 100
└── Used-Service-Unit (Grouped)
└── CC-Total-Octets: 18500000 (18.5 MB total usage)

CCA-Termination (Credit Control Answer - Termination)

Sent by: OCS in response to CCR-T

Purpose:

  • Acknowledge session termination
  • Complete accounting
  • Release reserved credit

Example CCA-T:

CCA (Command Code: 272, Answer)
├── Session-Id: "pgw_c.example.com;123;456;gy"
├── Result-Code: DIAMETER_SUCCESS (2001)
├── Origin-Host: "ocs.example.com"
├── Origin-Realm: "example.com"
├── Auth-Application-Id: 4
├── CC-Request-Type: TERMINATION_REQUEST (3)
└── CC-Request-Number: 5

Online Charging Flows

Service Unit Types

The OCS can grant quota in different units:

Unit TypeAVPDescriptionUse Case
TimeCC-TimeSecondsVoice calls, session duration
VolumeCC-Total-OctetsBytes (total up+down)Data services
Volume (separate)CC-Input-Octets, CC-Output-OctetsBytes (separate)Asymmetric charging
Service-SpecificCC-Service-Specific-UnitsCustom unitsSMS, MMS, API calls
Events-Counted eventsPay-per-use services

Quota Threshold Management

Problem: How does PGW-C know when to request more quota?

Solution: OCS provides a Volume-Quota-Threshold or Time-Quota-Threshold. PGW-C monitors usage via PFCP Session Reports from PGW-U (see PFCP Interface).

Example Flow:

1. OCS grants 10 MB quota with 80% threshold (8 MB)
2. PGW-C monitors usage via PGW-U usage reports (PFCP Session Reports)
3. When usage reaches 8 MB:
→ PGW-C sends CCR-Update
→ Continue allowing traffic (don't wait for response)
4. OCS responds with more quota
5. If quota exhausted before CCR-Update sent:
→ PGW-C must block traffic

Threshold Calculation:

Granted-Service-Unit: 10000000 bytes (10 MB)
Volume-Quota-Threshold: 8000000 bytes (8 MB)

When 8 MB consumed → Trigger CCR-Update
Remaining buffer: 2 MB (allows time for OCS response)

PGW-C Monitoring:

PGW-C monitors usage via PFCP Session Reports from PGW-U:

Final Unit Indication

What happens when credit is exhausted?

OCS includes Final-Unit-Indication AVP in CCA to specify action:

Final-Unit-ActionValuePGW-C Behavior
TERMINATE0Block all traffic, initiate session termination
REDIRECT1Redirect traffic to portal (e.g., top-up page)
RESTRICT_ACCESS2Allow access only to specific services (e.g., top-up server)

Example: Final Unit with Redirect

CCA (Update)
└── Multiple-Services-Credit-Control
├── Result-Code: DIAMETER_SUCCESS (2001)
├── Granted-Service-Unit
│ └── CC-Total-Octets: 1000000 (final 1 MB)
└── Final-Unit-Indication
├── Final-Unit-Action: REDIRECT (1)
└── Redirect-Server (Grouped)
├── Redirect-Address-Type: URL (2)
└── Redirect-Server-Address: "http://topup.example.com"

PGW-C Actions:

  1. TERMINATE: Send CCR-T, delete bearer
  2. REDIRECT: Install PFCP rule to redirect HTTP to top-up URL
  3. RESTRICT_ACCESS: Install PFCP rules allowing only whitelisted IPs

Bearer Charging Control

What Controls if a Bearer is Charged?

3GPP Specification: TS 23.203, TS 29.212, TS 32.251

Bearer charging is controlled by PCC Rules provisioned by the PCRF via the Gx interface. See Diameter Gx Interface for complete PCC rule documentation.

Charging Decision Flow:

PCC Rule with Charging Information

PCRF Response (CCA-I on Gx):

CCA (Gx Interface)
└── Charging-Rule-Definition (Grouped)
├── Charging-Rule-Name: "prepaid_data_rule"
├── Rating-Group: 100
├── Online: 1 (enable online charging)
├── Offline: 0 (disable offline charging)
├── Metering-Method: VOLUME (1)
├── Precedence: 100
├── Flow-Information: [...]
└── QoS-Information: [...]

Key Charging AVPs in PCC Rules:

AVP NameAVP CodeValuesDescription
Rating-Group432Unsigned32Charging category (maps to tariff in OCS)
Online10090=Disable, 1=EnableEnable online charging (Gy)
Offline10080=Disable, 1=EnableEnable offline charging (Gz)
Metering-Method10070=Duration, 1=Volume, 2=BothWhat to meter
Reporting-Level10110=Service, 1=Rating GroupGranularity of usage reports

Bearer Charging Decision Matrix

OnlineOfflineRating-GroupBehavior
10PresentOnline charging only (prepaid)
01PresentOffline charging only (postpaid)
11PresentBoth online and offline (convergent)
00-No charging (free service)

Multiple Rating Groups

A single PDN connection can have multiple bearers with different rating groups:

Example Scenario:

Default Bearer (Internet)
├── Rating-Group: 100 (Standard Data)
└── Online: 1

Dedicated Bearer 1 (Video Streaming)
├── Rating-Group: 200 (Video Service)
└── Online: 1

Dedicated Bearer 2 (IMS Voice)
├── Rating-Group: 300 (Voice)
└── Online: 1

PGW-C Gy Behavior:

  • Single CCR-I with multiple MSCC (Multiple-Services-Credit-Control) sections:
CCR-Initial
├── Session-Id: "..."
└── Multiple-Services-Credit-Control
├── [Rating-Group: 100] → Standard Data
├── [Rating-Group: 200] → Video Service
└── [Rating-Group: 300] → Voice

OCS Response:

CCA-Initial
└── Multiple-Services-Credit-Control
├── [Rating-Group: 100] → Granted: 10 MB
├── [Rating-Group: 200] → Granted: 5 MB (video more expensive)
└── [Rating-Group: 300] → Granted: 60 seconds

Per-Service Charging Enforcement

PGW-C tracks quota per Rating-Group:

# Pseudocode
state.charging_quotas = %{
100 => %{granted: 10_000_000, used: 0, threshold: 8_000_000},
200 => %{granted: 5_000_000, used: 0, threshold: 4_000_000},
300 => %{granted: 60_000, used: 0, threshold: 48_000} # milliseconds
}

Usage Monitoring per Bearer:


Multiple Services Credit Control

MSCC (Multiple-Services-Credit-Control) AVP

Purpose: Group charging information for a specific service/rating group

Structure:

Multiple-Services-Credit-Control (Grouped, AVP 456)
├── Service-Identifier (Unsigned32, AVP 439)
├── Rating-Group (Unsigned32, AVP 432)
├── Requested-Service-Unit (Grouped, AVP 437)
│ ├── CC-Time (Unsigned32, AVP 420)
│ ├── CC-Total-Octets (Unsigned64, AVP 421)
│ ├── CC-Input-Octets (Unsigned64, AVP 412)
│ └── CC-Output-Octets (Unsigned64, AVP 414)
├── Used-Service-Unit (Grouped, AVP 446)
│ └── [Same structure as Requested-Service-Unit]
├── Granted-Service-Unit (Grouped, AVP 431)
│ └── [Same structure as Requested-Service-Unit]
├── Validity-Time (Unsigned32, AVP 448)
├── Result-Code (Unsigned32, AVP 268)
└── Final-Unit-Indication (Grouped, AVP 430)
└── Final-Unit-Action (Enumerated, AVP 449)

Service-Identifier vs. Rating-Group

AttributeService-IdentifierRating-Group
PurposeIdentifies service typeIdentifies charging category
Example1=Data, 2=Voice, 3=SMS100=Regular, 200=Premium
GranularityBroad classificationSpecific tariff
RequiredOptionalRequired for charging
MappingMay map to multiple RGsSingle tariff in OCS

Example:

Service-Identifier: 1 (Data Service)
├── Rating-Group: 100 (Standard Data - $0.01/MB)
└── Rating-Group: 200 (Premium Data - $0.05/MB)

Service-Identifier: 2 (Voice)
└── Rating-Group: 300 (Voice Calls - $0.10/min)

Configuration

Basic Gy Configuration

Edit config/runtime.exs:

config :pgw_c,
gy: %{
# Enable or disable online charging globally
enabled: true,

# OCS connection timeout (milliseconds)
timeout_ms: 5000,

# Default quota request (bytes) if not specified by PCRF
default_requested_quota: 10_000_000, # 10 MB

# Threshold percentage for re-authorization
# (0.8 = trigger CCR-Update at 80% quota consumed)
quota_threshold_percentage: 0.8,

# Action when OCS timeout occurs
# Options: :block, :allow
timeout_action: :block,

# Action when OCS returns no credit
# Options: :terminate, :redirect
no_credit_action: :terminate,

# Redirect URL for top-up (used if no_credit_action: :redirect)
topup_redirect_url: "http://topup.example.com"
},
diameter: %{
listen_ip: "0.0.0.0",
host: "omni-pgw_c.epc.mnc999.mcc999.3gppnetwork.org",
realm: "epc.mnc999.mcc999.3gppnetwork.org",

# OCS peer configuration
peer_list: [
# PCRF for policy control (Gx)
%{
host: "pcrf.epc.mnc999.mcc999.3gppnetwork.org",
realm: "epc.mnc999.mcc999.3gppnetwork.org",
ip: "10.0.0.30",
initiate_connection: true
},
# OCS for online charging (Gy)
%{
host: "ocs.epc.mnc999.mcc999.3gppnetwork.org",
realm: "epc.mnc999.mcc999.3gppnetwork.org",
ip: "10.0.0.40",
initiate_connection: true
}
]
}

Configuration Parameters Explained

enabled

  • true: Online charging active, CCR messages sent to OCS
  • false: Online charging disabled, no Gy messages

timeout_ms

  • Time to wait for CCA response from OCS
  • Recommended: 3000-5000 ms

default_requested_quota

  • Default quota to request if PCRF doesn't specify
  • Typical values: 1-100 MB

quota_threshold_percentage

  • Trigger CCR-Update when this % of quota consumed
  • Recommended: 0.75-0.85 (75%-85%)
  • Higher = fewer messages, but risk of quota exhaustion
  • Lower = more messages, but safer

timeout_action

  • :block - Block traffic if OCS doesn't respond (safer, prevents revenue loss)
  • :allow - Allow traffic if OCS doesn't respond (better UX, revenue risk)

no_credit_action

  • :terminate - Delete bearer when credit exhausted
  • :redirect - Redirect to top-up portal

Environment-Specific Configuration

Production (prepaid subscribers):

config :pgw_c,
gy: %{
enabled: true,
timeout_action: :block,
no_credit_action: :terminate,
quota_threshold_percentage: 0.8
}

Test/Development:

config :pgw_c,
gy: %{
enabled: false # Disable for testing
}

Hybrid (some prepaid, some postpaid):

config :pgw_c,
gy: %{
enabled: true, # Controlled per-subscriber by PCRF
timeout_action: :allow, # Don't block postpaid on OCS failure
no_credit_action: :terminate
}

Message Flows

Successful Session with Online Charging

Quota Re-authorization (CCR-Update)

Credit Exhaustion (Final Unit)

OCS Timeout Handling


Error Handling

Result Codes

Success Codes:

CodeNameAction
2001DIAMETER_SUCCESSContinue with granted quota

Transient Failures (4xxx):

CodeNamePGW-C Action
4010DIAMETER_TOO_BUSYRetry with backoff
4011DIAMETER_UNABLE_TO_COMPLYLog error, may retry
4012DIAMETER_CREDIT_LIMIT_REACHEDTerminate or redirect

Permanent Failures (5xxx):

CodeNamePGW-C Action
5003DIAMETER_AUTHORIZATION_REJECTEDReject session
5031DIAMETER_USER_UNKNOWNReject session (invalid subscriber)

Per-Service Result Codes

Important: Result-Code can appear at two levels:

  1. Message level - Overall result
  2. MSCC level - Per-service result

Example:

CCA-Initial
├── Result-Code: DIAMETER_SUCCESS (2001) ← Message level: OK
└── Multiple-Services-Credit-Control
├── [Rating-Group: 100]
│ └── Result-Code: DIAMETER_SUCCESS (2001) ← RG 100: OK
└── [Rating-Group: 200]
└── Result-Code: DIAMETER_CREDIT_LIMIT_REACHED (4012) ← RG 200: No credit

PGW-C Behavior:

  • Allow traffic for Rating-Group 100
  • Block traffic for Rating-Group 200

Integration with Gx

The Gx interface (PCRF policy control) determines whether online charging is required and provides the Rating-Group that drives Gy charging. See Diameter Gx Interface for complete policy control documentation.

Gx and Gy Relationship

Integration Flow

1. Bearer Setup:

PGW-C receives Create Session Request

Send CCR-I to PCRF (Gx)

Receive CCA-I with PCC Rules

Parse PCC Rules:
- Does rule have Rating-Group?
- Is Online = 1?

If YES:
Send CCR-I to OCS (Gy) with Rating-Group

Receive CCA-I with quota

If quota granted: Proceed
If no credit: Reject bearer
If NO:
Proceed without online charging

2. Dynamic Policy Update (RAR from PCRF):

PCRF sends RAR (Re-Auth-Request) on Gx

New PCC Rule added with Online=1, Rating-Group=200

PGW-C sends CCR-U to OCS (Gy)
- Add MSCC for Rating-Group 200

OCS grants quota for new service

Install dedicated bearer with online charging

Troubleshooting

Common Issues

1. CCR-Initial to OCS Timeouts

Symptoms:

  • Sessions fail with "OCS timeout"
  • Log: "CCR-Initial (Gy) timeout"

Possible Causes:

  • OCS not reachable
  • Incorrect OCS IP in configuration
  • Firewall blocking Diameter port (3868)
  • OCS overloaded

Resolution:

# Test network connectivity
ping <ocs_ip>

# Test Diameter port (TCP 3868)
telnet <ocs_ip> 3868

# Check configuration
# Ensure OCS peer is configured in peer_list

2. Sessions Rejected by OCS

Symptoms:

  • CCA-I with Result-Code != 2001
  • Create Session Response fails

Common Result Codes:

Result CodeLikely CauseResolution
4012Credit limit reachedSubscriber needs to top-up
5003Authorization rejectedCheck subscriber permissions
5031User unknownProvision subscriber in OCS

Debug Steps:

  1. Check OCS logs for rejection reason
  2. Verify subscriber balance in OCS
  3. Check IMSI/MSISDN in CCR-I matches subscriber record

3. Quota Exhaustion Not Detected

Symptoms:

  • User continues using data after balance exhausted
  • No CCR-Update sent

Possible Causes:

  • URR (Usage Reporting Rule) not installed in PGW-U
  • Threshold not configured correctly
  • PFCP Session Reports not received

Debug Steps:

  1. Verify URR in PFCP Session Establishment:

    Create URR
    ├── URR-ID: 1
    ├── Measurement-Method: VOLUME
    ├── Volume-Threshold: 8000000 (8 MB)
    └── Reporting-Triggers: VOLUME_THRESHOLD
  2. Check PGW-U logs for usage reports

  3. Verify quota_threshold_percentage in config

4. Incorrect Rating-Group

Symptoms:

  • OCS rejects with "Unknown Rating-Group"
  • Sessions fail

Cause:

  • Rating-Group in CCR-I doesn't match OCS configuration
  • PCRF provisioned invalid Rating-Group

Resolution:

  1. Verify Rating-Group in PCC Rule from PCRF
  2. Check OCS configuration for valid Rating-Groups
  3. Ensure mapping between PCC Rules and OCS tariffs

Monitoring

Key Metrics

# Gy message rates
rate(gy_inbound_messages_total{message_type="cca"}[5m])
rate(gy_outbound_messages_total{message_type="ccr"}[5m])

# Gy error rates
rate(gy_inbound_errors_total[5m])

# Quota exhaustion events
rate(gy_quota_exhausted_total[5m])

# OCS timeout rate
rate(gy_timeout_total[5m])

# Gy message handling duration
histogram_quantile(0.95, rate(gy_inbound_handling_duration_bucket[5m]))

Alerts

# Alert on high Gy error rate
- alert: GyErrorRateHigh
expr: rate(gy_inbound_errors_total[5m]) > 0.1
for: 5m
annotations:
summary: "High Gy error rate detected"

# Alert on OCS timeout
- alert: OcsTimeout
expr: rate(gy_timeout_total[5m]) > 0.05
for: 2m
annotations:
summary: "OCS timeouts occurring"

# Alert on credit exhaustion spike
- alert: CreditExhaustionSpike
expr: rate(gy_quota_exhausted_total[5m]) > 10
for: 5m
annotations:
summary: "High rate of credit exhaustion"

Web UI - Gy Credit Control Simulator

OmniPGW includes a built-in Gy/Ro simulator for testing online charging functionality without requiring an external OCS.

Access: http://<omnipgw-ip>:<web-port>/gy_simulator

Gy Credit Control Simulator

Purpose: Test and simulate online charging scenarios for prepaid subscribers

Features:

1. Request Parameters

  • IMSI - Subscriber identity (e.g., "310170123456789")
  • MSISDN - Phone number (e.g., "14155551234")
  • Requested Units - Amount of quota to request (in bytes)
  • Service ID - Service type identifier
  • Rating Group - Charging category

2. CCR-I Simulation

  • Send CCR-Initial (Credit-Control-Request Initial)
  • Simulates initial quota request during session establishment
  • Tests OCS integration without live traffic

3. Use Cases

  • Development Testing - Test Gy interface during development
  • OCS Integration - Verify OCS connectivity and responses
  • Quota Testing - Test different quota scenarios
  • Troubleshooting - Debug charging issues
  • Demo - Demonstrate online charging to stakeholders

How to Use:

1. Enter subscriber details (IMSI, MSISDN)
2. Set requested units (e.g., 1000000 for 1 MB)
3. Configure Service ID and Rating Group
4. Click "Send CCR-I"
5. View OCS response and granted quota

Benefits:

  • No need for external OCS during testing
  • Quick validation of charging logic
  • Safe testing environment
  • Useful for training and demos

Charging and Policy

Session Management

Operations


Back to Operations Guide