JSON API » cdrs » cdrs/list
Gets the fields of completed calls.
Input parameters
Requires authentication and the callshop or cdrs role privileges.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
start | Integer | Start Unix timestamp. | Recommended | 0 |
end | Integer | End Unix timestamp. | Recommended | Now. |
archive | Integer | 1 to include archived calls, 0 not to. | No | 0 |
callername_match | String | Caller name match. See below for more details. | No | "contains" |
callername_number | String | Caller name. Empty string for any. | No | Empty string. |
callid | String | Callid. Empty string for any. | No | Empty string. |
cost_customer | String or integer | Customer to get costs for. "scustomer" for the scustomer of the call, "card" for calling card making the call, or ID of customer. | No | Customer of authentication user. |
customer | String or integer | Customer to get calls for. See below for more details. | No | Customer of authentication user. |
detail | String | "call" to return a list of calls, "leg" to return a list of call legs. | No | "leg" |
direction | String | Direction of calls to get. See below for more details. | No | Empty string. |
invoice | Integer | ID of invoice. 0 for any. | No | 0 |
limit | Integer | The maximum results to return. 0 for all. | No | 0 |
offset | Integer | The result to start at. 0 for the first. | No | 0 |
peer | Integer | ID of peer. 0 for any. | No | 0 |
phone | String | Source telephone line. Empty string for any, including calls not made by telephone lines. | No | Empty string. |
recurse | Integer | 1 to include sub-customers recursively, 0 not to. | No | 0 |
status | String | Call status. Empty string for any. | No | Empty string. |
talktime_maximum | Integer | Maximum talktime in seconds. -1 for no limit. | No | -1 |
talktime_minimum | Integer | Minimum talktime in seconds. | No | 0 |
stype | String | Source type. Empty string for any. | No | Empty string. |
smatch | String | Source match. See below for more details. | No | "contains" |
snumber | String | Source number. Empty string for any. | No | Empty string. |
ctype | String | Called type. Empty string for any. | No | Empty string. |
cmatch | String | Called match. See below for more details. | No | "contains" |
cnumber | String | Called number. Empty string for any. | No | Empty string. |
dtype | String | Destination type. Empty string for any. | No | Empty string. |
dmatch | String | Destination match. See below for more details. | No | "contains" |
dnumber | String | Destination number. Empty string for any. | No | Empty string. |
sort | String | Field 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" |
descending | Integer | 1 to sort descending, 0 not to. | No | 0 |
voipmonitor_url | Integer | 1 to return the VoIPmonitor URL for the call (if configured), 0 not to. | No | 0 |
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 value | Returns calls for |
---|---|
Field not set | Customer of authentication user. |
ID of a customer | That 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 value | Returns calls for |
---|---|
Field not set | All calls. |
"in" | Inbound calls only. |
"in_out" | Inbound or outbound calls only. |
"internal" | Internal calls only. |
"out | Outbound calls only. |
The match fields may have the following values:
Field value | Returns 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
Code | Description |
---|---|
200 | Success. |
400 | Invalid input parameters specified. Check the key and message fields for more details. |
401 | The authentication details provided are invalid. |
402 | Your role does not allow this. |
403 | Your rate plan does not allow this. |
500 | An 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
Version | Changes |
---|---|
4.1 | detail parameter added. direction input parameter updated. |
4.0 | voipmonitor_url input parameter added. |
3.14 | end input parameter changed to return data < value instead of <= value. |
3.13 | Function added. |