CDR

CDR structure

The CDR is a list of attributes related to the processing and execution of a call leg. There are a number of properties that will always exist and a handful of fields that will conditionally exist, depending on the type of call made. There is also a sub-object, under the key 'Custom-Channel-Vars', that represent Conversant-specific key/value pairs.

Requests

There are only three GETs for CDRs

  • GET /v1/accounts/{account_id}/cdrs - Gets the current CDRs for the account
  • GET /v1/accounts/{account_id}/cdrs/{cdr_id} - Gets details of the CDR
  • GET /v1/accounts/{account_id}/users/{user_id}/cdrs - Gets the current CDRs for the user

Default Properties

These properties should appear in both the summary and detail view for all CDRs:

  • call_id - identifier for the call leg
  • call_direction - direction of the leg, relative to the media switch
    • inbound - leg came into the media switch (typically the A-leg)
    • outbound - leg started on the media switch (typically the B-leg)
  • duration_seconds - how long the call lasted
  • hangup_cause - The reason why the call leg ended.
  • timestamp - UTC timestamp (in gregorian seconds) of when the CDR was generated

Conditional Properties

The existence of these properties will vary depending on the nature of the call. This list is not meant to be exhaustive:

  • billing_seconds - How many seconds of the call are billable (post answer, normally)
  • callee_id_name - Name of the callee
  • callee_id_number - Number of the callee
  • caller_id_name - Name of the caller
  • caller_id_number - Number of the caller
  • channel_authorized - Boolean of whether the channel was authorized to continue
  • disposition - Information about how the leg ended
    • SUCCESS - The leg terminated, while bridged, normally (successfully)
    • ANSWER - The leg terminated normally without being bridged
    • ORIGINATOR_CANCEL - Caller hung up
    • DELAYED NEGOTIATION -
  • from - Depends on the direction of the leg
    • outbound - finds the value from the caller id number and realm if the SIP From URI is missing
    • inbound - Checks against the presence ID or From-URI if available
  • from_uri - the SIP From header
  • hangup_code - the SIP code of the hangup, if available
  • inception - From where was the call started
    • on-net - Call is from a known account's device
    • off-net - Call is from outside of the cluster
  • local_sdp - SDP information for the local (media server) side
  • media_server - The handling media server hostname
  • other_leg_call_id - if the call was bridged, the call-id of the other leg
  • other_leg_caller_id_name - Caller ID name of the bridged leg
  • other_leg_caller_id_number - Caller ID number of the bridged leg
  • other_leg_destination_number - The dialed number of the other leg
  • other_leg_direction - direction, relative to the media server, of the other leg (should be the opposite of call_direction).
  • presence_id - Presence ID used to send NOTIFYs if needed
  • remote_sdp - SDP information for the remote side (the endpoint's side)
  • request - SIP Request URI
  • ringing_seconds - how many seconds the endpoint was ringing before answering
  • to - Depends on the direction of the leg
    • outbound - Uses the presence-id or else it uses the SIP Request address
    • inbound - the SIP To header
  • to_uri - SIP To header
  • user_agent - User Agent of the endpoint
  • bridge_id - Bridge ID

Conversant-specific Properties

These are properties set by Conversant for internal purposes. These are the properties found under the custom_channel_varsproperty at the top-level of the CDR JSON object. The non-exhaustive list of properties:

  • account_id - Account ID this leg belongs to
  • authorizing_id - Document ID used to authorize this call leg
  • authorizing_type - Type of ducument used to authorize call
    • device - the call leg is to/from a known device
    • resource - the call leg is from a known offnet carrier
    • outbound_fax
  • bridge_id - Typically the A-leg's call-id; helps with tracking transfers
  • ecallmgr_node - Which ecallmgr node is processing the call leg
  • fetch_id - The dialplan XML fetch ID from FreeSWITCH
  • realm - the SIP realm of the account
  • resource_id - Resource ID used for the leg; typically a carrier, local or global, that the call was routed to
  • username - the SIP username of the endpoint that started the leg

Billing-related Properties

These properties relate to how the leg was rated and billed. Some of these properties are not accessible via Crossbar, but may exist on the CDR

  • reseller_billing - tag describing what billing was used for the reseller
  • reseller_id - Account ID of the reseller for the account of this leg
  • account_billing - tag describing what billing was used for the account
  • rate - Rate of the call
  • base_cost - How much the call costs to start (if per-minute)
  • rate_name - Name of the rate doc used
  • surcharge - Surcharge added to the leg
  • rate_minimum - Minimum number of seconds to bill for
  • rate_increment - Increment of seconds to bill for

Fax-specific Properties

These properties may exist on a CDR for a fax request (inbound or outbound):

  • fax_transfer_rate - Baud of the fax transfer
  • fax_bad_rows - Number of rows that failed to transfer
  • fax_total_pages - Number of pages in the fax (see fax_transferred_pages for how many made it)
  • fax_transferred_pages - Number of pages transferred
  • fax_ecm_used - Was ECM (error correction mode) used on the fax
  • fax_result_text - Error String, if any, or 'OK' if successful
  • fax_result_code - Result code of the transmission
  • fax_success - boolean for whether the fax was considered a success

Sample Requests

GET - Fetch account CDRs:

curl -v -X GET -H "X-Auth-Token: {AUTH_TOKEN}" http://server:8000/v1/accounts/{ACCOUNT_ID}/cdrs

GET - Fetch user CDRs:

curl -v -X GET -H "X-Auth-Token: {AUTH_TOKEN}" http://server:8000/v1/accounts/{ACCOUNT_ID}/users/{USER_ID}/cdrs

GET - Fetch a CDR:

curl -v -X GET -H "X-Auth-Token: {AUTH_TOKEN}" http://server:8000/v1/accounts/{ACCOUNT_ID}/cdrs/{CDR_ID}

GET - Fetch a time-range of CDRs

curl -v -X GET -H "X-Auth-Token: {AUTH_TOKEN}" http://server:8000/v1/accounts/{ACCOUNT_ID}/cdrs?created_from={FROM_TIMESTAMP}&created_to={TO_TIMESTAMP}

*tip All timestamps will be in Gregorian seconds (not Unix epoch). To convert from Unix timestamp, just add 62167219200.

GET - Fetch account CDRs in csv format:

curl -v -X GET -H "Accept: text/csv" -H "X-Auth-Token: {AUTH_TOKEN}" http://server:8000/v1/accounts/{ACCOUNT_ID}/cdrs