JSON API » calls » calls/active/list
Lists active calls.
Input parameters
Requires authentication and the callshop, telephone line reports, or user role privileges.
| Name | Type | Description | Required | Default value | 
|---|---|---|---|---|
| auth_username | String | Authentication username. | Yes | |
| auth_password | String | Authentication password. | Yes | |
| customer | String or integer | Customer to get calls for. See below for more details. | No | Customer of authentication user. | 
| recursive | Integer | 1 to include sub-customers recursively, 0 not to. Ignored if customer is "all" | No | 0 | 
| count | Integer | 1 to return a count, 0 to return full data. | No | 0 | 
| direction | String | Direction of calls to get. See below for more details. | No | Empty string. | 
| sort | String | Field to sort by. "cnumber", "ctype", "direction", "dnumber", "dtype", "machine", "peer", "scustomer", "snumber", "stype", or "uniqueid". | No | "start" | 
| descending | Integer | 1 to sort descending, 0 not to. | No | 0 | 
| names | Integer | 1 to set number names, 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 | The call ID of a specific call. | No | Empty string. | 
| phone | String | Source telephone line. Empty string for any, including calls not made by telephone lines. | No | Empty string. | 
| 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. | 
| machines | String | Comma separated list of machines IDs to get calls for. Empty string for all. | No | Empty string. | 
| limit | Integer | The maximum results to return. 0 for all. Ignored if count is "1". | No | 0 | 
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 directly under customer of authentication user. | 
| "system" | All customers on system. | 
The direction field may have the following values:
| Field value | Returns calls for | 
|---|---|
| Empty string or field not set | All calls. | 
| "in" | Inbound calls only. | 
| "internal" | Internal calls only. | 
| "in_out" | Inbound and outbound calls, but not internal. | 
| "out | Outbound calls only. | 
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. | 
Data returned
An array of fields, one row for each call leg. Commonly used fields are:
| Name | Type | Description | 
|---|---|---|
| answered | Integer | Unix timestamp the call was answered at. 0 if unanswered. | 
| billing_peer | Integer | ID of the peer used for billing if outbound, else 0. | 
| callerid_external | String | Callerid that will be sent if routed to an external destination. | 
| callerid_internal | String | Callerid that will be sent if routed to an internal destination. | 
| callername_external | String | Caller name that will be sent if routed to an external destination. | 
| callername_internal | String | Caller name that will be sent if routed to an internal destination. | 
| callid | String | A unique identifier for the call. All legs of the same call have the same callid. | 
| channel | String | Asterisk channel. | 
| cnumber | String | Called number. | 
| ctype | String | Called type. Usually empty string. | 
| dcustomer | Integer | ID of the customer owning the destination the call is routed to. | 
| dnumber | String | Destination number the call is routed to. | 
| dtype | String | Destination type the call is routed to. | 
| ingroup | Integer | ID of the inbound group used to bill the call if inbound, else 0. | 
| machine | Integer | ID of the Asterisk machine handling the call. | 
| outgroup | Integer | ID of the outbound group used to bill the call if outbound, else 0. | 
| overmax | Integer | 1 if the call will be billed as over maximum calls, 0 if not. | 
| peer | Integer | ID of the peer the call is sent to if outbound, else 0. | 
| recording | String | Path of recording. Empty string if not recording. | 
| scustomer | Integer | ID of the customer making the call, and to which the call will be billed. | 
| sip_callid | String | SIP callid if the call arrived via SIP, else empty string. | 
| snumber | String | Source number the call came from. | 
| spresent | Integer | Presentation of the source number. | 
| start | Integer | Unix timestamp the call started at. | 
| status | String | The current status of the call. | 
| stype | String | Source type the call came from. | 
| uniqueid | String | A unique identifier for the call leg. Each leg in a call has a different uniqueid. | 
Example: With required parameters
http://enswitch.example.com/api/json/calls/active/list/?auth_username=user;auth_password=password{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":[ { "uniqueid":"1234567890.123456", "start":1234567890, ... }, { "uniqueid":"1234567890.123457", "start":1234567890, ... } ] }
Change history
| Version | Changes | 
|---|---|
| 4.4 | smatch, snumber, callername_match, callername_number, cmatch, cnumber, dmatch, dnumber, phone, machines, limit, count and recursive parameters added. Removed "recursive" option for "customer" parameter. | 
| 3.13 | Function added. | 
