User Tools

Site Tools


api:pbx:cdrhistory

API : PBX : CDR History

Request

This request returns details about the path a call took through the PBX.

There are two ways to address a call. Prefer the callRef form: it is the only one that works for a call leg created by a transfer, and it returns the whole call rather than one leg of it.

Only the history of customers the user has access to is returned. Numbers the CDR list hides are hidden here as well - see Hidden numbers below.

URL https://api.telecomx.dk/pbx/cdrhistory/ref/CALL-REF
Method GET
Access level VIEWER, MANAGE, OWNER if calls belongs to the customer
RESELLER if customer belongs to the reseller
or ADMIN.
Params CALL-REF callRef of the call, from the CDR record. URL-encode it - it contains a colon.

Returns the history of every leg of the call merged into one timeline, ordered by date. The remaining top-level fields are those of the call's first leg.

URL https://api.telecomx.dk/pbx/cdrhistory/CALL-ID
Method GET
Access level VIEWER, MANAGE, OWNER if calls belongs to the customer
RESELLER if customer belongs to the reseller
or ADMIN.
Params CALL-ID SIP Call-ID of the call.

Returns the history of the single leg the call arrived on. Only calls that arrived over SIP have a Call-ID; a leg the PBX created itself has none, so this form cannot address it. Use it for calls handled before call grouping was introduced, which have no callRef.

Query examples

https://api.telecomx.dk/pbx/cdrhistory/ref/pbx12.telecomx.dk%3A1787811065.192529
https://api.telecomx.dk/pbx/cdrhistory/f378478ghuidhu3y8fghiufdgiueyufhguerguio

Response

JSON object
_id Id Unique Id of the CDR History item.
callId String Call-ID from SIP. Empty on a leg the PBX created itself.
callRef String Grouping key shared by every leg of the same physical call - see CDR. Null on calls handled before call grouping was introduced.
logged Date Date and time when this record was logged. Also used for auto-expire.
pbx String Hostname of the PBX server that handled the call.
customer Id Id of customer the caller belongs to or callee called into.
history Array List of events during the call.
history.date Date When the event occurred.
history.action String Human readable description of what happened. A hidden number or name is replaced by [hidden].
history.callerNumber String Callers number. Blank or n/a when hidden, see Hidden numbers.
history.callerName String Callers name, if available.
history.callerExtension Id Id of callers extension, if call originated from a SIP or mobile phone.
history.calleeNumber String Callee's number. Blank or n/a when hidden, see Hidden numbers.
history.calleeName String Callee's name, if available.
history.calleeExtension Id Id of callee's extension, if call terminated on a SIP or mobile phone.

Example

{
  _id: ObjectId('12345789012457890ABCD'),
  callId: 'f737tye73yt8hefv7ebvg@192.168.0.2',
  callRef: 'pbx1.telecomx.dk:4657574.341',
  logged: ISODate('2018-01-01T00:00:00.000Z'),
  pbx: 'pbx1.telecomx.dk',
  customer: ObjectId('12345678901234567890AAAA'),
  history: [
    {
      date: ISODate('2018-01-01T00:00:00.000Z'),
      action: 'Call answered',
      callerNumber: '+4570305050',
      callerName: 'Telecom X',
      callerExtension: null,
      calleeNumber: '+4570305060',
      calleeName: 'Acme Soap and Shampoo',
      calleeExtension: ObjectId('1234567890123457890FEDE')
    },
    {
      ...
    }
  ]
}

Errors

Error code Message Description
404 callId Call ID not found, no Call-ID was given, or the call belongs to a customer the user has no access to
404 callRef Call not found, no callRef was given, or the call belongs to a customer the user has no access to
403 access_denied Insufficient access level
500 internal_error <Unspecified>

Hidden numbers

(Changed 28-09-2026.) The call history applies the same privacy rules as the CDR list:

  • Secret numbers. An external caller who withheld their number (caller.privacy on the CDR) is

only shown to TX staff (RESELLER_ADMIN and ADMIN). For everybody else their number and name are blank

  in ''callerNumber''/''callerName'' - and in ''calleeNumber''/''calleeName'' where a transfer made them
  the callee of a leg - and replaced by ''[hidden]'' in ''action'', which quotes numbers and names
  verbatim. A caller on one of the customer's own extensions is never hidden.
* **Sensitive numbers.** A call to or from 112, 114, 116111 or 1888 is only shown to ADMIN. For everybody
  else the number is **n/a**, the name is blank and the number is replaced by ''[hidden]'' in ''action''.
* **CPR numbers** picked up as a caller or callee name are removed for everybody.

Whether a caller is secret is recorded on the call's CDR, not in the history. A history whose CDR can no longer be found is therefore refused with 404 for users below RESELLER_ADMIN, rather than served unchecked.

api/pbx/cdrhistory.txt · Last modified: by Telecom X AI

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki