JSON API » calls » calls/active/list

Lists active calls.

Input parameters

Requires authentication and the callshop, telephone line reports, or user role privileges.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
customerString or integerCustomer to get calls for. See below for more details.NoCustomer of authentication user.
directionStringDirection of calls to get. See below for more details.NoEmpty string.
sortStringField to sort by. "cnumber", "ctype", "direction", "dnumber", "dtype", "machine", "peer", "scustomer", "snumber", "stype", or "uniqueid".No"start"
descendingInteger1 to sort descending, 0 not to.No0
namesInteger1 to set number names, 0 not to.No0
callidStringThe call ID of a specific call.NoEmpty string.

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 directly under customer of authentication user.
"recursive"All customers under customer of authentication user, recursively.
"system"All customers on system.

The direction field may have the following values:

Field valueReturns calls for
Empty string or field not setAll calls.
"in"Inbound calls only.
"internal"Internal calls only.
"in_out"Inbound and outbound calls, but not internal.
"outOutbound calls only.

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.

Data returned

An array of fields, one row for each call leg. Commonly used fields are:

NameTypeDescription
answeredIntegerUnix timestamp the call was answered at. 0 if unanswered.
billing_peerIntegerID of the peer used for billing if outbound, else 0.
callerid_externalStringCallerid that will be sent if routed to an external destination.
callerid_internalStringCallerid that will be sent if routed to an internal destination.
callername_externalStringCaller name that will be sent if routed to an external destination.
callername_internalStringCaller name that will be sent if routed to an internal destination.
callidStringA unique identifier for the call. All legs of the same call have the same callid.
channelStringAsterisk channel.
cnumberStringCalled number.
ctypeStringCalled type. Usually empty string.
dcustomerIntegerID of the customer owning the destination the call is routed to.
dnumberStringDestination number the call is routed to.
dtypeStringDestination type the call is routed to.
ingroupIntegerID of the inbound group used to bill the call if inbound, else 0.
machineIntegerID of the Asterisk machine handling the call.
outgroupIntegerID of the outbound group used to bill the call if outbound, else 0.
overmaxInteger1 if the call will be billed as over maximum calls, 0 if not.
peerIntegerID of the peer the call is sent to if outbound, else 0.
recordingStringPath of recording. Empty string if not recording.
scustomerIntegerID of the customer making the call, and to which the call will be billed.
sip_callidStringSIP callid if the call arrived via SIP, else empty string.
snumberStringSource number the call came from.
spresentIntegerPresentation of the source number.
startIntegerUnix timestamp the call started at.
statusStringThe current status of the call.
stypeStringSource type the call came from.
uniqueidStringA 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

VersionChanges
3.13Function added.