Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Operator » API Get Active Agents
  •  
motlive

Messages: 6
Karma: 0
Send a private message to this user
Hi,

(Apologies for putting this in this forum, don't have access to the developer forum).

I have downloaded the Kerio API and using the Operator API can obtain information, however I am hoping to find a way to obtain the current queue and who is logged in, on dnd, or not logged in.

Had a look through the documentation but can't find a list of supported methods!

  •  
motlive

Messages: 6
Karma: 0
Send a private message to this user
anyone?

This is fundamental information in a contact centre environment as it allows managers to see who is logged in the phones without having to access Kerio directly.
  •  
Jan Pejša (Kerio)

Messages: 38
Karma: 3
Send a private message to this user
Hi,

I suggest that you download the "Kerio APIs Client Library for PHP" available on Kerio Developer Zone and I suggest to explore the source code Kerio Operator examples.

As a next step explore the Kerio Operator API (JSON-RPC) in the browser console - tab Net or Network (for Firefox or Chrome).

  •  
motlive

Messages: 6
Karma: 0
Send a private message to this user
Hi,

Thanks but that doesn't help. As mentioned I have already downloaded the API and looked through the documentation.

I have looked at the Kerio Operator examples but they don't show the available methods and what parameters are required.
  •  
Jan Pejša (Kerio)

Messages: 38
Karma: 3
Send a private message to this user
There are three methods to get status of Call Queues:
  • Status.getQueues
  • Status.getQueueAgents
  • Status.getQueueCallers


Examples of JSON sources (which can be captured in a browser developer console - e.g. Firebug):

request
{"jsonrpc":"2.0","id":1,"method":"Status.getQueues","params":{"query":{"start":0,"limit":-1,"orderBy":[]}}}

response
{"jsonrpc":"2.0","id":1,"result":{"result":{"guid":null,"errorMessage":{"message":"","positionalParameters":[],"plurality":1}},"queues":[{"NAME":"","MAX_CALLS_WAITING":0,"CALLS_WAITING":0,"WAITING_TIME":0,"WAITING_TIME_AVG":0,"CALLS_COMPLETED":0,"CALLS_ABANDONED":0,"LAST_RESET":0,"EXTENSIONS_ID":36,"queueStrategy":6,"EXTENSION_NUMBER":"28"}],"totalItems":1}}

...there is EXTENSIONS_ID 36 which can be used in another requests:

request
{"jsonrpc":"2.0","method":"Status.getQueueAgents","params":{"query":{},"extension":36},"id":1}

response
{"jsonrpc":"2.0","id":1,"result":{"agents":[{"EXTENSION_NUMBER":"10","EXTENSION":"SIP\/10","SIP_USERNAME":"10","MEMBERSHIP_TYPE":"dynamic","CALLS_ANSWERED":0,"LAST_ANSWERED_TIME":0,"STRATEGY_CALLS_ANSWERED":0,"STRATEGY_LAST_ANSWERED_TIME":0,"STATUS":1,"Location":"SIP\/10","EXTENSIONS_ID":"SIP\/10","USERS_ID":4,"USERNAME":"astra"}],"totalItems":1}}

request
{"jsonrpc":"2.0","method":"Status.getQueueCallers","params":{"query":{},"extension":36},"id":1}

response
{"jsonrpc":"2.0","id":1,"result":{"result":{"guid":null,"errorMessage":{"message":"","positionalParameters":[],"plurality":1}},"callers":[{"POSITION":"1","ID":"12","ID_NAME":"Cisco","WAITING_TIME":"4","channelId":"SIP\/12-000001c1"}],"totalItems":1}}
  •  
motlive

Messages: 6
Karma: 0
Send a private message to this user
Hi Jan,

Thanks for the information, its kind of set me in the right direction.

Unfortunately I am still unable to define the parameters correctly, having tried the following:

	/* Set query */
	$params = array(
		"query" => array(
    			 "extension" => '270'
          )        
	);


This is where I am getting stuck as I am unable to figure out what is required, and in what format.

[Updated on: Wed, 09 March 2016 13:16]

  •  
Jan Pejša (Kerio)

Messages: 38
Karma: 3
Send a private message to this user
try this:
	/* Set query */
	$params = array(
		"query" => array(),
    		"extension" => 270
	);
  •  
motlive

Messages: 6
Karma: 0
Send a private message to this user
Excellent. All done now. Before my last reply I tried similar code to what you posted but it didn't work (possibly had a typo).

For anyone else who might want to use it:

	/* Login */
	$session = $api->login($hostname, $username, $password);
	
/* Set query */
	$params = array(
		"query" => array(),
    		"extension" => 67,
	);

	$result = $api->sendRequest('Status.getQueueAgents', $params);
  
  $agents = $result['agents'];


The bit that confused me was the "EXTENSION_ID". I used the Status.getQueues method which then returned all our queues with an EXTENSION_ID. This then allowed me to get the agents for a specific queue. Oddly the actual queue dial code isn't the EXTENSION_ID.

[Updated on: Thu, 10 March 2016 19:21]

Previous Topic: Kerio Operator (missed call notifications for every call received)
Next Topic: No Audio vs Control
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Thu Feb 23 05:54:42 CET 2017

Total time taken to generate the page: 0.00923 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.