Rating is how networks translate usage (MB, minutes, messages, API calls) into money in real time (online charging) or later in your bill (offline charging). It’s where network events meet commercial logic: plans, bundles, discounts, taxes, promos, even free social data.
In this post, I’ll take you from basics to deep-dive. We’ll keep it generic and standards-aware, not vendor-specific. I’ll use analogies, walk through worked examples with actual numbers.
If you stick around to the end, you’ll know exactly how a byte becomes a billing line item.
"A few weeks ago a friend messaged me: “I bought a 10 GB data pack at noon, started streaming at 12:05, paused at 1 pm, and by evening my balance was gone. Where did my gigabytes go?” That simple question opens the door to one of the most fundamental, misunderstood parts of telecom: rating"
What is rating, really?
In Plain-English Rating is the decision of “how much does this usage cost?” It looks at the event (what), the subscriber (who), context (when/where/how), and the commercial catalog (price plans, bundles, discounts), then returns a charge and optionally reserves or deducts balance.
Two big modes
Online charging: Real-time decision and balance reservation before usage is allowed. Think prepaid debit card swipes at a toll gate.
Offline charging: Usage is collected first, rated later. Think your electricity meter, with a bill at the end of the month.
Common usage types:
Session-based: Data sessions that run for minutes/hours with quotas and periodic updates.''
Event-based: One-shot events like an SMS, a voice call setup fee, or content purchase
Key Components (High Level)
- Network functions that detect usage:
- 4G: P-GW/SGW (data), MME, IMS/CSCF (voice/SMS).
- 5G: SMF/UPF (data), AMF, PCF, IMS for voice/SMS.
- Policy/charging control:
- 4G: PCRF (policy), OCS (online charging system), CGF (charging gateway for offline CDRs).
- 5G: PCF (policy), CCS/CHF (converged charging function exposing service APIs).
- BSS (Business Support Systems):
- Mediation: Collects, normalizes, enriches usage records.
- Rating engine: Applies tariffs, bundles, discounts, taxes.
- Balance manager: Wallets, allowances, reservations, expiries.
- Billing/invoicing: Aggregation, bill runs, payment, dunning.
- Product catalog: Offers, price plans, rules, validity.
A 10,000-foot architecture sketch
Offline charging = power meter. You consume, the meter spins, and later the utility bills you based on recorded usage.
Online charging (real-time) explained
Typical session flow (data example in 4G/5G):
--> Subscriber starts a data session.
--> Network asks the online charging system (OCS/CHF) for quota:
4G: Diameter Credit-Control-Request (CCR) on Gy with requested service units.
5G: Nchf_Converged Charging service call with subscriber and session context.
--> OCS/CHF runs rating rules:
Determine price and applicable allowance/bundle.
Reserve units (e.g., 10 MB) against subscriber balance.
Return quota and instructions to the network.
--> Network allows traffic up to the granted quota. Periodically (or upon consumption),
it reports back.
--> OCS/CHF deducts consumed units, extends more quota while balance lasts, '
or instructs to throttle/block when depleted.
KKey concepts in online charging:
Reservation vs. consumption: The OCS/CHF reserves an amount to avoid overspend. Consumption reports reconcile actual usage with reservation.
Unit types: Octets/bytes for data, seconds for voice, events for SMS/content.
Time-of-day, zone, app-based rules: Pricing can vary by time window, location, or traffic category (e.g., social zero-rating).
Discounts and rollover: Apply before/after base price, possibly using precedence rules.
Balance types: Monetary balance, volume bundles (MB/GB), time bundles (minutes), special-purpose wallets (e.g., roaming wallet).
Online Charging Loop
Offline charging (batch) explained Typical pipeline
-->Network emits usage files (CDRs/EDRs) periodically or at session end.
--> Mediation collects, de-duplicates, correlates partial records, and enriches with subscriber/product info.
-->Rating engine prices each record based on effective tariff at the time of use.
--> Billing aggregates charges, applies invoice-level discounts/taxes, and posts to accounts.
--> Invoices are generated; payments and dunning handled downstream.
Key concepts in offline charging
Partial records: Long sessions may be split (e.g., hourly) for reliability; mediation stitches or rates them piecewise.
Late usage: Records may arrive late; rating must be backdated to correct price.
Sequence integrity: Events must be ordered/validated to avoid duplicates or gaps.
Adjustments: Post-rated corrections, disputes, refunds.
A concrete example
Data session with bundles, time-of-day discounts, and tax Subscriber facts:
Plan: 5 GB monthly base data included.
Add-on: Social media pack, 2 GB, zero-rated for specific apps, expires end of month.
Out-of-bundle price: $0.01 per MB.
Happy hours: 50% price discount between 20:00–22:00 local time for generic data.
Tax: 10% VAT applied at the end.
Session timeline and usage:
19:55–20:10: 350 MB video streaming (generic data, not social).
20:30–20:45: 200 MB video.
21:15–21:25: 100 MB social app (eligible for social pack).
22:30–22:40: 150 MB video.
Effective rating rules:
Rule 1: Consume from social pack first for eligible traffic; price $0.00 until pack exhausted.
Rule 2: Consume from base 5 GB next, price $0.00 until exhausted.
Rule 3: Out-of-bundle at $0.01/MB; apply 50% discount within 20:00–22:00 window only for out-of-bundle, not for free bundle use.
Walkthrough
Session 1:
19:55–20:10: 350 MB generic.
Time crosses into 20:00 at minute 5.
Bundles before discounts: Since it’s generic, not social, apply base 5 GB free.
Bundle balance before: 5,000 MB.
Deduct 350 MB => remaining base bundle = 4,650 MB.
Charge = $0.00 (bundle), no tax impacted now.
Session 2:
20:30–20:45: 200 MB generic.
Base bundle remaining: 4,650 MB, still not exhausted.
Deduct 200 MB => remaining base bundle = 4,450 MB.
Charge = $0.00.
Session 3:
21:15–21:25: 100 MB social.
Eligible for social pack.
Social pack remaining: 2,000 MB.
Deduct 100 MB => remaining social pack = 1,900 MB.
Charge = $0.00.
Session 4:
22:30–22:40: 150 MB generic.
Time is outside happy hours (ends 22:00).
Base bundle remaining: 4,450 MB, still available.
Deduct 150 MB => remaining base bundle = 4,300 MB.
Charge = $0.00.
Total charge for the day: $0.00 before tax, $0.00 after tax. Total bundles left: Base 4,300 MB; Social 1,900 MB.
Now let’s tweak to trigger out-of-bundle
Assume the base 5 GB is already fully used before 19:55 (0 MB left).
Social pack still 2,000 MB.
19:55–20:10: 350 MB generic.
No base bundle. Not social. Out-of-bundle applies.
5 minutes pre-20:00 (~117 MB) and 10 minutes post-20:00 (~233 MB) if traffic is uniform.
Pre-20:00: 117 MB at $0.01 => $1.17 (no happy hour).
20:00–20:10: 233 MB at $0.01 with 50% discount => $1.165 -> $0.5825.
Subtotal = $1.7525.
20:30–20:45: 200 MB generic within happy hours.
200 MB at $0.01 with 50% discount => $2.00 -> $1.00.
21:15–21:25: 100 MB social.
Charge $0.00; social pack now 1,900 MB.
22:30–22:40: 150 MB generic, outside happy hours. 150 MB at $0.01 => $1.50.
Total pre-tax = $1.7525 + $1.00 + $0.00 + $1.50 = $4.2525. Tax 10% = $0.42525, rounded per billing rules (say to nearest cent): $0.43.
Grand total = $4.25 + $0.43 = $4.68 (exact rounding policy may vary).
How online charging would handle it in real time
At 19:55: Network requests quota.
OCS rates at out-of-bundle price, recognizes part will cross into discounted window, but practically, OCS will issue a short quota (say 20 MB/60s) to match time windows and re-evaluate every interval. This keeps rating accurate as the time-of-day changes.
At 20:00: Next quota grant will apply the 50% discount automatically based on current time window.
For social traffic at 21:15: Traffic is categorized (via traffic detection rules) and matched to the social wallet; OCS reserves from the social pack at $0.00.
At 22:30: Out of happy hours; OCS switches back to full out-of-bundle rate for new quota.
How offline charging would handle the same day
--> Network generates CDRs with start/stop times and usage volumes.
--> Mediation splits or annotates usage across time windows (pre/post 20:00).
--> Rating engine applies relevant prices per segment, then taxation.
The result appears on the monthly bill.
How this feels to the subscriber
Online charging: Instant feedback—data stops when out of balance; notifications help you top up.
Offline charging: Smooth usage experience, but “bill shock” risk if notifications or spend controls aren’t set up. Many operators blend both: online for mobile data and offline for monthly invoicing.
Another example: Voice and SMS quick examples
Voice call:
Tariff $0.05 per minute, 60-second pulse, connection fee $0.10.
2 minutes 10 seconds call: Billed duration = 3 minutes.
Charge = $0.10 + (3 × $0.05) = $0.25, then tax as per jurisdiction.
SMS:
$0.02 per SMS, bundle 100 SMS per month.
If you send the 101st SMS: Charge = $0.02.
If it’s a premium SMS shortcode, different price category may apply.
Putting it together
A common order of operations (varies by operator, but this is a reasonable mental model):
Eligibility filtering: Is the event chargeable? Any zero-rate rules (e.g., emergency numbers)?
Balance selection: Pick the most specific eligible wallet first (e.g., app pack, then base bundle).
Price determination: If no wallet covers it, choose the right price based on service, time, zone.
Discounts/Promos: Apply applicable percentage or absolute discounts in defined order.
Rounding: Round unit prices per configured rounding rules (banker’s, up, down).
Taxation: Apply tax on the final net charge.
Posting: Deduct balances and/or create rated charges for billing.
Now, deep dive
Online charging internals Key subcomponents you’ll typically find:
Session manager: Tracks each active session’s granted and consumed units.
Rating engine: Evaluates rules against subscriber context and event attributes.
Balance manager: Locks/reserves units, handles expiry, shared group wallets.
Quota policy: Decides how much to grant per request (time/volume/monetary).
Notification manager: Informs subscribers about thresholds (e.g., 80%, 100% usage).
Offline rating pipeline Mediation essentials
Collection: Secure File Transfer Protocol (SFTP), message bus, or HTTP-based Application Programming Interface (API) ingestion.
Normalization: Map vendor-specific fields to a common schema.
Correlation: Merge partial records, de-duplicate, and order by timestamps.
Enrichment: Add product identifiers, roaming zones, subscriber type.
Validation: Drop malformed records; route to suspense for manual review.
Rating engine in batch
Time slicing: If a long session spans a mid-month plan change or time-of-day price window, slice at those change points and rate each slice properly.
Tariff resolution: Find the effective tariff version at the event time.
Currency handling: Apply roaming currency conversion if needed.
Promotions: Apply only those valid at the event time.
When you roam, the visited network produces records (for example, Transferred Account Procedure, abbreviated TAP, files defined by GSMA) that your home operator rates and bills you for.
Online roaming may involve home-based charging with real-time credit control across networks, or fallback to offline settlement. Rating rules often differ by zone (for example, Zone 1 = 0.03 USD/MB, Zone 2 = 0.10 USD/MB). The principles remain the same; more context fields enter the rating decision.
5G-specific notes
Converged Charging: 5G introduces the Converged Charging System (CCS) and service-based APIs (SBI). Network functions invoke Nchf_ConvergedCharging on the Charging Function (CHF). This converges online and offline models, simplifying rule reuse.
Event richness: 5G can factor in slices and Quality of Service (QoS) flows (for example, premium low-latency slice priced differently).
Exposure: Charging can be more granular (for example, application-level charging) via standardized APIs.
A simple pseudo-algorithm for rating that you can translate this to any language for prototyping.
function rateEvent(event, subscriber): rules = getActiveRulesAt(event.time) eligibleWallets = selectWallets(subscriber, event, rules)
if eligibleWallets not empty: wallet = pickMostSpecific(eligibleWallets)
unitsToDeduct = min(event.units, wallet.remaining)
wallet.remaining -= unitsToDeduct
charge = 0
remainder = event.units - unitsToDeduct
else: remainder = event.units charge = 0
if remainder > 0:
basePrice = priceLookup(event, rules)
discount = discountFor(event, rules) // e.g., 50% during happy hour netPrice = basePrice * (1 - discount) charge += remainder * netPrice
tax = taxFor(subscriber.region, event.time, charge) total = charge + tax return {walletsUpdated, charge, tax, total}
Common pitfalls and how to avoid them
Mixing reservation and charge: Reserved units aren’t billed until consumed; reconcile at each update.
Ignoring time slicing: When sessions cross price windows or plan change dates, slice and rate per slice.
Double-discounting: Define clear precedence. Example: zero-rating/bundles first, then percentage discounts, then taxes.
Latency in online: Large quota grants can misprice time-sensitive discounts; too small grants hurt user experience. Tune per traffic type.
Shared balances: Ensure atomic wallet updates to avoid negative balances under concurrency.
Notifications: In online charging, configure threshold alerts (for example, 80% and 100%) to prevent “bill shock.”
A short checklist to design a rating solution
Define event taxonomy: data, voice, SMS, content, roaming, slice/QoS.
Map context drivers: time, zone, app category, device, subscriber segment.
Establish rule precedence: zero-rating > wallets > base price > discounts > tax.
Decide charging mode per service: real time, batch, or hybrid.
Plan policy interactions: throttling, blocking, and QoS changes when balances deplete.
Design for change: versioned tariffs, future-dated offers, graceful mid-session changes.
Build observability: per-session traces, rating logs, and reconciliation reports.
Summary
Rating is the heartbeat of telecom monetization.
Online charging is your real-time gatekeeper, ensuring sessions are allowed only when balances cover them, while offline charging turns usage into billable line items later with rigorous mediation and batch rating.
The core mechanics are universal: classify usage, apply the most specific wallet, determine price, apply discounts, compute taxes, and post. Whether it’s 4G’s OCS over Diameter Credit-Control or 5G’s Converged Charging via Nchf_ConvergedCharging, the mental model remains the same.
Abbreviations glossary (quick reference)
- 3GPP: 3rd Generation Partnership Project
- 4G/5G: Fourth/Fifth Generation mobile networks
- AMF: Access and Mobility Management Function (5G)
- API: Application Programming Interface
- APN: Access Point Name (4G)
- BSS: Business Support Systems
- BPMN: Business Process Model and Notation
- CCA: Credit-Control Answer (Diameter Credit-Control)
- CCR: Credit-Control Request (Diameter Credit-Control)
- CDR: Call/Charging Detail Record
- CCS: Converged Charging System (5G)
- CGF: Charging Gateway Function
- CHF: Charging Function (exposed via Nchf in 5G)
- CSCF: Call Session Control Function (in IMS)
- DNN: Data Network Name (5G)
- EDR: Event Detail Record
- GB/MB: Gigabyte/Megabyte
- GL: General Ledger
- GSMA: GSM Association
- IMS: IP Multimedia Subsystem
- MB/GB: Megabyte/Gigabyte
- MME: Mobility Management Entity (4G)
- OCS: Online Charging System
- PCF: Policy Control Function (5G)
- PCEF: Policy and Charging Enforcement Function (in P‑GW)
- PCRF: Policy and Charging Rules Function (4G)
- P‑GW: Packet Data Network Gateway (4G)
- QoS: Quality of Service
- RAN: Radio Access Network
- RFC: Request for Comments (Internet standards series)
- SBI: Service-Based Interface (5G architecture)
- S‑GW: Serving Gateway (4G)
- SMF: Session Management Function (5G)
- SMS: Short Message Service
- TAP: Transferred Account Procedure (GSMA roaming billing files)
- TDF: Traffic Detection Function
- UE: User Equipment
- UPF: User Plane Function (5G)
- VAT: Value Added Tax



Comments
Post a Comment