lehelg | 2017-04-19 13:52:19 UTC | #1
I am trying to observe several queues for the following statistics:
Active Calls Calls Waiting Active Agents
I am using /api/v2/analytics/queues/observations/query to observe the queue. I can pretty easily get the first two statistics using by POSTing the following:
{ "filter": { "type": "and", "clauses": [ { "type": "or", "predicates": [ { "dimension": "queueId", "value": queueIDs[0] }, { "dimension": "queueId", "value": queueIDs[1] }, { "dimension": "queueId", "value": queueIDs[2] } ] }, { "type": "or", "predicates": [ { "dimension": "mediaType", "value": "voice" } ] } ] }
However, this doesn't return the number of active agents. The only way I am able to retrieve that is by removing the second filter, for mediaType voice. The problem is that this query retrieves too much data, I would rather limit the results then have to sift through all of it in code. After reading the documentation, I think this query should do the trick, but it doesn't work:
{"filter": { "type": "and", "clauses": [ { "type": "or", "predicates": [ { "dimension": "queueId", "value": queueIDs[0] }, { "dimension": "queueId", "value": queueIDs[1] }, { "dimension": "queueId", value": queueIDs[2] } ] }, { "type": "or", "predicates": [ { "dimension": "mediaType", "value": "voice" }, { "dimension": "mediaType", "operator": "notExists" } ] } ] }, "metrics": [ "oWaiting", "oInteracting", "oActiveUsers" ] }
The result I receive is
{ "status": 400, "code": "bad.request", "message": "Unable to decompose query into a set of (null, mediaType) pairs.", "messageParams": {}, "contextId": "65f4a616-012a-4110-bb4c-dc51d6eb50bc", "details": [], "errors": [] }
I tried many different variations of my query, but most of them result in the above result. What else can I try?
--Lehel
tim.smith | 2017-04-19 15:38:29 UTC | #2
lehelg, post:1, topic:1199
The only way I am able to retrieve that is by removing the second filter, for mediaType voice.
This is the correct approach for your requirements. oActiveUsers is a stat based on the queue, not any media type. To get this statistic, you cannot filter by media type (and media type not exists isn't valid, as you've seen). You will need to retrieve the results and then look for oActiveUsers where the group only contains queueId and then look for oInteracting and oWaiting in the group that contains both queueId and mediaType=voice.
lehelg | 2017-04-21 13:12:48 UTC | #3
Thanks! One last question, should the metrics filter actually filter my results if I POST this:
{"filter": { "type": "and", "clauses": [ { "type": "or", "predicates": [ { "dimension": "queueId", "value": queueIDs[0] }, { "dimension": "queueId", "value": queueIDs[1] }, { "dimension": "queueId", value": queueIDs[2] } ] } ] }, "metrics": [ "oWaiting", "oInteracting", "oActiveUsers" ]
I am still getting all the metrics returned to me.
tim.smith | 2017-04-21 14:38:52 UTC | #4
I'm seeing that the filter is working with the exception of the oOffQueueUsers metric. It is always being included regardless of the filter. I've opened AR-5223 for this. Here's the query I used:
{
"filter": {
"type": "or",
"predicates": [
{
"type": "dimension",
"dimension": "queueId",
"operator": "matches",
"value": "636f60d4-04d9-4715-9350-7125b9b553db"
}
]
},
"metrics": [
"oInteracting",
"oActiveQueues",
"oWaiting"
]
}
system | 2017-08-28 19:33:58 UTC | #5
This post was migrated from the old Developer Forum.
ref: 1199