JSON API » cdrs » cdrs/list

Gets the fields of completed calls.

Input parameters

Requires authentication and the callshop or cdrs role privileges.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
startIntegerStart Unix timestamp.Recommended0
endIntegerEnd Unix timestamp.RecommendedNow.
archiveInteger1 to include archived calls, 0 not to.No0
callername_matchStringCaller name match. See below for more details.No"contains"
callername_numberStringCaller name. Empty string for any.NoEmpty string.
callidStringCallid. Empty string for any.NoEmpty string.
cost_customerString or integerCustomer to get costs for. "scustomer" for the scustomer of the call, "card" for calling card making the call, or ID of customer.NoCustomer of authentication user.
customerString or integerCustomer to get calls for. See below for more details.NoCustomer of authentication user.
detailString"call" to return a list of calls, "leg" to return a list of call legs.No"leg"
directionStringDirection of calls to get. See below for more details.NoEmpty string.
invoiceIntegerID of invoice. 0 for any.No0
limitIntegerThe maximum results to return. 0 for all.No0
offsetIntegerThe result to start at. 0 for the first.No0
peerIntegerID of peer. 0 for any.No0
phoneStringSource telephone line. Empty string for any, including calls not made by telephone lines.NoEmpty string.
recurseInteger1 to include sub-customers recursively, 0 not to.No0
statusStringCall status. Empty string for any.NoEmpty string.
talktime_maximumIntegerMaximum talktime in seconds. -1 for no limit.No-1
talktime_minimumIntegerMinimum talktime in seconds.No0
stypeStringSource type. Empty string for any.NoEmpty string.
smatchStringSource match. See below for more details.No"contains"
snumberStringSource number. Empty string for any.NoEmpty string.
ctypeStringCalled type. Empty string for any.NoEmpty string.
cmatchStringCalled match. See below for more details.No"contains"
cnumberStringCalled number. Empty string for any.NoEmpty string.
dtypeStringDestination type. Empty string for any.NoEmpty string.
dmatchStringDestination match. See below for more details.No"contains"
dnumberStringDestination number. Empty string for any.NoEmpty string.
sortStringField to sort by. "callid", "cnumber", "cost", "ctype", "dcustomer", "direction", "dnumber", "dtype", "end", "name", "peer", "scustomer", "snumber", "start", "status", "stype", "talktime", "totaltime", or "uniqueid".No"start"
descendingInteger1 to sort descending, 0 not to.No0
voipmonitor_urlInteger1 to return the VoIPmonitor URL for the call (if configured), 0 not to.No0

Failure to specify the start and end may put a heavy load on the database. Using voipmonitor_url=1 may be very slow, and may put a heavy load on the VoIPmonitor server if returning many CDRs.

The customer field may have the following values:

Field valueReturns calls for
Field not setCustomer of authentication user.
ID of a customerThat customer.
"all"All customers under customer of authentication user.
"external"All externally billed customers under customer of authentication user.
"postpaid"All postpaid customers under customer of authentication user.
"prepaid"All prepaid customers under customer of authentication user.
"system"All customers on system.

The direction field may have the following values:

Field valueReturns calls for
Field not setAll calls.
"in"Inbound calls only.
"in_out"Inbound or outbound calls only.
"internal"Internal calls only.
"outOutbound calls only.

The match fields may have the following values:

Field valueReturns calls with destinations that
"contains"Contain the corresponding number field.
"end"End with the corresponding number field.
"exact"Equal the corresponding number field.
"start"Start with the corresponding number field.

Responses

CodeDescription
200Success.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.
403Your rate plan does not allow this.
500An internal error occurred. Check the key and message fields for more details.

Data returned

An array of fields, one row for each call leg. Costs are returned in the currency of the authentication user.

Example: With required and recommended parameters

http://enswitch.example.com/api/json/cdrs/list/?auth_username=user;auth_password=password;start=1230000000;end=1240000000

{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":[ { "uniqueid":"1234567890.123456", "start":1234567890, ... }, { "uniqueid":"1234567890.123457", "start":1234567890, ... } ] }

Change history

VersionChanges
4.1detail parameter added. direction input parameter updated.
4.0voipmonitor_url input parameter added.
3.14end input parameter changed to return data < value instead of <= value.
3.13Function added.