How a call is actually rated
"$0.012 a minute" is not a rate: it is a loose number. A real carrier rate has four fields, and all four change the result:
- Prefix. The destination resolves by longest match: if both
52(Mexico) and521(mobile) exist, a number starting 521 is charged with the second. A badly ordered table charges mobiles at landline prices, which is the most expensive leak there is. - Billable minimum. The least you charge if the call connects: typically 30 or 60 seconds.
- Increment. The step it rounds to after the minimum: 1, 6 or 60 seconds. A 60/60 and a 1/1 on the same rate produce very different invoices.
- Connection charge. A fixed amount per answered call, independent of duration. Rare on the sell side, common on the buy side.
The rule that sums it all up: you have to charge your customer with a scheme at least as protected as the one your supplier applies to you. If you buy 60/60 and sell 1/1, every 12-second call is paid as 60 and charged as 12. That does not show up in per-minute margin: it shows up on the statement.
Why "real time" is not marketing
There are two ways to draw down a balance, and only one survives a bad-faith customer or a runaway dialer:
- At teardown. Simple to build. With 200 simultaneous calls open to an expensive destination, a $10 balance turns into a few hundred in debt before the first one hangs up.
- During the call. The switch reserves credit on answer and consumes it while the call runs. When it runs out, it cuts. The maximum possible debt is known and bounded.
The second is the only one compatible with selling prepaid to someone you do not know.
The six leaks
1. The unordered prefix table
Overlapping prefixes resolved by insertion order instead of by length. You catch it by taking a handful of real numbers per country and comparing the rate the switch applied against the one it should have.
2. Asymmetric minimum and increment
Described above. It is the number-one leak in new operations, because the sell rate gets copied from a competitor without looking at the buy rate.
3. Rounding to two decimals
A 6-second call at 0.0098 is worth 0.00098. Rounded to two decimals, it is worth zero. At dialer volume, "zero" is thousands of free calls a day. The system has to store and accumulate at the rate's precision — six decimals or more — and round only when issuing the invoice.
4. The cheap route with no margin
Cost 0.0098, sell 0.0100. LCR picks it because it is cheapest; the margin does not pay for the record. The defence is routing by minimum margin rather than minimum cost: if the route does not leave what you defined, move to the next.
5. Attempts that bill nothing but cost something
In dialer traffic, dozens of attempts per billed minute. They appear on no invoice, but they consume the switch and degrade your ASR with the carrier — which is what then determines the route quality you get.
6. The editable balance
If the balance lives in a column an UPDATE can change, there is no
accounting: there is a number. When a customer disputes their usage, the only solid
answer is a ledger that cannot be rewritten.
Balance as a ledger, not as a column
The right way to store money is the one accounting has used for centuries: append-only entries. The balance is not stored, it is derived from the sum of movements. Top-ups, usage, adjustments and credit notes are new rows; nothing is edited and nothing is deleted.
This can be enforced in the database, not only in the application: triggers that
reject UPDATE and DELETE on the entries table. The practical
difference is that not even the database administrator can alter a balance without
leaving a trace — and that any figure you show a customer can be rebuilt movement by
movement.
Reconciling against the carrier invoice
Every month the supplier's invoice arrives and has to be verified. That job takes hours or minutes depending on a single design decision: whether the CDR stores cost alongside sell.
- If it stores only the sell, reconciling means exporting, cross-referencing by prefix and date in a spreadsheet, and fighting the rounding.
- If it stores cost, sell and margin on the same row, it is one query grouped by carrier and destination — and the discrepancies surface on their own.
The same applies to the question that actually matters: which destinations make me money, and which am I carrying out of habit?
How NEXIA Switch handles it
NEXIA Switch rates in the same compiled core that decides routing, before the call goes out: it resolves the prefix by longest match, applies minimum, increment and connection charge, and reserves credit on answer. Balances live in an append-only ledger the database refuses to modify, and every CDR carries cost, sell and margin on the same row.
Rates load by bulk import from CSV or Excel, buy and sell, and the complete switch is free and permanent up to 100 concurrent calls.