Skip to content

Call cost rounding and precision

Every call cost is rounded once, when the call is rated, to the number of decimals set on the tariff or the vendor. That rounded amount is what goes into the CDR and what is taken from or added to the balance. Set the precision to match how you invoice, and set it on vendors to match how they invoice you, so that your totals agree with theirs to the cent.

Screenshot "concepts/tariff-advanced-parameters" has not been generated yet — see scripts/screenshots/screens.yml.
  1. The switch calculates the exact cost. Connect fee, intervals, free seconds and surcharge give a cost with many decimals. See Rating and billing.
  2. It rounds the cost to the precision of the price list. For the account and every customer above it, the Cost Decimal Precision and Calls Cost of their tariff apply. For the vendor, the same two fields of the vendor apply.
  3. It writes the rounded cost. The CDR stores the rounded amount and the balance changes by exactly that amount.

Cost Decimal Precision is the number of decimals kept, from 0 to 20. The default for new tariffs and vendors is 20, which in practice means no rounding. You change the defaults in System Management → System Parameters → Billing with Tariffs Cost Precision and Vendors Cost Precision; existing tariffs and vendors keep their own value.

Calls Cost selects the rounding method:

Cost before rounding Round, precision 2 Round-Up, precision 2 Precision 20
1.0123456789012345678811 1.01 1.02 1.01234567890123456788
1.0153456789012345678899 1.02 1.02 1.01534567890123456789
1.0173456789012345678899 1.02 1.02 1.01734567890123456789

Round rounds to the nearest value. Round-Up never rounds down, so a call never costs less than its exact price; with a short call and a low precision the difference can be large compared to the price of the call.

The panel shows money with the number of decimals set in Display Precision, from 0 to 10, in System Management → System Parameters → Web Interface. It changes only what you see in lists, reports and forms. Stored prices and costs keep their full precision. Raise it when you sell per-second rates such as 0.0035 and the lists show 0.00.

Screenshot "operations/web-interface" has not been generated yet — see scripts/screenshots/screens.yml.
  • Tariff — a named set of rates that defines how calls are priced for a customer (customer tariff) or a vendor (vendor tariff).
  • Vendor — a carrier you terminate calls to. Vendors have connections and are rated with a vendor tariff.
  • CDR — call detail record: one row per call with time, duration, destination, cost and disconnect cause.
  • Balance — current amount of money on a customer or account. Negative values mean debt within the credit limit.
  • Billing increment — the interval in seconds (e.g. 60/1, 1/1, 30/6) used to round call duration when rating.

Your invoices show cents, but CDR totals differ by a few cents

Section titled “Your invoices show cents, but CDR totals differ by a few cents”

With the default precision of 20, each CDR keeps fractions of a cent and the invoice rounds only the total. Set Cost Decimal Precision to 2 on the tariff if each call must be charged in whole cents, or keep the full precision and accept that the invoice total is rounded once.

The vendor’s invoice is higher than your vendor CDRs

Section titled “The vendor’s invoice is higher than your vendor CDRs”

The vendor probably rounds each call up. Set Calls Cost to Round-Up and Cost Decimal Precision to the vendor’s precision, often 4, on the vendor. Check Calls Duration on the vendor too: it rounds fractions of a second Round or Round-Up before the intervals are applied.

The price is stored correctly; the display rounds it. Raise Display Precision.