Server

Telecom Charging: Online vs Offline

By Prabath Thalangama· October 24, 2026· 4 min read
#telecom#charging#ocs

Introduction

Telecom charging splits into two worlds. Online (prepaid) must check and reserve credit before and during usage, in real time, or deny service. Offline (postpaid) records usage as it happens and bills later. Many networks run both, and a "convergent" system does both from one balance.

Offline charging (postpaid)

Usage generates CDRs (Call Detail Records) / EDRs at network nodes:

node (MSC / P-GW / IMS CSCF / SMSC)
   └─ writes CDR files  (call start/stop, volume, called number, cell, ...)
        └─ Rf Diameter (LTE/IMS) to a CDF/CGF, or file transfer
             └─ MEDIATION  (collect, normalise, correlate, dedup, filter,
                            enrich, aggregate partial CDRs into one)
                  └─ RATING  (apply tariff: this 4m call to that destination
                              at that time = $0.32)
                       └─ BILLING  (accumulate to the invoice, apply
                                    discounts/bundles, produce the bill)
  • No real-time constraint — the CDR can be processed minutes or hours later.
  • Mediation is the unglamorous heavy lifting: different vendors' CDR formats, partial CDRs for long sessions, deduplication, discarding test traffic.
  • The subscriber can go over their limit; the network finds out afterward (hence bill shock, and why postpaid needs credit checks / spend caps as a separate feature).

Online charging (prepaid) — the OCS

An Online Charging System holds the balance and must authorise usage in real time. The core mechanism is quota reservation, not per-event debit:

1. Call/session starts.
   Network node --- Diameter CCR-Initial (Ro / Gy) ---> OCS
   "user wants to call X / start a data session"

2. OCS rates the request, checks balance, RESERVES a quota:
   OCS --- CCA --- > node:  "granted 60 seconds"  (or 5 MB, or ...)

3. Node meters usage. Before the quota runs out:
   node --- CCR-Update ---> OCS: "used 58s, give me more"
   OCS --- CCA ---> node: "granted another 60s"   (debits the previous 58s)

4. Session ends:
   node --- CCR-Termination ---> OCS: "final: used 27s of the last grant"
   OCS refunds the unused reservation, commits the final charge.

Why reservations and not per-second debit: the OCS can't survive a Diameter round-trip per second per subscriber for millions of users. Granting chunks (time/volume) bounds the request rate. Grant size is a tuning trade-off — small grants = tighter credit control but more signalling; large grants = less signalling but more credit at risk if the node crashes.

Interfaces:

  • Ro — Diameter online charging for IMS / application servers (event or session based).
  • Gy — Diameter online charging for the P-GW/PCEF (data volume).
  • CAP (CAMEL) — the SS7-era equivalent for 2G/3G voice: the MSC triggers to the gsmSCF/OCS with InitialDP, gets ApplyCharging with a quota, reports back with ApplyChargingReport.
  • 5G: the CHF (Charging Function) with the Nchf SBI, doing both converged online and offline.

Rating

Rating turns raw usage into money using the tariff: destination zones, time-of-day, peak/off-peak, bundle allowances (use free minutes first), rounding rules, taxes. In online charging, rating happens inside the OCS at reservation time. In offline, a separate rating engine does it post-collection.

Convergent charging

One balance, both paths: a subscriber can have a prepaid balance and a postpaid bundle; the charging system decides per event which pool to draw from (free bundle → prepaid balance → postpaid accrual). Requires the OCS and the billing system to share the balance model.

Verification and troubleshooting

  • Prepaid call drops after ~1 minute — quota grant expired and the CCR-Update didn't get a new grant: OCS overloaded/unreachable, balance actually exhausted, or the node's re-authorisation timer misconfigured. Check the CCA Result-Code / Final-Unit-Indication.
  • DIAMETER_CREDIT_LIMIT_REACHED (4012) / DIAMETER_CREDIT_CONTROL_NOT_APPLICABLE (5030) — no balance, or the OCS has no rating plan for that service/destination.
  • Free minutes not applied — the OCS's bundle/allowance config, or the rating didn't match the call to the right zone (A-number/B-number normalisation).
  • Postpaid bill missing usage — CDR loss between node and mediation (file transfer gap), dedup being too aggressive, or partial CDRs for a long session not being stitched.
  • Double charging — a CCR retried after a slow CCA, and the OCS wasn't idempotent on the session id; or mediation ingested the same CDR file twice.
  • Data session: charged but bundle shows unused — Gy charging hit the balance directly because the PCRF/PCF didn't send the rating-group / bundle info in the Gx rules.
  • Reservation "leak" after a node crash — reserved-but-uncommitted quota not released; OCS session timeout should reclaim it — check the Session-Timeout / idle cleanup config.
PrabathStuck on something this site can't fix?Reach out to Prabath directly on LinkedIn.