Voice IN Service CDR Streaming
The Voice IN CDR Streamer enables customers to receive near real-time Call Detail Records (CDRs).
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-continueWarning
The request payload is gzip-encoded. Ensure that your API supports gzip decompression for proper processing of incoming CDRs.
See gzip 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@12.23.45.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
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:
|
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:
|
2 |
transport_protocol_id |
Integer |
Transport protocol used between DIDWW and the customer gateway:
|
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 maximum batch size is 1,000 CDRs per request.
The destination API must be capable of processing multiple CDRs within the same request.
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
- 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 for additional CDR retrieval methods.
- 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.