mediation

Rust · zero I/O · no async · no clock

The arithmetic between a telecom network and a billing system.

mediation normalises, deduplicates, correlates and reconciles usage records from mobile and fixed-line networks — and proves it lost none. Octets, seconds and events out; pricing stays with your rater.

cargo add mediation

Every record reaches exactly one outcome.

carried_in + ingested == billable + suppressed + duplicate + rejected + held

A batch that does not balance is not released.

Built for the failures that reach invoices

Local time, quarter-hour offsets

A CDR timestamp is local time plus an offset that varies per record (TS 32.298).

Time →

Integer quantities

Octets are u64, seconds u32. No float, anywhere.

Quantities →

Billed once, lost never

Natural-key deduplication, wrap-safe sequence gaps, held partial runs.

Completeness →

Fixed-line voice

Dial strings to destinations, Call-ID keys, the § 11 TDDDG itemised bill.

Fixed-line voice →

One pass over a batch

let mut state = ProcessState::new(DedupWindow::from_bound(Duration::days(7)).unwrap());

let outcome = process(
    &Batch::new(&records),
    &ProcessConfig::default(),
    datetime!(2026-07-28 12:00:00 UTC),
    &mut state,
);

assert!(outcome.reconciliation().balances());
for gap in outcome.sequence_gaps() {
    eprintln!("resend {:?} from {}", gap.missing, gap.node);
}

State is caller-owned and passed in, so a replay in five years gives the same answer.

How the pass works

Scope

In

  • Validated identities — IMSI, MSISDN, IMEI, SUPI (incl. wireline), SUCI, PLMN
  • Deduplication, sequence gaps, partial reassembly, correlation
  • Wire codecs — BER, TBCD/BCD, AddressString, PLMN, ULI
  • Dial plans and destination classes
  • Validation rules V01–V21, release gate, conservation law
  • Roaming reconciliation, EU/German regulatory arithmetic, fraud evidence

Out

  • Collection — transports are I/O
  • Rating — no currency or tariff type exists here
  • Online charging — a live conversation with a CHF
  • Orchestration — no scheduler, queue or store