Cdr

Fetch past calls — read-only. The SDK does not cache or persist results itself; call it again whenever you need fresh data.

const cdr = await kasookoo.getCdr({
    search: "Jane",           // optional — free-text search
    callerId: "user_123",     // optional — restrict to calls placed BY this user
    calleeId: "user_456",     // optional — restrict to calls placed TO this user
    skip: 0,                  // optional — pagination offset, defaults to 0
    limit: 20,                // optional — page size, a default applies if omitted; capped at 100 (larger values are clamped)
    dateField: "created_at",  // optional — which timestamp field results are filtered/sorted by
})

cdr.pagination.total   // total matching records (across all pages)
cdr.items               // this page's entries — see CdrEntry below

All filters are optional — call getCdr() with no arguments for the first page of everything.

CdrEntry

FieldDescription
id / call_id / room_nameIdentifiers for the call
directione.g. "outbound" / "inbound"
statuse.g. "ended", "waiting"
kindCall type, e.g. "pstn". A separate value space from Call.kind ("webrtc" | "sip") on the Calls page — this is the backend's own CDR vocabulary, not the client-side Call object's.
caller{ id, identity, name, email, phone_number, role, kind } — the side that placed the call. email, phone_number, role and kind may be null.
calleeSame shape as caller, or null while the call has no answering side yet (e.g. still "waiting").
participantsIdentities of everyone who joined the call
created_atISO 8601 timestamp
started_atISO 8601 timestamp, or null if the call hasn't started
ended_atISO 8601 timestamp, or null if the call hasn't ended
duration_secondsTalk time, or null if the call hasn't ended
end_reasonPresent when the call ended abnormally (e.g. an orphaned session auto-cleaned up)
recording_download_urlPresent only when the call was recorded

Downloading the full export

downloadCdr() fetches the export file (authenticated) and triggers a normal browser file save — nothing is returned to your code:

await kasookoo.downloadCdr({ maxRows: 1000 })   // maxRows is optional

The filename is taken from the server's response when it provides one, otherwise cdr-export.csv is used. Call it directly from a click handler (browsers are more permissive about file saves triggered by a user gesture).


Did this page help you?