Перейти к содержимому

Get CDRs of an account

Это содержимое пока не доступно на вашем языке.

getAccountCDRs returns the call records (CDRs) of the accounts that belong to the authenticated customer. Use it to pull calls into your own billing or reporting. Without filters it returns the calls of all your accounts for the last hour.

Name Type Required Description
i_account int no ID of the account. Default: all accounts of the authenticated customer
start_date string no Return calls from this time, UTC, in the format %H:%M:%S.000 GMT %a %b %d %Y, for example 09:57:29.000 GMT Wed Nov 18 2009. Default: one hour ago
end_date string no Return calls up to this time, same format as start_date
cli string no Return calls whose CLI, after translation rules, is like this pattern. Use % for any characters
cld string no Return calls whose CLD, after translation rules, is like this pattern
type string no Which calls to return, see the values of type. Default: non_zero_and_errors
i_cdr int no Return only the CDR with this ID
offset int no Skip this many CDRs
limit int no Return at most this many CDRs
Value Returns
non_zero_and_errors Calls with a non-zero duration and calls that failed with an internal error (default)
non_zero Calls with a non-zero duration
all All calls
complete Completed calls: result is 0
incomplete Calls that failed with a SIP response: result is greater than 0
errors Calls that failed with an internal error: result is less than 0
Name Type Description
result string OK
cdrs array The CDRs, each a struct with the fields below

Each CDR has these fields:

Name Type Description
i_cdr int ID of the CDR
i_call int ID of the call. Pass it to getCDRSDP to read its SDP
call_id string SIP Call-ID of the call
i_account int ID of the account
connect_time string Time the call was answered, in the start_date format
duration double Duration of the call, in seconds
billed_duration int Billed duration, in seconds
plan_duration int Seconds covered by the account’s minute plan
cli string CLI after the incoming translation rules
cld string CLD after the incoming translation rules
cli_in string CLI as received, before any translation
cld_in string CLD as received, before any translation
lrn_cld string LRN of the CLD after translation
lrn_cld_in string LRN of the CLD as received
p_asserted_id string P-Asserted-Identity of the call
remote_party_id string Remote-Party-ID of the call
cost string Amount charged to the account, in the account’s currency
country string Country of the dialled destination
description string Description of the dialled destination
prefix string Prefix of the rate applied
area_name string Area name of the prefix
price_1, price_n double First and next interval prices of the rate
interval_1, interval_n int First and next billing increments of the rate, in seconds
connect_fee double Connect fee of the tariff applied to the call
post_call_surcharge double Post-call surcharge of the tariff applied to the call
free_seconds int Free seconds of the tariff
grace_period int Grace period of the tariff
accessibility_cost double Accessibility surcharge from the account’s service plan
result int Call result: 0 for a completed call, a SIP response code such as 486 for a failed call, a negative value for an internal error
release_source string Which side ended the call
remote_ip string IP address the call came from
protocol string Signalling protocol, for example SIP
user_agent string User agent of the caller
delay double Total delay of the call
pdd1xx double Time from sending the outgoing INVITE to the first provisional or final reply other than 100 Trying
request
from datetime import datetime, timedelta, timezone
FMT = "%H:%M:%S.000 GMT %a %b %d %Y" # needs English day and month names
end = datetime.now(timezone.utc)
start = end - timedelta(days=1)
call("getAccountCDRs", {
"i_account": 3092,
"start_date": start.strftime(FMT),
"end_date": end.strftime(FMT),
"type": "complete",
"limit": 100,
})
response
{
"result": "OK",
"cdrs": [
{
"i_cdr": 774512,
"i_call": 1520034,
"call_id": "3c2a7f1e-90b4@192.0.2.10",
"i_account": 3092,
"connect_time": "14:02:11.000 GMT Thu Jan 15 2026",
"duration": 125.4,
"billed_duration": 126,
"cli": "441632960001",
"cld": "441632960123",
"cost": "0.0630",
"country": "United Kingdom",
"description": "United Kingdom - Fixed",
"result": 0,
"remote_ip": "192.0.2.10",
"protocol": "SIP",
# … the other fields
},
],
}