View Categories

CDR-Request API

15 min read

Request Call Detail Records (CDRs):

Method to request CDRs (Call Detail Records) for a specified period of time. Note that those are raw data CDRs written for each call leg. The data that can be found in the section STATISTIKEN in customer portal is based on data that has already been aggregated, meaning that all the CDRs corresponding to a specific call have already been combined into a single CDR.

POST https://api.tenios.com/cdrs/retrieve

Request Parameters:

access_key String The api access_key. You can find it in unter menu item Account Data, section API in the customer portal.
start_date_from The start date of the period over which you want to request CDRs.
start_date_to The end date of the period over which you want to request CDRs
page The page number to request.
page_size The page size, e.g. the number of CDRs included in a page.

 

Output parameters:

answer_stamp The time and date when the call was answered.
billusec Number in microseconds of the call which are billable.
bleg_uuid The uuid of the corresponding call which has been connected.
main_leg_uuid If the call_type is INBOUND this field is always null

call_type

The type of call leg. It can have the following values:

  • WEBRTCINBOUND:A call received from a browser
  • INBOUND: A call received from the PSTN
  • FORWARD:A call forwarded from TEVOX to the PSTN
  • SIPFORWARD_USER:A call forwarded to a SIP device (softphone or hardphone) registered with TENIOS
  • SIPFORWARD_PRFL:A call forwarded to a SIP trunk (e.g. IP-PBX like asterisk, freeswitch, etc) connected to TENIOS
  • FAXOUT:A fax send out to the PSTN
callerid_name The caller id name. This filed is only provided when a call is forwarded via SIP and not routed to the PSTN.
callerid_number The caller id number.
destination_number The destination number of the call. If the call_type is INBOUND this is usually the service number.
start_stamp The timestamp when the call has started
end_stamp The timestamp when the call was ended
duration The total duration of the call, including call setup and ring time.
hangup_cause String The hangup cause of the call.
uuid The uuid of the call.
prepaid boolean true or false to identify if the call is related to a prepaid account
cost The cost of the call in EUR
source_type The type of the source network where the call was initiated from. Can be FIXED_LINE or MOBILE.
routing_status The routing status of the call. The field is null on success, otherwise a text with a description of the error.
billing_status The billing status of the call. The field is null on success, otherwise a text with a description of the error.
total_items The total number of items in the requested time frame
page The current page.
page_size The current page size.
Hangup cause
UNSPECIFIED This is usually given by the router when none of the other codes apply. This cause usually occurs in the same type of situations as cause 1, cause 88, and cause 100.
UNALLOCATED_NUMBER This cause indicates that the called party cannot be reached because, although the called party number is in a valid format, it is not currently allocated (assigned).
NO_ROUTE_TRANSIT_NET This cause indicates that the equipment sending this cause has received a request to route the call through a particular transit network, which it does not recognize. The equipment sending this cause does not recognize the transit network either because the transit network does not exist or because that particular transit network, while it does exist, does not serve the equipment which is sending this cause.
NO_ROUTE_DESTINATION This cause indicates that the called party cannot be reached because the network through which the call has been routed does not serve the destination desired. This cause is supported on a network dependent basis.
CHANNEL_UNACCEPTABLE This cause indicates that the channel most recently identified is not acceptable to the sending entity for use in this call.
CALL_AWARDED_DELIVERED This cause indicates that the user has been awarded the incoming call, and that the incoming call is being connected to a channel already established to that user for similar calls (e.g. packet-mode x.25 virtual calls).
NORMAL_CLEARING This cause indicates that the call is being cleared because one of the users involved in the call has requested that the call be cleared. Under normal situations, the source of this cause is not the network.
USER_BUSY This cause is used to indicate that the called party is unable to accept another call because the user busy condition has been encountered. This cause value may be generated by the called user or by the network. In the case of user determined user busy it is noted that the user equipment is compatible with the call.
NO_USER_RESPONSE This cause is used when a called party does not respond to a call establishment message with either an alerting or connect indication within the prescribed period of time allocated.
NO_ANSWER This cause is used when the called party has been alerted but does not respond with a connect indication within a prescribed period of time. Note – This cause is not necessarily generated by Q.931 procedures but may be generated by internal network timers.
SUBSCRIBER_ABSENT This cause value is used when a mobile station has logged off, radio contact is not obtained with a mobile station or if a personal telecommunication user is temporarily not addressable at any user-network interface. Sofia SIP will normally raise USER_NOT_REGISTERED in such situations.
CALL_REJECTED This cause indicates that the equipment sending this cause does not wish to accept this call, although it could have accepted the call because the equipment sending this cause is neither busy nor incompatible. The network may also generate this cause, indicating that the call was cleared due to a supplementary service constraint. The diagnostic field may contain additional information about the supplementary service and reason for rejection.
NUMBER_CHANGED This cause is returned to a calling party when the called party number indicated by the calling party is no longer assigned, The new called party number may optionally be included in the diagnostic field. If a network does not support this cause, cause no: 1, unallocated (unassigned) number shall be used.
REDIRECTION_TO_NEW_DESTINATION This cause is used by a general ISUP protocol mechanism that can be invoked by an exchange that decides that the call should be set-up to a different called number. Such an exchange can invoke a redirection mechanism, by use of this cause value, to request a preceding exchange involved in the call to route the call to the new number.
EXCHANGE_ROUTING_ERROR This cause indicates that the destination indicated by the user cannot be reached, because an intermediate exchange has released the call due to reaching a limit in executing the hop counter procedure. This cause is generated by an intermediate node, which when decrementing the hop counter value, gives the result 0.
DESTINATION_OUT_OF_ORDER This cause indicates that the destination indicated by the user cannot be reached because the interface to the destination is not functioning correctly. The term “not functioning correctly” indicates that a signal message was unable to be delivered to the remote party; e.g. a physical layer or data link layer failure at the remote party, or user equipment off-line.
INVALID_NUMBER_FORMAT This cause indicates that the called party cannot be reached because the called party number is not in a valid format or is not complete.
FACILITY_REJECTED This cause is returned when a supplementary service requested by the user cannot be provided by the network.
RESPONSE_TO_STATUS_ENQUIRY This cause is included in the STATUS message when the reason for generating the STATUS message was the prior receipt of a STATUS INQUIRY.
NORMAL_UNSPECIFIED This cause is used to report a normal event only when no other cause in the normal class applies.
NORMAL_CIRCUIT_CONGESTION This cause indicates that there is no appropriate circuit/channel presently available to handle the call.
NETWORK_OUT_OF_ORDER This cause indicates that the network is not functioning correctly and that the condition is likely to last a relatively long period of time e.g. immediately re-attempting the call is not likely to be successful.
NORMAL_TEMPORARY_FAILURE This cause indicates that the network is not functioning correctly and that the condition is not likely to last a long period of time; e.g. the user may wish to try another call attempt almost immediately.
SWITCH_CONGESTION This cause indicates that the switching equipment generating this cause is experiencing a period of high traffic.
ACCESS_INFO_DISCARDED This cause indicates that the network could not deliver access information to the remote user as requested, i.e. user-to-user information, low layer compatibility, high layer compatibility or sub-address as indicated in the diagnostic. It is noted that the particular type of access information discarded is optionally included in the diagnostic.
REQUESTED_CHAN_UNAVAIL This cause is returned when the other side of the interface cannot provide the circuit or channel indicated by the requesting entity.
FACILITY_NOT_SUBSCRIBED This cause indicates that the user has requested a supplementary service, which is available, but the user is not authorized to use.
OUTGOING_CALL_BARRED This cause indicates that although the calling party is a member of the CUG for the outgoing CUG call, outgoing calls are not allowed for this member of the CUG.
INCOMING_CALL_BARRED This cause indicates that although the called party is a member of the CUG for the incoming CUG call, incoming calls are not allowed to this member of the CUG.
BEARERCAPABILITY_NOTAUTH This cause indicates that the user has requested a bearer capability that is implemented by the equipment which generated this cause but the user is not authorized to use.
BEARERCAPABILITY_NOTAVAIL This cause indicates that the user has requested a bearer capability which is implemented by the equipment which generated this cause but which is not available at this time.
SERVICE_UNAVAILABLE This cause is used to report a service or option not available event only when no other cause in the service or option not available class applies.
BEARERCAPABILITY_NOTIMPL This cause indicates that the equipment sending this cause does not support the bearer capability requested.
CHAN_NOT_IMPLEMENTED This cause indicates that the equipment sending this cause does not support the channel type requested
FACILITY_NOT_IMPLEMENTED This cause indicates that the equipment sending this cause does not support the requested supplementary services.
SERVICE_NOT_IMPLEMENTED This cause is used to report a service or option not implemented event only when no other cause in the service or option not implemented class applies.
INVALID_CALL_REFERENCE This cause indicates that the equipment sending this cause has received a message with a call reference which is not currently in use on the user-network interface.
INCOMPATIBLE_DESTINATION This cause indicates that the equipment sending this cause has received a request to establish a call which has low layer compatibility, high layer compatibility or other compatibility attributes (e.g. data rate) which cannot be accommodated.
INVALID_MSG_UNSPECIFIED This cause is used to report an invalid message event only when no other cause in the invalid message class applies.
MANDATORY_IE_MISSING This cause indicates that the equipment sending this cause has received a message which is missing an information element which must be present in the message before that message can be processed.
MESSAGE_TYPE_NONEXIST This cause indicates that the equipment sending this cause has received a message with a message type it does not recognize either because this is a message not defined of defined but not implemented by the equipment sending this cause.
WRONG_MESSAGE This cause indicates that the equipment sending this cause has received a message such that the procedures do not indicate that this is a permissible message to receive while in the call state, or a STATUS message was received indicating an incompatible call state.
IE_NONEXIST This cause indicates that the equipment sending this cause has received a message which includes information element(s)/parameter(s) not recognized because the information element(s)/parameter name(s) are not defined or are defined but not implemented by the equipment sending the cause. This cause indicates that the information element(s)/parameter(s) were discarded. However, the information element is not required to be present in the message in order for the equipment sending the cause to process the message.
INVALID_IE_CONTENTS This cause indicates that the equipment sending this cause has received and information element which it has implemented; however, one or more fields in the I.E. are coded in such a way which has not been implemented by the equipment sending this cause.
WRONG_CALL_STATE This cause indicates that a message has been received which is incompatible with the call state.
RECOVERY_ON_TIMER_EXPIRE This cause indicates that a procedure has been initiated by the expiration of a timer in association with error handling procedures. This is often associated with NAT problems. Ensure that “NAT Mapping Enable ” is turned on in your ATA. If it is not NAT related it can sometimes be provider related, make sure to ensure another outbound provider does not solve the problem.FreeSWITCH also returns this when the remote party sends a 408 for call expired.
MANDATORY_IE_LENGTH_ERROR This cause indicates that the equipment sending this cause has received a message which includes parameters not recognized because the parameters are not defined or are defined but not implemented by the equipment sending this cause. The cause indicates that the parameter(s) were ignored. In addition, if the equipment sending this cause is an intermediate point, then this cause indicates that the parameter(s) were passed unchanged.
PROTOCOL_ERROR This cause is used to report a protocol error event only when no other cause in the protocol error class applies.
INTERWORKING This cause indicates that an interworking call (usually a call to SW56 service) has ended.
ORIGINATOR_CANCEL This cause indicates that the originator of the call hungup the call
LOSE_RACE This cause indicates that on a parallel call this call leg was not connected.
MANAGER_REQUEST This cause is used when you send an api command to make it hangup.

Example for a successful request:

Request:

{
   "access_key": "9993f89f-b5c0-4f57-abe0-7ec3d929fe19",
   "start_date_from": "2000-01-01T00:00:00.000Z",
   "start_date_to": "2018-01-01T00:00:00.000Z",
   "page": 1,
   "page_size": 1
}

API Response example:

API Response Example 1

API Response:

HTTP Status Code: 200 (OK)

{
   "items": [
      {
         "answer_stamp": "2014-01-09T23:00:00:000Z",
         "billusec": 36000000,
         "bleg_uuid": null,
         "main_leg_uuid": null,
         "call_type": "INBOUND",
         "callerid_name": "+49123456789",
         "callerid_number": "+49123456789",
         "destination_number": "+49123456789",
         "start_stamp": "2014-01-09T23:00:00:000Z",
         "end_stamp": "2014-01-10T23:00:00:000Z",
         "duration": 57,
         "hangup_cause": "NORMAL_CLEARING",
         "uuid": "3b7957a8-ca33-40d6-acd5-787b61d3db09",
         "prepaid": true,
         "cost": 2.65,
         "source_type": "FIXED_LINE",
         "routing_status": null,
         "billing_status": null
      }
   ],
   "total_items": 615,
   "page_size": 1,
   "page": 1
}

API Response Example 2

API Response:

HTTP Status Code: 200 (OK)

 

{
   "items": [
      {
         "answer_stamp": "2020-02-01T17:22:31.000Z",
         "billusec": 18400001,
         "bleg_uuid": null,
         "main_leg_uuid": null,
         "call_type": "FAXOUT",
         "callerid_name": "+496922237223509",
         "callerid_number": "+496222437223509",
         "destination_number": "+4969211137223509",
         "start_stamp": "2020-02-01T17:22:31.000Z",
         "end_stamp": "2020-02-01T17:22:50.000Z",
         "duration": 19,
         "hangup_cause": "NORMAL_CLEARING",
         "uuid": "70960bf8-d93d-4faf-84a6-1XXXXXXXX",
         "prepaid": true,
         "cost": 0.0031666673,
         "source_type": null,
         "routing_status": null,
         "billing_status": null
      },
      {
         "answer_stamp": "2020-02-01T17:22:31.000Z",
         "billusec": 18380002,
         "bleg_uuid": null,
         "main_leg_uuid": null,
         "call_type": "INBOUND",
         "callerid_name": null,
         "callerid_number": "+496922227223509",
         "destination_number": "+4969222237223509",
         "start_stamp": "2020-02-01T17:22:31.000Z",
         "end_stamp": "2020-02-01T17:22:50.000Z",
         "duration": 19,
         "hangup_cause": "NORMAL_CLEARING",
         "uuid": "6db8afdc-4517-11ea-a61b-c3XXXXXXXXXX",
         "prepaid": true,
         "cost": 0.0031666673,
         "source_type": "FIXED_LINE",
         "routing_status": null,
         "billing_status": null
      },
      {
         "answer_stamp": "2020-02-01T17:34:23.000Z",
         "billusec": 18319994,
         "bleg_uuid": null,
         "main_leg_uuid": null,
         "call_type": "FAXOUT",
         "callerid_name": "+496922227223509",
         "callerid_number": "+4962222223509",
         "destination_number": "+496222237223509",
         "start_stamp": "2020-02-01T17:34:23.000Z",
         "end_stamp": "2020-02-01T17:34:42.000Z",
         "duration": 19,
         "hangup_cause": "NORMAL_CLEARING",
         "uuid": "6e30c9d7-573f-46d8-92a7-XXXXXXXX",
         "prepaid": true,
         "cost": 0.0031666673,
         "source_type": null,
         "routing_status": null,
         "billing_status": null
      }
   ],
   "total_items": 5,
   "page_size": 1,
   "page": 1
}

Examples for invalid requests:

CDR_FIELD_START_AFTER_END_DATE

Request:

{
   "access_key": "9993f89f-b5c0-4f57-abe0-7ec3d929fe19",
   "start_date_from": "2020-01-01T00:00:00:000Z",
   "start_date_to": "2018-01-01T00:00:00:000Z",
   "page": 1,
   "page_size": 1
}

API Response:

HTTP Status Code: 400 (Bad Request)

{
   "error_code": "CDR_FIELD_START_AFTER_END_DATE",
   "error_message": "Parameter 'start_date_from' value can not be higher then 'start_date_to' value",
   "fields": [
      "start_date_from",
      "start_date_to"
   ]
}
CDR_DATE_PARSE_ERROR
{
   "access_key": "9993f89f-b5c0-4f57-abe0-7ec3d929fe19",
   "start_date_from": "20200101",
   "start_date_to": "2018-01-01",
   "page": 1,
   "page_size": 1
}

API Response:

HTTP Status Code: 400 (Bad Request)
{
   "error_code": "CDR_DATE_PARSE_ERROR",
   "error_message": "Parameter 'start_date_from' value parsing error: format must be yyyy-MM-dd'T'HH:mm:ss.SSSZ. E.g. 2013-12-31T00:00:00:000Z",
   "fields": [
      "start_date_from"
   ]
}
FIELD_NEGATIVE_OR_ZERO

Request:

{
   "access_key": "9993f89f-b5c0-4f57-abe0-7ec3d929fe19",
   "start_date_from": "2015-01-01T00:00:00:000Z",
   "start_date_to": "2016-01-01T00:00:00:000Z",
   "page": -1,
   "page_size": 1
}

API Response:

HTTP Status Code: 400 (Bad Request)

{
   "error_code": "FIELD_NEGATIVE_OR_ZERO",
   "error_message": "Parameter 'page' value can not be negative or equal to zero",
   "fields": [
      "page"
   ]
}
TOO_MANY_REQUESTS

Request:

{
   "access_key": "9993f89f-b5c0-4f57-abe0-7ec3d929fe19",
   "start_date_from": "2020-01-01T00:00:00:000Z",
   "start_date_to": "2018-01-01T00:00:00:000Z",
   "page": 1,
   "page_size": 1
}

API Response:

HTTP Status Code: 400 (Bad Request)
{
   "success": false,
   "error_code": "TOO_MANY_REQUESTS",
   "error_message": "Too many requests",
   "fields": []
}

This error is returned if too many parallel queries are executed from the same IP address. The number of parallel queries per IP address is limited by 1.

Count CDRs:

Method to count CDRs in a defined interval. For performance reasons the interval can be max. 1 day.

POST https://api.tenios.com/cdrs/count

Request Parameters:

access_key The api access_key . You can find it in unter menu item Account Data, section API in the customer portal.
start_date_from The start date of the period over which you want to request CDRs.
start_date_to The end date of the period over which you want to request CDRs.

Output parameters:

total_items The number of Cdrs that have been counted in the provided interval.

 

Example for a successful request:

Request:

{
   "access_key ": "00000000-0000-0000-0000-000000000000 ",
   "start_date_from ": "2018-03-20T00:00:00.000Z ",
   "start_date_to ": "2018-03-20T23:00:00.000Z "
}

API Response:

HTTP Status Code: 200 (OK)

{
"total_items ": 51
}
TOP