All articles

Telecom

CDR billing explained

What a call detail record contains, how prefix rating actually works, and why increments and minimums cause more disputes than rates do.

Pixel Data Team30 June 20267 min read

A call detail record is the receipt a switch writes when a call ends. CDR billing is the work of turning several million of those a month into an invoice a customer will pay without querying it. This is how that works, and where it goes wrong.

What is in a CDR

Formats vary by switch, but the fields that matter for billing are consistent: when the call started, how long it lasted, who made it, what number was dialled, and which trunk or route carried it. FreeSWITCH and Asterisk both write considerably more than that, and most of it is useful for troubleshooting rather than billing.

The billing-relevant subset maps neatly onto a generic usage event: a timestamp, an account, a quantity in seconds, and a set of properties. Keeping the rest is still worth doing — the day you need to explain a charge, the codec and the trunk are what turn a guess into an answer.

Prefix rating, and why longest match wins

Destination numbers are rated by prefix. A tariff might contain rates for 44, 447 and 4479 — the United Kingdom, UK mobile, and a premium mobile band. A call to 447700900123 matches all three, and the correct answer is the longest one: 447.

This sounds obvious and is the single most common source of wrong invoices in telecom. A system that iterates a tariff in insertion order and takes the first match will bill UK mobile at the UK fixed rate, quietly, for as long as nobody checks. The difference is small per call and substantial per month.

match_key,rate,increment,minimum,event_type
44,0.000180,60,60,call
447,0.000420,1,30,call
4479,0.000870,1,30,call

Note that the increment and minimum differ per line, not per tariff. UK fixed bills per minute with a one-minute minimum; UK mobile bills per second with a thirty-second minimum. Both are normal, and both are on the same plan.

Increments and minimums cause more disputes than rates

Customers understand rates. They rarely understand why a 61-second call cost the same as a 120-second one, and if your invoice does not explain it, they will assume an error rather than a billing increment.

The order of operations matters and should be written down somewhere your support team can find it: round the duration up to the increment, then apply the minimum if the rounded value is below it, then multiply by the rate, then round the money once. Doing the minimum before the increment produces different — and wrong — answers on short calls.

A zero-second call should rate as zero, not as the minimum. Failed call attempts are recorded by most switches, and billing them is a fast way to lose a customer's trust.

Plan versions, and why you never edit a tariff

Rates change. When they do, the correct approach is a new plan version with an effective-from date, not an edit to the existing one. An event is rated against the version that was live at the moment it happened.

This is what makes an old invoice reproducible. If you edit a tariff in place, last March's invoice can no longer be recalculated, and the audit trail is gone. When someone queries a charge from six months ago — and they will — you want to be able to reproduce it exactly rather than explain why you cannot.

The awkward cases

  • Calls spanning midnight at a period boundary. Which month do they belong to? Pick a rule, write it down, and apply it consistently — the answer matters less than the consistency.
  • Late CDRs. A switch that was offline for a day will deliver a day of records at once. They must rate into their own period, against the plan version that was live then.
  • Duplicates. Retries and replays happen. A client-supplied identifier and a deduplication window are the standard defence.
  • Clock skew. A CDR timestamped in the future is a symptom, not a record. Reject the clearly wrong and flag the marginal.
  • Tariff gaps. If no line matches, the correct behaviour is to hold the event as unrated and tell someone — never to bill it at zero.

What makes an invoice defensible

A defensible invoice is one where any line can be traced to the events behind it, and any event can be traced to the arithmetic that priced it: the recorded duration, the increment applied, the minimum if it applied, the matched prefix, the rate, and the plan version.

If your system can produce that for any charge, billing disputes become short. If it cannot, every dispute is a research project, and the pressure will be to issue a credit and move on — which is the expensive answer repeated indefinitely.

Pixel Data does this for you

Usage metering, rating with penny-level drill-down, and supplier invoice reconciliation — installed with one command. The sandbox is open with no signup if you would rather look than read.

Get the next one by email

A few times a month, on usage metering, rating and reconciliation. Written by the people building it, and genuinely useful even if you never buy anything.

One click to unsubscribe. We do not sell or share the list, and we will not use it to sell you anything you did not ask about.