CDR Streaming interface

Service to send CDR to customer API after call completion. Typical delay before call completion and request to customer API is 3s

Configuration and usage

CDR Streaming currently is beta so it can be enabled only by customer request to our support team support@didww.com

Request format

Service uses HTTP POST to send CDRs to customer API. CDRs serialized to JSON format. Request can contain multiple CDRs(multiple JSON objects) separated by \n(LF) - so-called JSONEachRow format. Request Payload encoded as gzip so customer API should support gzip.

HTTP request headers example:

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

HTTP request payload example:

{"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,"metered_channels_amount_no_vat":null,"local_tag":"10-04336EB9-5DBAF4AA000E6DDB-6A41F700","metered_channels_next_interval":null,"sub_customer_trm_rate":0,"disconnect_initiator":1,"legb_disconnect_reason":"","metered_channels_connection_fee":null,"duration":0,"is_last_cdr":true,"sub_customer_tf_duration":null,"customer_vat":0,"tf_connection_fee":0,"metered_channels_rate":null,"sub_customer_trm_connection_fee":0,"success":false,"dst_number":"97239723915909200","trm_duration":null,"tf_duration":null,"time_connect":null,"time_start":"2019-10-31 14:50:18.930234","sub_customer_trm_amount":null,"term_call_id":"","src_name":"","did_number":"972397239159092","early_media_present":false,"tf_initial_interval":null,"metered_channels_amount":null,"time_end":"2019-10-31 14:50:18.946403","trm_rate":0,"sub_customer_tf_next_interval":null,"trm_amount":null,"internal_disconnect_code":480,"trm_amount_no_vat":null,"sub_customer_tf_initial_interval":null,"trunk_destination":"iax:324@34234234","tf_rate":0,"out_pop_id":1,"sub_customer_tf_rate":0,"sub_customer_tf_amount":null,"sub_customer_trm_initial_interval":null,"tf_amount":null,"legb_disconnect_code":0,"routing_attempt":1,"is_redirected":false,"tf_next_interval":null,"metered_channels_initial_interval":null,"transport_protocol_id":null,"tf_amount_no_vat":null,"trm_next_interval":null,"trm_connection_fee":0,"src_number":"","user_agent":null,"internal_disconnect_reason":"DID number overloaded"}
{"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,"metered_channels_amount_no_vat":null,"local_tag":"10-6C9724C3-5DBAF487000C0583-6A520700","metered_channels_next_interval":null,"sub_customer_trm_rate":0,"disconnect_initiator":3,"legb_disconnect_reason":"Bye","metered_channels_connection_fee":null,"duration":35,"is_last_cdr":true,"sub_customer_tf_duration":null,"customer_vat":0,"tf_connection_fee":0,"metered_channels_rate":null,"sub_customer_trm_connection_fee":0,"success":true,"dst_number":"972397239159092","trm_duration":null,"tf_duration":null,"time_connect":"2019-10-31 14:49:43.796925","time_start":"2019-10-31 14:49:43.775349","sub_customer_trm_amount":null,"term_call_id":"10-10-7ED7C3EC-5DBAF487000C1C19-8FCFC700","src_name":"4","did_number":"972397239159092","early_media_present":false,"tf_initial_interval":null,"metered_channels_amount":null,"time_end":"2019-10-31 14:50:18.85648","trm_rate":0,"sub_customer_tf_next_interval":null,"trm_amount":null,"internal_disconnect_code":200,"trm_amount_no_vat":null,"sub_customer_tf_initial_interval":null,"trunk_destination":"sip:972397239159092@didww.com","tf_rate":0,"out_pop_id":1,"sub_customer_tf_rate":0,"sub_customer_tf_amount":null,"sub_customer_trm_initial_interval":null,"tf_amount":null,"legb_disconnect_code":200,"routing_attempt":2,"is_redirected":false,"tf_next_interval":null,"metered_channels_initial_interval":null,"transport_protocol_id":1,"tf_amount_no_vat":null,"trm_next_interval":null,"trm_connection_fee":0,"src_number":"4","user_agent":"Asterisk PBX 11.13.1~dfsg-2+deb8u5","internal_disconnect_reason":"Bye"}

CDR attributes for DID service

time_start
timestamp
Start time of call.
time_connect
timestamp
Time of receiving connect event(200OK on initial INVITE transaction in case of SIP) for call.
time_end
timestamp
Time of disconnection
duration
integer
Call duration in seconds. For non-connected calls duration is 0
disconnect_initiator

integer
Describes which part initited disconnection. Possible values:

  • 0 Routing engine
  • 1 SBC
  • 2 Disconnect was initiated by call destination(customer gateway)
  • 3 Disconnect was initiated by call originator
internal_disconnect_code
integer
.. todo
internal_disconnect_reason
string
.. todo
legb_disconnect_code
integer
.. todo
legb_disconnect_reason
string
.. todo
routing_attempt
integer
We are saving CDR for each call termination attempt so it is possible to receive multiple CDRs for same call when cver Trunk group happened
is_last_cdr
boolean
Last CDR indicator. see failiover section for details
success
boolean
Flag indicates successfull call connection
term_call_id
string
SIP Call-Id of call leg between DIDWW and customer equipment
local_tag
string
Internal identifier of call.
did_number
string
DID number
src_name
string
From display name sent to customer
src_number
string
Caller-Id number sent to customer(From username)
dst_number
string
Call destination number
trunk_destination
string
Call destination in URI format
customer_vat
numeric
Call destination in URI format
tf_rate
numeric
Customer Toll-Free rate
tf_connection_fee
numeric
Customer Toll-Free connection feee
tf_initial_interval
integer
Initial billing interval for Toll-Free service
tf_next_interval
integer
Next billing interval for Toll-Free service
tf_duration
integer
Call duration rounded to configured billing interval for Toll-Free service
tf_amount
numeric
Customer Toll-Free amont
tf_amount_no_vat
numeric
Customer Toll-Free amont without VAT
trm_rate
numeric
Customer Toll-Free rate
trm_connection_fee
numeric
Customer Toll-Free connection fee
trm_initial_interval
integer
Initial billing interval legnth in seconds for PSTN forwaring service
trm_next_interval
integer
Next billing interval legnth in seconds for PSTN forwaring service
trm_duration
integer
Call duration rounded to configured billing interval for Toll-Free service
trm_amount
numeric
Customer Toll-Free amont
trm_amount_no_vat
numeric
Customer Toll-Free amont without VAT
metered_channels_rate
numeric
Metered channels rate
metered_channels_connection_fee
numeric
Metered channels rate
metered_channels_initial_interval
integer
Metered channels initial billing interval in seconds
metered_channels_next_interval
integer
Metered channels next billing interval length
metered_channels_duration
integer
Metered channels charged duration
metered_channels_amount
numeric
Customer Metered channels amont
metered_channels_amount_no_vat
numeric
Customer Metered channels amont excluding VAT
sub_customer_tf_rate
numeric
Sub customer rate for Toll-Free service
sub_customer_tf_connection_fee
numeric
Sub customer connection fee for Toll-Free service
sub_customer_tf_initial_interval
integer
Initial billing interval length in seconds for Toll-Free service
sub_customer_tf_next_interval
integer
Initial billing interval length in seconds for Toll-Free service
sub_customer_tf_duration
integer
Sub customer call duration for Toll-Free service accorging to billing intervals lengths
sub_customer_tf_amount
numeric
Sub customer amount for Toll-Free service
sub_customer_trm_rate
numeric
Sub customer rate for PSTN forwaring service
sub_customer_trm_connection_fee
numeric
Sub customer connection fee for PSTN forwaring service
sub_customer_trm_initial_interval
integer
Initial billing interval for PSTN forwaring service
sub_customer_trm_next_interval
integer
Next billing interval for PSTN forwaring service
sub_customer_trm_duration
integer
Sub customer call duration for PSTN forwaring service according with billing intervals lengths
sub_customer_trm_amount
numeric
Sub customer amount for PSTN forwaring service
out_pop_id

integer
DIDWW exit PoP that send call to customer. Possible values:

  • 1 USA New-York
  • 2 DE Frankfurt
  • 4 USA Los-Angeles
  • 5 USA Miami
  • 6 Singapore
transport_protocol_id

integer
Transport protocol used beween DIDWW and customer gateways: Possible values:

  • 1 UDP
  • 2 TCP
user_agent
string
User-Agent and Server header values from customer gateways
is_redirected
boolean
if call was redirected by 3xx SIP response this flag will be true
early_media_present
boolean
if early media stream was present from customer gateways this flag will be true

Warning

These attributes has been used since 31.10.2019

Batching

Our system sends CDR in batches, so every HTTP POST request can contain multiple CDRs. Maximum batch size is 1000. Customer API should be able to process multiple CDRs in same request

Error handling

Every time when customer API respond 2xx HTTP code our system counts all CDRs sent in request as processed and deletes them from queue. In case of HTTP error(non 2xx response or timeout) we will store CDRs in queue and retry delivery after some timeout.

Warning

Queue length is limited by 10000 records per customer, so long customer API downtime will cause data loss. The same goes for low API performance. Thereby CDR Streaming mechanism can’t be used as only way to receive CDRs. See API documentation for other CDR fetching mechanisms

IP addresses

Currently we are sending requests from IPv4 address 46.19.210.148 and IPv6 address 2a01:ad00:2:3::134