# Voice IN Service CDR Streaming

The **Voice IN CDR Streamer** enables customers to receive near real-time **Call Detail Records (CDRs)**.

Important

CDRs are **delivered within 3 seconds** after call completion to the customer's designated **HTTP endpoint**.



---

## HTTP request payload examples

The following is an example of an HTTP **POST** request header used for Voice IN CDR Streaming. It provides key details
such as the destination server, content type, encoding, and request size.

> ```
> POST /cdr HTTP/1.1
> Host: 192.0.2.5
> User-Agent: CDR-streamer
> Accept: */*
> Content-Type: text/plain
> Content-Encoding: gzip
> Content-Length: 2358
> Expect: 100-continue
> ```
>
> Warning
>
> The request payload is **gzip-encoded**. Ensure that your API supports **gzip decompression**
> for proper processing of incoming CDRs.
>
> See [gzip compression](https://en.wikipedia.org/wiki/HTTP_compression) for more details.



### **Example: Successfully Completed Call**

This example represents a **successful call** that lasted **9 seconds**:
:   - **Call duration is `9` seconds**, indicating that the call was successfully connected and active.
    - **`time\_connect` is present**, confirming that the call was answered.
    - **Leg B (`legb`) disconnect reason is `"Bye"`**, meaning the call was normally ended.
    - **Disconnect initiator:** 3 (Call originator), meaning the caller ended the call.

    ```
    {
          "type": "inbound-cdr",
          "attributes": {
            "sub_customer_tf_connection_fee": 0,
            "trm_initial_interval": null,
            "sub_customer_trm_duration": null,
            "metered_channels_duration": null,
            "sub_customer_trm_next_interval": null,
            "time_connect": "2025-02-14T14:36:58.843904",
            "metered_channels_amount_no_vat": null,
            "local_tag": "14-1519849E-67AF550A000B932D-348F56C0",
            "metered_channels_next_interval": null,
            "internal_disconnect_reason": "Bye",
            "tf_rate": 0,
            "duration": 9,
            "metered_channels_connection_fee": null,
            "tf_connection_fee": 0,
            "is_last_cdr": true,
            "sub_customer_tf_duration": null,
            "customer_vat": 0,
            "success": true,
            "metered_channels_rate": null,
            "sub_customer_trm_connection_fee": 0,
            "dst_number": "77615145141",
            "disconnect_initiator": 3,
            "trm_duration": null,
            "tf_duration": null,
            "src_name": "353122345478",
            "time_start": "2025-02-14T14:36:58.75863",
            "sub_customer_trm_amount": null,
            "term_call_id": "14-14-32FA4FA2-67AF550A000B9E59-5E1F96C0",
            "early_media_present": false,
            "did_number": "321555",
            "tf_initial_interval": null,
            "trm_rate": 0,
            "tf_next_interval": null,
            "time_end": "2025-02-14T14:37:06.977841",
            "legb_disconnect_reason": "Bye",
            "sub_customer_tf_next_interval": null,
            "sub_customer_id": null,
            "internal_disconnect_code": 200,
            "trm_amount_no_vat": null,
            "sub_customer_tf_initial_interval": null,
            "trunk_destination": "sip:123456@192.0.2.67",
            "sub_customer_trm_rate": 0,
            "legb_disconnect_code": 200,
            "sub_customer_tf_rate": 0,
            "sub_customer_tf_amount": null,
            "sub_customer_trm_initial_interval": null,
            "tf_amount": null,
            "routing_attempt": 1,
            "transport_protocol_id": 1,
            "is_redirected": false,
            "out_pop_id": 1,
            "user_agent": "sems callgen",
            "trm_connection_fee": 0,
            "tf_amount_no_vat": null,
            "trm_next_interval": null,
            "metered_channels_initial_interval": null,
            "src_number": "123456789",
            "metered_channels_amount": null,
            "trm_amount": null
          },
      "id": "e20d1722-9b47-4644-92fe-fce28f26871c"
    }
    ```



---

## Voice IN CDR Streaming Attributes

Voice IN (incoming) service CDR Streaming Descriptions and Examples






| **Attribute** | **Type** | **Description** | **Example** |
| --- | --- | --- | --- |
| **type** | String | CDR type identifier. Voice IN CDRs are marked as **inbound-cdr**. | "inbound-cdr" |
| **id** | String | Unique CDR identifier in **UUID** format. | "3d6af8ac-5ed1-11ea-bc9d-005056845b1e" |
| **attributes** | Hash | Structure containing all CDR attributes. | *See below for attribute details.* |
| **time\_start** | Timestamp | Start time when the initial SIP INVITE is received. | "2025-02-14T14:36:58.75863" |
| **time\_connect** | Timestamp | Time after the successful handshake (**200 OK SIP**). | "2025-02-14T14:36:58.843904" |
| **time\_end** | Timestamp | Time when the call was disconnected. | "2025-02-14T14:37:06.977841" |
| **duration** | Integer | Call duration in seconds. For non-connected calls, duration is **0**. | 35 |
| **disconnect\_initiator** | Integer | Indicates which party initiated disconnection:  - 0 - Routing engine - 1 - SBC - 2 - Called destination network - 3 - Call originator | 3 |
| **internal\_disconnect\_code** | Integer | DIDWW internal disconnect code. | 200 |
| **internal\_disconnect\_reason** | String | DIDWW internal disconnect reason. | "Bye" |
| **legb\_disconnect\_code** | Integer | SIP response code received from the destination network. | 200 |
| **legb\_disconnect\_reason** | String | SIP disconnect reason received from the destination network. | "Normal Clearing" |
| **routing\_attempt** | Integer | Number of routing attempts to reach the destination network. | 1 |
| **is\_last\_cdr** | Boolean | Indicates if this is the last attempt to reach the destination network in the event of fail-over. | true |
| **success** | Boolean | Indicates whether the call was successfully connected. | true |
| **term\_call\_id** | String | SIP Call-ID of the call leg between DIDWW and customer equipment. | "10-10-7ED7C3EC-5DBAF487000C1C19-8FCFC700" |
| **local\_tag** | String | Internal identifier of the call record. | "10-04336EB9-5DBAF4AA000E6DDB-6A41F700" |
| **did\_number** | String | DID number in full format. | "972397239159092" |
| **src\_name** | String | Incoming caller name. | "John Doe" |
| **src\_number** | String | Incoming Caller-ID. | "111111222222" |
| **dst\_number** | String | Called destination number. | "97239723915909200" |
| **trunk\_destination** | String | Call destination in URI format. | "sip:972397239159092@didww.com" |
| **customer\_vat** | Numeric | Charged VAT amount for the call. | 0.20 |
| **tf\_rate** | Numeric | Customer Toll-Free rate. | 0.05 |
| **tf\_connection\_fee** | Numeric | Customer Toll-Free connection fee. | 0.10 |
| **tf\_initial\_interval** | Integer | Initial billing interval for Toll-Free service. | 60 |
| **tf\_next\_interval** | Integer | Next billing interval for Toll-Free service. | 30 |
| **tf\_duration** | Integer | Call duration rounded to configured billing interval for Toll-Free service. | 120 |
| **tf\_amount** | Numeric | Customer Toll-Free accumulated amount. | 2.40 |
| **tf\_amount\_no\_vat** | Numeric | Customer Toll-Free accumulated amount **excluding VAT**. | 1.90 |
| **trm\_rate** | Numeric | Customer termination rate. Applies when PSTN forwarding is used. | 0.07 |
| **trm\_connection\_fee** | Numeric | Customer termination connection fee. Applies when PSTN forwarding is used. | 0.15 |
| **trm\_initial\_interval** | Integer | Initial billing interval length in seconds for PSTN forwarding. | 60 |
| **trm\_next\_interval** | Integer | Next billing interval length in seconds for PSTN forwarding. | 30 |
| **trm\_duration** | Integer | Call duration rounded to configured billing interval for PSTN forwarding. | 180 |
| **trm\_amount** | Numeric | Customer PSTN termination accumulated amount. | 3.50 |
| **trm\_amount\_no\_vat** | Numeric | Customer PSTN termination accumulated amount **excluding VAT**. | 2.77 |
| **metered\_channels\_rate** | Numeric | Metered capacity rate. | 0.02 |
| **metered\_channels\_connection\_fee** | Numeric | Metered capacity connection fee. | 0.05 |
| **metered\_channels\_initial\_interval** | Integer | Metered capacity initial billing interval in seconds. | 60 |
| **metered\_channels\_next\_interval** | Integer | Metered capacity next billing interval length. | 30 |
| **metered\_channels\_duration** | Integer | Metered capacity charged duration. | 120 |
| **metered\_channels\_amount** | Numeric | Customer metered capacity accumulated amount. | 2.40 |
| **metered\_channels\_amount\_no\_vat** | Numeric | Customer metered capacity accumulated amount **excluding VAT**. | 1.90 |
| **out\_pop\_id** | Integer | DIDWW **Point of Presence (PoP)** for the call leg from DIDWW to the customer:  - 1 - USA New York - 2 - EU Frankfurt - 4 - USA Los Angeles - 5 - USA Miami - 6 - AS Singapore - 7 - AS Hong Kong - 8 - EU Amsterdam | 2 |
| **transport\_protocol\_id** | Integer | Transport protocol used between DIDWW and the customer gateway:  - 1 - UDP - 2 - TCP - 3 - TLS | 2 |
| **user\_agent** | String | User-Agent and Server header values from the customer gateway. | "Asterisk PBX 16.6.0" |
| **is\_redirected** | Boolean | Indicates if the call was redirected by a **3xx SIP response**. | false |
| **early\_media\_present** | Boolean | Indicates if an early media stream was present in the destination gateway. | true |

---

## Batching

Call Detail Records (**CDRs**) are delivered in **batches**, meaning a single HTTP POST request can contain multiple
CDRs. This reduces the number of requests while ensuring efficient data transmission.

Key Details:
:   - The CDRs are separated by new lines.
    - The maximum batch size is 1,000 CDRs per request.
    - The destination API must be capable of processing multiple CDRs within the same request.

### Example: CDRs in a Batch

Below is an example of a payload containing five CDRs.

> ```
> { "type" : "inbound-cdr", "attributes" : { "sub_customer_tf_connection_fee" : 0, "trm_initial_interval" : null, "sub_customer_trm_duration" : null, "metered_channels_duration" : 60, "sub_customer_trm_next_interval" : null, "time_connect" : "2025-04-18T07:47:44.412933", "metered_channels_amount_no_vat" : 0.01, "local_tag" : "21-25F86C33-680203A00004FB2D-7B9F96C0", "metered_channels_next_interval" : 60, "internal_disconnect_reason" : "Bye", "tf_rate" : 0, "duration" : 11, "metered_channels_connection_fee" : 0, "tf_connection_fee" : 0, "is_last_cdr" : true, "sub_customer_tf_duration" : null, "customer_vat" : 21, "success" : true, "metered_channels_rate" : 0.01, "sub_customer_trm_connection_fee" : 0, "dst_number" : "echotest", "disconnect_initiator" : 3, "trm_duration" : null, "tf_duration" : null, "src_name" : "16473635777", "time_start" : "2025-04-18T07:47:44.326742", "sub_customer_trm_amount" : null, "term_call_id" : "21-21-4F754B3D-680203A0000515F7-FE5EC6C0", "early_media_present" : false, "did_number" : "18312630056", "tf_initial_interval" : null, "trm_rate" : 0, "tf_next_interval" : null, "time_end" : "2025-04-18T07:47:54.815287", "legb_disconnect_reason" : "Bye", "sub_customer_tf_next_interval" : null, "sub_customer_id" : null, "internal_disconnect_code" : 200, "trm_amount_no_vat" : null, "sub_customer_tf_initial_interval" : null, "trunk_destination" : "sip:echotest@46.19.209.12", "sub_customer_trm_rate" : 0, "legb_disconnect_code" : 200, "sub_customer_tf_rate" : 0, "sub_customer_tf_amount" : null, "sub_customer_trm_initial_interval" : null, "tf_amount" : null, "routing_attempt" : 1, "transport_protocol_id" : 1, "is_redirected" : false, "out_pop_id" : 1, "user_agent" : "sems callgen", "trm_connection_fee" : 0, "tf_amount_no_vat" : null, "trm_next_interval" : null, "metered_channels_initial_interval" : 60, "src_number" : "16473635777", "metered_channels_amount" : 0.0121, "trm_amount" : null }, "id" : "847d3532-3592-441c-9305-035d31bb38d0" }
> { "type" : "inbound-cdr", "attributes" : { "sub_customer_tf_connection_fee" : 0, "trm_initial_interval" : null, "sub_customer_trm_duration" : null, "metered_channels_duration" : 60, "sub_customer_trm_next_interval" : null, "time_connect" : "2025-04-18T07:47:45.339513", "metered_channels_amount_no_vat" : 0.01, "local_tag" : "21-4B73AFD3-680203A10003DF75-7B9F96C0", "metered_channels_next_interval" : 60, "internal_disconnect_reason" : "Bye", "tf_rate" : 0, "duration" : 11, "metered_channels_connection_fee" : 0, "tf_connection_fee" : 0, "is_last_cdr" : true, "sub_customer_tf_duration" : null, "customer_vat" : 21, "success" : true, "metered_channels_rate" : 0.01, "sub_customer_trm_connection_fee" : 0, "dst_number" : "echotest", "disconnect_initiator" : 3, "trm_duration" : null, "tf_duration" : null, "src_name" : "16473635777", "time_start" : "2025-04-18T07:47:45.253978", "sub_customer_trm_amount" : null, "term_call_id" : "21-21-26FD31F5-680203A10003F6FB-FE3EA6C0", "early_media_present" : false, "did_number" : "18312630056", "tf_initial_interval" : null, "trm_rate" : 0, "tf_next_interval" : null, "time_end" : "2025-04-18T07:47:55.576196", "legb_disconnect_reason" : "Bye", "sub_customer_tf_next_interval" : null, "sub_customer_id" : null, "internal_disconnect_code" : 200, "trm_amount_no_vat" : null, "sub_customer_tf_initial_interval" : null, "trunk_destination" : "sip:echotest@46.19.209.12", "sub_customer_trm_rate" : 0, "legb_disconnect_code" : 200, "sub_customer_tf_rate" : 0, "sub_customer_tf_amount" : null, "sub_customer_trm_initial_interval" : null, "tf_amount" : null, "routing_attempt" : 1, "transport_protocol_id" : 1, "is_redirected" : false, "out_pop_id" : 1, "user_agent" : "sems callgen", "trm_connection_fee" : 0, "tf_amount_no_vat" : null, "trm_next_interval" : null, "metered_channels_initial_interval" : 60, "src_number" : "16473635777", "metered_channels_amount" : 0.0121, "trm_amount" : null }, "id" : "79479a72-1d19-41cf-83e5-515273915489" }
> { "type" : "inbound-cdr", "attributes" : { "sub_customer_tf_connection_fee" : 0, "trm_initial_interval" : null, "sub_customer_trm_duration" : null, "metered_channels_duration" : 60, "sub_customer_trm_next_interval" : null, "time_connect" : "2025-04-18T07:47:45.146977", "metered_channels_amount_no_vat" : 0.01, "local_tag" : "21-21E66A31-680203A10000E80F-7B9F96C0", "metered_channels_next_interval" : 60, "internal_disconnect_reason" : "Bye", "tf_rate" : 0, "duration" : 11, "metered_channels_connection_fee" : 0, "tf_connection_fee" : 0, "is_last_cdr" : true, "sub_customer_tf_duration" : null, "customer_vat" : 21, "success" : true, "metered_channels_rate" : 0.01, "sub_customer_trm_connection_fee" : 0, "dst_number" : "echotest", "disconnect_initiator" : 3, "trm_duration" : null, "tf_duration" : null, "src_name" : "16473635777", "time_start" : "2025-04-18T07:47:45.059612", "sub_customer_trm_amount" : null, "term_call_id" : "21-21-46EABA05-680203A100010655-FE4EB6C0", "early_media_present" : false, "did_number" : "18312630056", "tf_initial_interval" : null, "trm_rate" : 0, "tf_next_interval" : null, "time_end" : "2025-04-18T07:47:55.691302", "legb_disconnect_reason" : "Bye", "sub_customer_tf_next_interval" : null, "sub_customer_id" : null, "internal_disconnect_code" : 200, "trm_amount_no_vat" : null, "sub_customer_tf_initial_interval" : null, "trunk_destination" : "sip:echotest@46.19.209.12", "sub_customer_trm_rate" : 0, "legb_disconnect_code" : 200, "sub_customer_tf_rate" : 0, "sub_customer_tf_amount" : null, "sub_customer_trm_initial_interval" : null, "tf_amount" : null, "routing_attempt" : 1, "transport_protocol_id" : 1, "is_redirected" : false, "out_pop_id" : 1, "user_agent" : "sems callgen", "trm_connection_fee" : 0, "tf_amount_no_vat" : null, "trm_next_interval" : null, "metered_channels_initial_interval" : 60, "src_number" : "16473635777", "metered_channels_amount" : 0.0121, "trm_amount" : null }, "id" : "f0270ad1-2b52-4001-a5fc-f44bd456f60c" }
> { "type" : "inbound-cdr", "attributes" : { "sub_customer_tf_connection_fee" : 0, "trm_initial_interval" : null, "sub_customer_trm_duration" : null, "metered_channels_duration" : null, "sub_customer_trm_next_interval" : null, "time_connect" : "2025-04-18T07:47:45.793212", "metered_channels_amount_no_vat" : null, "local_tag" : "21-5A25EFB7-680203A1000A80FF-7B9F96C0", "metered_channels_next_interval" : null, "internal_disconnect_reason" : "Bye", "tf_rate" : 0, "duration" : 11, "metered_channels_connection_fee" : null, "tf_connection_fee" : 0, "is_last_cdr" : true, "sub_customer_tf_duration" : null, "customer_vat" : 21, "success" : true, "metered_channels_rate" : null, "sub_customer_trm_connection_fee" : 0, "dst_number" : "echotest", "disconnect_initiator" : 3, "trm_duration" : null, "tf_duration" : null, "src_name" : "16473635777", "time_start" : "2025-04-18T07:47:45.688656", "sub_customer_trm_amount" : null, "term_call_id" : "21-21-5C69BF48-680203A1000AE3C0-FE2E96C0", "early_media_present" : false, "did_number" : "18312630056", "tf_initial_interval" : null, "trm_rate" : 0, "tf_next_interval" : null, "time_end" : "2025-04-18T07:47:56.234491", "legb_disconnect_reason" : "Bye", "sub_customer_tf_next_interval" : null, "sub_customer_id" : null, "internal_disconnect_code" : 200, "trm_amount_no_vat" : null, "sub_customer_tf_initial_interval" : null, "trunk_destination" : "sip:echotest@46.19.209.12", "sub_customer_trm_rate" : 0, "legb_disconnect_code" : 200, "sub_customer_tf_rate" : 0, "sub_customer_tf_amount" : null, "sub_customer_trm_initial_interval" : null, "tf_amount" : null, "routing_attempt" : 1, "transport_protocol_id" : 1, "is_redirected" : false, "out_pop_id" : 1, "user_agent" : "sems callgen", "trm_connection_fee" : 0, "tf_amount_no_vat" : null, "trm_next_interval" : null, "metered_channels_initial_interval" : null, "src_number" : "16473635777", "metered_channels_amount" : null, "trm_amount" : null }, "id" : "9b19db91-ba19-43b8-b6e2-dba40fb7ed1b" }
> { "type" : "inbound-cdr", "attributes" : { "sub_customer_tf_connection_fee" : 0, "trm_initial_interval" : null, "sub_customer_trm_duration" : null, "metered_channels_duration" : null, "sub_customer_trm_next_interval" : null, "time_connect" : "2025-04-18T07:47:46.117589", "metered_channels_amount_no_vat" : null, "local_tag" : "22-3B7592C2-680203A200004394-2CBF86C0", "metered_channels_next_interval" : null, "internal_disconnect_reason" : "Bye", "tf_rate" : 0, "duration" : 11, "metered_channels_connection_fee" : null, "tf_connection_fee" : 0, "is_last_cdr" : true, "sub_customer_tf_duration" : null, "customer_vat" : 21, "success" : true, "metered_channels_rate" : null, "sub_customer_trm_connection_fee" : 0, "dst_number" : "echotest", "disconnect_initiator" : 3, "trm_duration" : null, "tf_duration" : null, "src_name" : "16473635777", "time_start" : "2025-04-18T07:47:46.017443", "sub_customer_trm_amount" : null, "term_call_id" : "22-22-1A8BCA30-680203A200009664-AB1EB6C0", "early_media_present" : false, "did_number" : "18312630056", "tf_initial_interval" : null, "trm_rate" : 0, "tf_next_interval" : null, "time_end" : "2025-04-18T07:47:56.429066", "legb_disconnect_reason" : "Bye", "sub_customer_tf_next_interval" : null, "sub_customer_id" : null, "internal_disconnect_code" : 200, "trm_amount_no_vat" : null, "sub_customer_tf_initial_interval" : null, "trunk_destination" : "sip:echotest@46.19.209.12", "sub_customer_trm_rate" : 0, "legb_disconnect_code" : 200, "sub_customer_tf_rate" : 0, "sub_customer_tf_amount" : null, "sub_customer_trm_initial_interval" : null, "tf_amount" : null, "routing_attempt" : 1, "transport_protocol_id" : 1, "is_redirected" : false, "out_pop_id" : 1, "user_agent" : "sems callgen", "trm_connection_fee" : 0, "tf_amount_no_vat" : null, "trm_next_interval" : null, "metered_channels_initial_interval" : null, "src_number" : "16473635777", "metered_channels_amount" : null, "trm_amount" : null }, "id" : "25166fb8-3e2b-4905-bdd0-48152c27a4b5" }
> ```
>
> Note
>
> - Ensure that your system is capable of parsing multiple new line separated **JSON objects**.
> - Each CDR object is not enclosed in a larger array or object.

---

## Error Handling

The **CDR Streaming Interface** determines whether a batch of CDRs has been successfully processed based on the HTTP
response from the destination API.

Success Criteria:
:   - If the API responds with a **2xx HTTP status code**, all CDRs in that request are marked as **processed** and
automatically removed from the queue.

Failure & Retry Mechanism:
:   - If the API returns a **non-2xx response** (e.g., 4xx or 5xx) or the request **times out**, the CDRs **remain in
the queue**.
    - A **retry attempt** will occur **after 3 seconds** to ensure delivery.

Warning

1. **Queue Size Limit:**
   :   - The **CDR queue is limited to 10,000 records per customer**.
       - Extended downtime or delayed processing may result in **CDR loss** at the customer's endpoint.
       - The **CDR Streaming mechanism should not be relied upon as the sole method** for CDR retrieval.
       - Refer to the [API documentation](../api3/2022-05-10/export/index.html#export-v33) for additional CDR retrieval methods.
2. **Timeout Handling:**
   :   - If the **HTTP endpoint does not respond within 10 seconds**, the request **will time out**, triggering an
**automatic retry**.
       - Ensure the destination API can handle incoming requests efficiently to prevent unnecessary retries.

On this page
