Create CDR Subscriptions
Create a subscription to receive CDR events. You define a URL that will receive a callback any time a CDR event on the PBX matches the parameters of the subscription.
/?object=event&action=create&model=cdrRequest URL
https://uc.hopdial.com/ns-api/?object=event&action=create&model=cdrSend your access token in the Authorization: Bearer header. Body parameters are sent as application/x-www-form-urlencoded. New to the API? Start with authentication and rate limits.
Event Callbacks
CDR events that match the subscription parameters will result in a HTTP(S) post from the PBX to the post_url defined in the subscription. This post will contain a payload that looks like the example below:
[
{
"action": "INSERT",
"batch_dura": "10",
"batch_hold": "0",
"batch_tim_ans": "2025-02-24 18:55:20",
"batch_tim_beg": "2025-02-24 18:55:20",
"by_action": "ForwardAlways",
"by_callid": "20250224185520014272-7a7a7a7661d06d7d0281ecd502b4679",
"by_domain": "company.10101.service",
"by_group": "Support",
"by_id": "7477778100",
"by_sub": "3001",
"by_territory": "10101",
"cdr_index": "0",
"codec": "G.711 u-law",
"duration": "10",
"hostname": "pbx-node1.example.net",
"mac": "AA:FF:AA:11:22:00",
"object": "cdr",
"orig_callid": "bc6d3146-6d83-123e-21a0-005056842248",
"orig_from_host": "sip.xipx.com",
"orig_from_name": "ABC TELECOM",
"orig_from_uri": "sip:[email protected]",
"orig_from_user": "17775551200",
"orig_id": "17775551200",
"orig_ip": "222.254.22.1",
"orig_logi_uri": "sip:[email protected]",
"orig_match": "sip*@bypass-media.g1-*.outboundproxy.com",
"orig_req_host": "bypass-media.g1-sw01.outboundproxy.com",
"orig_req_uri": "sip:[email protected]",
"orig_req_user": "18887391200",
"orig_to_host": "bypass-media.g1-sw01.outboundproxy.com",
"orig_to_uri": "sip:[email protected]",
"orig_to_user": "18887391200",
"orig_type": "gateway",
"release_code": "begin",
"release_text": "New Forward Leg",
"rly_cnt_a": "82048",
"rly_cnt_b": "54524",
"rly_prt_0": "35520",
"rly_prt_a": "207.223.67.137:58424",
"rly_prt_b": "75.98.50.46:19144",
"servedCallId": "bc6d3146-6d83-123e-21a0-005056842248",
"term_callid": "20250224185520014272-7e6c15a2661d06d7d0281ecd502b4679",
"term_domain": "acme.12345.service",
"term_group": "Support",
"term_id": "7577779900",
"term_ip": "55.99.55.44",
"term_logi_uri": "sip:[email protected]",
"term_match": "sip:[email protected]",
"term_sub": "3001",
"term_territory": "10111",
"term_to_uri": "sip:[email protected]",
"time": "2025-02-24 18:55:30",
"time_answer": "2025-02-24 18:55:20",
"time_holding": "0",
"time_release": "2025-02-24 18:55:30",
"time_start": "2025-02-24 18:55:20",
"time_talking": "10",
"unknownHeaders": {
"P-Attestation-Indicator": "A",
"P-hint": "inbound",
"X-FS-Support": "update_display,send_info",
"X-OrigCallID": "bc6d3146-6d83-123e-21a0-005056842248",
"X-RcvFrom": "34.226.36.35"
},
"node_ts_tx": "2025-02-24 18:55:30"
}
]Parameters
| Name | Type | Description |
|---|---|---|
modelrequiredbody | string | Must be "cdr". This will cdr data to the specified endpoint |
domainrequiredbody | string | Specify which domain you would like to receive events for. Use * to receive for all domains |
userrequiredbody | string | Specify which user to receive events for. Use * to receive for all users |
post_urlrequiredbody | string | HTTP or HTTPS endpoint. This is where HopDial will POST the events |
expiresoptionalbody | string (date) | Specifies when the subscription will expire. (Set date a couple days in the future as server time calculates the expiration incorrectly) |
Example request
curl --location 'https://uc.hopdial.com/ns-api/' \
--header 'Authorization: Bearer {REDACTED}' \
--form 'object="event"' \
--form 'action="create"' \
--form 'model="cdr"' \
--form 'domain="acmecorp.12345.service"' \
--form 'post_url="https://www.acmecorp.com/cdr/cdrlistener"'Responses
<?xml version="1.0" encoding="UTF-8"?>
<xml>
<Subscription>
<model>cdr</model>
<scope>Office Manager</scope>
<territory>12345</territory>
<domain>acmecorp.12345.service</domain>
<user>*</user>
<post_url>https://www.acmecorp.com/callback/cdrlistener</post_url>
<owner_uid>[email protected]</owner_uid>
<expires>2045-01-24 01:01:37</expires>
<subscription_id>55555a55aa555a5aaaa5a5a5aaa555555</subscription_id>
</Subscription>
</xml>{}More Subscriptions endpoints
Webhooks: get call, CDR, recording, presence, agent, and audit events POSTed to your own URL.
Need a Client ID and Client Secret or help with this endpoint? Contact HopDial support or call (866) 305-0407.