Call Data API
Call Center Stats PRO
includes a simple yet powerful web service based on REST
technology. With this, it is possible to access all the reports and functions available in the CCStats PRO user interface, but in JSON format. The call as a
REST
function is made by opening a URL as follows: bash
https://pbx_domain/stats/rest/index.php?entity=value
Where,
pbx_domain
is the IP address or domain where Asternic Call Center PRO
is installed. "stats" is the web directory, and "value" is the available REST
entity or function. The available functions are:
- Reports
- Realtime
- Queues
- Agents
- Call
- Search
It's important to note that all
REST
connections and functions can be tested with a standard web browser. The results will be displayed as a web page in JSON format. INFO
Asternic Call Center Stats PRO
will request the username and password defined in Settings → Users and will restrict the information returned according to what is configured for the user.Entities: Reports
This entity can be called as follows:
bash
https://pbx_domain/stats/rest/index.php?entity=reports
The URL above will display the available reports that can be requested:
bash
{
"data": [
{
"report" : "answered_calls_detail"
},
{
"report" : "answered_calls_by_queue"
},
{
"report" : "answered_calls_by_agent"
},
{
"report" : "answered_calls_by_url"
},
{
"report" : "answered_calls_by_did"
},
{
"report" : "answered_calls_by_holdtime"
},
{
"report" : "answered_calls_by_event"
}
]
}
It is possible to select any report and use it as appropriate.
Example of a call detail report for answered calls
The example call is made as follows:
bash
https://pbx_domain/qstats/rest/index.php?entity=reports/answered_calls_detail
In this case, the current date will be displayed because no date range filter has been defined. If there is no data to display, the response will appear as shown below:
bash
{
"page":"1",
"total":"0",
"records":"0",
"rows": []
}
There are several variables that can be used with the
GET
method to display conditional results for the entity: - 1. start: Start date in year-month-day (yyyy-mm-dd) format.
Example:?entity=reports/answered_calls_detail&start=2012-08-01
- 2. end: End date in year-month-day (yyyy-mm-dd) format.
Example:?entity=reports/answered_calls_detail&start=2012-08-01&end=2012-08-02
- 3. secondstart: Time of day in seconds to display the start time within a range.
Example:?entity=reports/answered_calls_detail&secondsstart=2016551
- 4. secondsend: Time of day in seconds to display the ending time within a range.
Example:?entity=reports/answered_calls_detail&secondsend=2019999
- 5. agent: For "_by_agent" reports, you can filter by agent.
- 6. queue: For _by_queue reports, you can filter by queue.
It's possible to use all of these variables together to create a precise report query. Here's an example:
bash
https://pbx_domain/stats/rest/index.php?entity=reports/answered_calls_by_queue&start=2016-08-01&end=2016-08-10
and the result:
bash
{
"page":"1",
"total":"1",
"records":"6",
"rows": [
{
"Queue" : "2000",
"Received" : "165",
"% Calls" : "71.12"
},
{
"Queue" : "2001",
"Received" : "3",
"% Calls" : "1.29"
},
{
"Queue" : "2002",
"Received" : "60",
"% Calls" : "25.86"
},
{
"Queue" : "2003",
"Received" : "2",
"% Calls" : "0.86"
},
{
"Queue" : "2006",
"Received" : "1",
"% Calls" : "0.43"
},
{
"Queue" : "2007",
"Received" : "1",
"% Calls" : "0.43"
}
]
}
Another example of answers_calls_detail showing detailed calls:
bash
https://pbx_domain/stats/rest/index.php?entity=reports/answered_calls_detail&start=2012-08-01&end=2012-08-10
and the result:
bash
{
"page":"1",
"total":"1",
"records":"232",
"rows": [
{
"datetime" : "01-08-2016 10:31:21",
"queue" : "2002",
"agent" : "Travis Spencer",
"callerid" : "4787574818",
"event" : "COMPLETEAGENT",
"waitTime" : "10",
"ringTime" : "10",
"callTime" : "94",
"agentName" : "Travis Spencer",
"queueName" : "2002",
"recording" : "test.wav",
"uniqueid" : "1327498260.2637",
"callflow" : "/asternicjquery/rest/index.php?entity=call/1327498260.2637",
"url" : "www.lala.com",
"did" : ""
},
{
"datetime" : "01-08-2016 10:53:45",
"queue" : "2002",
"agent" : "Travis Spencer",
"callerid" : "2568314606",
"event" : "COMPLETEAGENT",
"waitTime" : "13",
"ringTime" : "13",
"callTime" : "63",
"agentName" : "Travis Spencer",
"queueName" : "2002",
"recording" : "test.wav",
"uniqueid" : "1327499602.2681",
"callflow" : "/asternicjquery/rest/index.php?entity=call/1327499602.2681",
"url" : "www.lala.com",
"did" : ""
},
{
"datetime" : "01-08-2016 11:14:02",
"queue" : "2000",
"agent" : "Regina Spek",
"callerid" : "5082817600",
......data continues......
In the output from the last example, it's important to note a property called "callflow" that displays a link to the "call" entity, which will be detailed later in this documentation. The "call" entity displays detailed information about a specific call.
Entities: Queues
This entity can be called as follows:
bash
https://pbx_domain/stats/rest/index.php?entity=queues
Calling this entity will display the
queues
available in Call Center Stats PRO
. It will look something like this:bash
{
"data": [
{
"queue_id" : "2",
"queue" : "2000",
"queue_name" : "2000"
},
{
"queue_id" : "8",
"queue" : "2001",
"queue_name" : "2001"
},
{
"queue_id" : "4",
"queue" : "2002",
"queue_name" : "2002"
},
{
"queue_id" : "5",
"queue" : "2003",
"queue_name" : "2003"
},
{
"queue_id" : "1",
"queue" : "2005",
"queue_name" : "2005"
},
{
"queue_id" : "3",
"queue" : "2006",
"queue_name" : "2006"
},
{
"queue_id" : "6",
"queue" : "2007",
"queue_name" : "2007"
},
{
"queue_id" : "9",
"queue" : "2009",
"queue_name" : "2009"
},
{
"queue_id" : "-1",
"queue" : "ALL",
"queue_name" : "ALL"
},
{
"queue_id" : "7",
"queue" : "NONE",
"queue_name" : "NONE"
}
]
}
To get information about a specific
queue
, you can add the "queue_id" identifier to the request as follows: bash
https://dominio_pbx/stats/rest/index.php?entity=queues/queue_id
Result:
bash
{
"data": [
{
"queue_id" : "6",
"queue" : "2007",
"queue_name" : "2007"
}
]
}
Entities: Agents
This entity can be called as follows:
bash
https://pbx_domain/stats/rest/index.php?entity=agents
When you call this entity, the
agents
registered with Call Center Stats PRO
will be displayed. It will look something like this:bash
{
"data": [
{
"agent_id" : "-1",
"agent" : "ALL",
"agent_name" : "ALL"
},
{
"agent_id" : "6",
"agent" : "Andy Fisher",
"agent_name" : "Andy Fisher"
},
{
"agent_id" : "16",
"agent" : "B.Obama",
"agent_name" : "B.Obama"
},
{
"agent_id" : "14",
"agent" : "Boris G.",
"agent_name" : "Boris G."
},
{
"agent_id" : "7",
"agent" : "Daniel L.",
"agent_name" : "Daniel L."
},
{
"agent_id" : "11",
"agent" : "David Haseholf",
......data continues......
You can choose a specific agent to call the entity in this way by placing its "agent_id" identifier in the request path:
bash
https://pbx_domain/stats/rest/index.php?entity=agents/agent_id
Entities: Call
The call entity displays detailed information about a call identified by the entity's "unique_id" variable. To use this entity, use the following URL:
bash
https://pbx_domain/stats/rest/index.php?entity=call/13448674833.5314
And the result will show something similar to the following:
bash
{
"totalpages": "1",
"currpage": "1",
"totalrecords": "3",
"data": [
{
"id" : "1",
"uniqueid" : "1327498260.2637",
"datetime" : "2016-08-01 10:31:11",
"queue" : "2002",
"agent" : "NONE",
"event" : "ENTERQUEUE",
"info1" : "www.lala.com",
"info2" : "4787574818",
"info3" : "",
"info4" : "",
"info5" : "Sale",
"agentName" : "NONE",
"queueName" : "2002"
},
{
"id" : "2",
"uniqueid" : "1327498260.2637",
"datetime" : "2016-08-01 10:31:21",
"queue" : "2002",
"agent" : "Travis Spencer",
"event" : "CONNECT",
"info1" : "10",
"info2" : "1327498271.2638",
"info3" : "7",
"info4" : "",
"info5" : "",
"agentName" : "Travis Spencer",
"queueName" : "2002"
},
{
"id" : "3",
"uniqueid" : "1327498260.2637",
"datetime" : "2016-08-01 10:32:55",
"queue" : "2002",
"agent" : "Travis Spencer",
"event" : "COMPLETEAGENT",
"info1" : "10",
"info2" : "94",
"info3" : "1",
"info4" : "",
"info5" : "",
"agentName" : "Travis Spencer",
"queueName" : "2002"
}
]
}
In the example above, you can see detailed events for the call identified by the field used as "unique_id". The first row shows the
queue
entry event (ENTERQUEUE), the next row shows the (CONNECT) connection event, and finally the last row corresponds to the (COMPLETECALLER) call completion event.INFO
The
Asterisk
queue application generates a log with several events indicating the status and actions for all incoming calls. The reports entity section explains each event and the related fields.Entities: Realtime
The real-time entity instantly captures the status of an
Asterisk
queue
, agent status, current day statistics, and more. To request this entity, use the parameter as follows:bash
https://pbx_domain/stats/rest/index.php?entity=realtime
You can get a result like the one shown below:
bash
{
"waiting calls": {
"OUTBOUND": {},
"Test": {},
"saliente": {},
"100": {
"1": {
"calleridNum": "asterisk",
"calleridName": "asterisk",
"waitTime": "2"
}
},
"101": {},
"102": {
"1": {
"calleridNum": "32080805",
"calleridName": "32080805",
"waitTime": "17"
}
},
"103": {}
}
,
"summary": {
"queue": {
"OUTBOUND": {
"Waiting": "0",
"Agents": "0",
"Penalty": "0",
"Logged Off": "0",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "0"
},
"Test": {
"Waiting": "0",
"Agents": "0",
"Penalty": "0",
"Logged Off": "0",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "0"
},
"saliente": {
"Waiting": "0",
"Agents": "0",
"Penalty": "0",
"Logged Off": "0",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "0"
},
"100": {
"Waiting": "1",
"Agents": "1",
"Penalty": "0",
"Logged Off": "1",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "2"
},
"101": {
"Waiting": "0",
"Agents": "1",
"Penalty": "0",
"Logged Off": "0",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "0"
},
"102": {
"Waiting": "1",
"Agents": "1",
"Penalty": "1",
"Logged Off": "0",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "17"
},
"103": {
"Waiting": "0",
"Agents": "0",
"Penalty": "0",
"Logged Off": "1",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "0"
}
}
},
{
"waiting calls": {
"OUTBOUND": {},
"Test": {},
"saliente": {},
"100": {
"1": {
"calleridNum": "asterisk",
"calleridName": "asterisk",
"waitTime": "2"
}
},
"101": {},
"102": {
"1": {
"calleridNum": "32080805",
"calleridName": "32080805",
"waitTime": "17"
}
},
"103": {},
}
},
"summary": {
"queue": {
"OUTBOUND": {
"Waiting": "0",
"Agents": "0",
"Penalty": "0",
"Logged Off": "0",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "0"
},
"Test": {
"Waiting": "0",
"Agents": "0",
"Penalty": "0",
"Logged Off": "0",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "0"
},
"saliente": {
"Waiting": "0",
"Agents": "0",
"Penalty": "0",
"Logged Off": "0",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "0"
},
"100": {
"Waiting": "1",
"Agents": "1",
"Penalty": "0",
"Logged Off": "1",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "2"
},
"101": {
"Waiting": "0",
"Agents": "1",
"Penalty": "0",
"Logged Off": "0",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "0"
},
"102": {
"Waiting": "1",
"Agents": "1",
"Penalty": "1",
"Logged Off": "0",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "17"
},
"103": {
"Waiting": "0",
"Agents": "0",
"Penalty": "0",
"Logged Off": "1",
"Busy": "0",
"Paused": "0",
"Answered": "0",
"Unanswered": "0",
"Abandoned": "0",
"Abandon Rate": "0",
"Avg Wait": "0",
"Avg Duration": "0",
"Max. wait time": "0"
}
}
},
"agents": {
"OUTBOUND": {},
"Test": {},
"saliente": {},
"100": {},
"101": {},
"102": {},
"103": {}
}
}
The current status of the
queues
and agents
will be displayed in JSON format. It may need to be refreshed every 5 or 10 seconds to get the most up-to-date data. Entities: Search
This entity allows you to search the entire database for matching rows using the available variables.
Search example
bash
https://pbx_domain/stats/rest/index.php?entity=search&start=2016-08-01&end=2016-08-02&agent=Travis%20Spencer
From which a result similar to the following will be obtained:
bash
{
"page":"1",
"total":"1",
"records":"6",
"rows": [
{
"firstEvent" : "ENTERQUEUE",
"overflow" : "1",
"uniqueid" : "1327498260.2637",
"callerid" : "4787574818",
"dateStart" : "2016-08-01 10:31:11",
"dateEnd" : "2016-08-01 10:32:55",
"event" : "COMPLETEAGENT",
"agent" : "Travis Spencer",
"queue" : "2002",
"waitTime" : "10",
"talkTime" : "0",
"combinedWaitTime" : "104",
"totalDuration" : "104",
"recordingFilename" : "test.wav",
"agent_name" : "Travis Spencer",
"queue_name" : "2002",
"callflow" : "/asternicjquery/rest/index.php?entity=call/1327498260.2637"
},
{
"firstEvent" : "ENTERQUEUE",
"overflow" : "1",
"uniqueid" : "1327499602.2681",
"callerid" : "2568314606",
"dateStart" : "2016-08-01 10:53:32",
"dateEnd" : "2016-08-01 10:54:48",
"event" : "COMPLETEAGENT",
"agent" : "Travis Spencer",
"queue" : "2002",
"waitTime" : "13",
"talkTime" : "0",
"combinedWaitTime" : "76",
"totalDuration" : "76",
"recordingFilename" : "test.wav",
"agent_name" : "Travis Spencer",
"queue_name" : "2002",
"callflow" : "/asternicjquery/rest/index.php?entity=call/1327499602.2681"
},
{
"firstEvent" : "ENTERQUEUE",
"overflow" : "1",
"uniqueid" : "1327504603.2835",
"callerid" : "4234324839",
"dateStart" : "2016-08-01 12:16:53",
"dateEnd" : "2016-08-01 12:17:39",
"event" : "COMPLETEAGENT",
"agent" : "Travis Spencer",
......data continues......
If there is any incorrect or incomplete information, or additional information needs to be generated, please write to isscc@issabel.com.