Home/Platform/CDR mediation & rating

SS-36 · Usage foundry · 22 operations

CDR mediation & rating

Exactly-once CDR ingest, leg correlation, rate decks with billed-second rounding, durable spool and re-rating.

22
operations
exactly-once
CDR ingest
never-discard
suspense
re-rate
windowed

What it does

CDR mediation & rating — the depth.

The carrier-grade usage foundry behind every bill and dashboard. CDRs are ingested exactly once — dedup on record_id makes outage replay safe — and a record carrying a correlation_id is held pending until its call legs are folded under survivorship. Rating runs against versioned rate decks with peak/off-peak bands and billed-second rounding, with deterministic breakdowns, a rate-change audit trail and windowed re-rating. When the rating sink is down, CDRs are spooled durably and replayed; anything with no rate card is parked in never-discard suspense with repair/quarantine the only exits. Per-source reconciliation opens a revenue-assurance case on any leakage, and every record has a full auditable journey for dispute reconstruction.

Sub-capabilities · real endpoints

Every capability maps to a real method + path.

Exactly-once ingest & leg correlation

Ingest a CDR (dedup + idempotency on record_id); a repeat collapses to duplicate and is never re-rated. Records sharing a correlation_id are held pending until /correlate folds the legs under survivorship. Rate cards are upserted per usage type.

  • POST/api/v1/cdr
  • POST/api/v1/cdrs
  • POST/api/v1/correlate/{cid}
  • PUT/api/v1/ratecards/{type}

Rate decks — peak/off-peak, billed-second rounding

Load and read a versioned rate deck; rate a CDR deterministically against the current deck (peak/off-peak bands, billed-second rounding), read the rate-change history, and re-rate stored CDRs in a window against a new deck version.

  • GET/api/v1/rating/deck
  • POST/api/v1/rating/deck
  • POST/api/v1/rating/rate
  • GET/api/v1/rating/history
  • POST/api/v1/rating/rerate

Durable spool & re-rating

Toggle the tenant's rating sink; when it's down CDRs are spooled, listed, and drained (each re-rated) on replay. Reprocess re-runs mediation over a set of records.

  • POST/api/v1/cdr/sink
  • GET/api/v1/cdr/spool
  • POST/api/v1/cdr/replay
  • POST/api/v1/reprocess

Never-discard suspense & reconciliation

Records with no rate card land in suspense (never dropped) with repair or quarantine the only exits; suspense health is exposed. Per-source reconciliation compares switch counts to rated records and opens RA cases; every record exposes its journey.

  • GET/api/v1/suspense
  • GET/api/v1/suspense/health
  • POST/api/v1/suspense/{id}/repair
  • POST/api/v1/suspense/{id}/quarantine
  • GET/api/v1/reconcile
  • POST/api/v1/reconcile/source
  • GET/api/v1/reconcile/cases
  • GET/api/v1/cdrs/{id}/journey

Worked example

A two-leg call, correlated and rated

Ingress and egress legs of one call are ingested, folded under survivorship, and rated against the current deck.

1Ingest APOST/api/v1/cdrsThe ingress leg arrives with a correlation_id; held pending, never rated alone.
2Ingest BPOST/api/v1/cdrsThe egress leg arrives; dedup on record_id guards against replay double-counting.
3CorrelatePOST/api/v1/correlate/{cid}Legs are folded into one canonical event; survivorship picks the authoritative fields.
4RatePOST/api/v1/rating/rateRated against the deck: peak band, billed-second rounding, deterministic breakdown.
5JourneyGET/api/v1/cdrs/{id}/journeyThe full auditable journey is available for any later dispute or reconciliation.

Architecture placement

Where it sits in the platform.

SS-36 is the source of billable truth: SS-40 voice and SS-18 messaging emit CDRs to it, it rates them, and publishes mediation.rated.v1 on the SS-03 bus so SS-10 charging and SS-38 RA consume the same facts. Ingest is exactly-once, mutations audit-chained (ADR-0014), and every route is tenant-scoped (ADR-0019 — no operator, no usage).

Depends on

SS-40 voice (CDRs)SS-18 messaging (usage)SS-03 bus

Feeds

SS-10 charging (rated facts)SS-38 RA (reconcile)SS-60 finops