Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vendors:cisco:uc:ece:webapi [2019/02/12 10:09]
gerardorourke [capacity - Agent Capacity Check]
vendors:cisco:uc:ece:webapi [2019/03/12 08:58] (current)
gerardorourke
Line 63: Line 63:
 </​code>​ </​code>​
  
-Example when 1 agent avilable ​that is allowed to handle 3 chats+Example when 1 agent available ​that is allowed to handle 3 chats
  
 Response: Response:
Line 118: Line 118:
 Note: Not sure how useful this is that different from Agent Availability. Note: Not sure how useful this is that different from Agent Availability.
 I do not see an ability to set Chat Queue length on ECE - but maybe could do in ICM? I do not see an ability to set Chat Queue length on ECE - but maybe could do in ICM?
 +
 +===== Sample PHP Code =====
 +==== Using Capacity API====
 +<code php>
 +<?php
 +header("​Content-Type:​ text/​plain"​);​
 +
 +$chatentry_id='​1001';​
 +$ecehostname='​ucce-ece-db-12.lab2.purplepi.ie';​
 +
 +$url = '​http://'​.$ecehostname.'/​system/​egain/​chat/​entrypoint/​capacity/'​.$chatentry_id;​
 +
 +$ch = curl_init($url);​
 +
 +    curl_setopt($ch,​ CURLOPT_RETURNTRANSFER,​ true);
 +    curl_setopt($ch,​ CURLOPT_HTTPGET,​ 1);
 +    curl_setopt($ch,​ CURLOPT_CONNECTTIMEOUT,​ 2); //​connection timeout
 +    curl_setopt($ch,​ CURLOPT_TIMEOUT,​ 3); //timeout in seconds for transaction
 +
 +    $output = curl_exec($ch);​
 +    $info = curl_getinfo($ch);​
 +    curl_close($ch);​
 +
 +echo $output;
 +
 +$xml_data = str_replace("​ns2:","",​$output);​
 +
 +echo $xml_data;
 +
 +$xml=simplexml_load_string($xml_data);​
 +
 +//echo $xml;
 +print_r($xml);​
 +
 +$agentcount=(int) $xml->​count;​
 +//echo "​AgentCount:​ $agentcount";​
 +
 +if ($agentcount>​0) echo "​\n$agentcount Agents Available";​
 +if ($agentcount==0) echo "\nNo Agents Available";​
 +?>
 +</​code>​
 +
 +==== Output ====
 +<​code>​
 +<?xml version="​1.0"​ encoding="​UTF-8"​ standalone="​yes"?>​
 +<​availableSlots xmlns:​ns5="​http://​jabber.org/​protocol/​httpbind"​ xmlns:​ns2="​http://​bindings.egain.com/​chat"​ xmlns:​ns4="​jabber:​client"​ xmlns:​ns3="​urn:​ietf:​params:​xml:​ns:​xmpp-stanzas">​
 +    <​ns2:​count>​1</​ns2:​count>​
 +</​availableSlots>​
 +
 +<?xml version="​1.0"​ encoding="​UTF-8"​ standalone="​yes"?>​
 +<​availableSlots xmlns:​ns5="​http://​jabber.org/​protocol/​httpbind"​ xmlns:​ns2="​http://​bindings.egain.com/​chat"​ xmlns:​ns4="​jabber:​client"​ xmlns:​ns3="​urn:​ietf:​params:​xml:​ns:​xmpp-stanzas">​
 +    <​count>​1</​count>​
 +</​availableSlots>​
 +
 +SimpleXMLElement Object
 +(
 +    [count] => 1
 +)
 +
 +1 Agents Available
 +</​code>​