Skip to main content
LaraCopilot records every call as a Call Detail Record (CDR) and matches it against a tenant-specific rate table to compute the cost. This gives you an auditable, per-second billing log that can drive invoicing, usage dashboards, and capacity planning without any external billing middleware.

Call Detail Records (CDRs)

A CDR is written at the end of every call and captures the full context needed to bill the call accurately. The fields stored on each Cdr record are:
duration_seconds is the actual call length. bill_seconds may differ because rates apply a billing_increment that rounds up to the nearest increment boundary (e.g. a 6-second increment means a 7-second call bills as 12 seconds).

Rates

Rates define the cost of calls to a given destination for a specific tenant. LaraCopilot matches an outbound destination_number against the rate prefix table to find the correct rate, then applies it to bill_seconds to produce cost.

Cost Calculation

The formula applied to each CDR is:
bill_seconds is already rounded up to the nearest billing_increment before this calculation runs, so the effective minimum charge per call is:
Use a billing_increment of 6 for modern telecom-style billing or 60 for simpler per-minute rounding. Smaller increments give callers a fairer cost at the expense of slightly more complex invoices.

API Reference

Retrieving CDRs

Returns all CDR records with their associated tenant and extension. Supports a search query parameter that filters on caller_number, destination_number, direction, and disposition.
Sample response

Managing Rates

Changing cost_per_minute or billing_increment on an existing rate does not retroactively recalculate historical CDRs. Old CDR costs are immutable once written.
Query GET /api/cdrs with a search filter to retrieve call records for a specific number or direction and generate usage reports for individual tenants.