Phonebar API

The xCALLY phone bar provides CTI capabilities to call external application on one hand and some cool API to allow your applications to control the phone bar and perform several operations.

API are easy to be called via http requests.
The API answers are available via http JSON standard requests or XML, using the port 9888.

xCALLY phone bar API list v.2:


Perform a Call (originate):
http://localhost:9888/xcally/svc/originate/phonenumber
http://localhost:9888/xcally/svc/originate/xml/phonenumber


Answer a Call (answer):
http://localhost:9888/xcally/svc/answer
http://localhost:9888/xcally/svc/answer/xml


Hang-up a Call (hangup):
http://localhost:9888/xcally/svc/hangup/phonenumber
http://localhost:9888/xcally/svc/hangup/xml/phonenumber


MOH (holding):
http://localhost:9888/xcally/svc/holding/phonenumber
http://localhost:9888/xcally/svc/holding/xml/phonenumber
Place on hold an active call or move on to the Pause status an agent not on a call


Show the active calls (channels):
http://localhost:9888/xcally/svc/channels
http://localhost:9888/xcally/svc/channels/xml


Show the single active channel (channel)
http://localhost:9888/xcally/svc/channel/phonenumber
http://localhost:9888/xcally/svc/channel/xml/phonenumber


Show the Recent calls (recents):
http://localhost:9888/xcally/svc/recents
http://localhost:9888/xcally/svc/recents/xml


Show the Queues:
http://localhost:9888/xcally/svc/queues
http://localhost:9888/xcally/svc/queues/xml


Show the Peer Information:
http://localhost:9888/xcally/svc/peer
http://localhost:9888/xcally/svc/peer/xml


Blind Transfer (transfer)
http://localhost:9888/xcally/svc/transfer/phonenumber
http://localhost:9888/xcally/svc/transfer/xml/phonenumber


Attended Transfer (atxfer)
http://localhost:9888/xcally/svc/atxfer/phonenumber
http://localhost:9888/xcally/svc/atxfer/xml/phonenumber


Conference (conference):
http://localhost:9888/xcally/svc/conference/phonenumber*
http://localhost:9888/xcally/svc/conference/xml/phonenumber*

*phonenumber = call on hold

The conference API usage steps are as per following:
– Answer the call A (answer/A API)
– Holding the call A (holding/A API)
– Call the B extension (originate/B API)
– Conference with A (conference/A)
– (optional) Hangup/A and Hangup/B at the end of the conference

Configuration reload (reload):
http://localhost:9888/xcally/svc/reload
http://localhost:9888/xcally/svc/reload/xml

JSON example:

Http Request:
http://localhost:9888/xcally/svc/channels

JSON answer:
{“method”:”channels”,”response”:”true”,”rows”:[{“extension”:”600″,”queue”:””,”calldata”:””,”channel”:””,”event”:””, “uniqueid”:””,”status”:”ACTIVE”,”duration”:6,”codec”:”PCMU”}]}


XML example:

Http Request:
http://localhost:9888/xcally/svc/channels/xml

XML answer:

<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<method>channels</method>
<response>true</response>
<row>
<extension>600</extension>
<queue/>
<calldata/>
<channel/>
<evt/>
<uniqueid/>
<status>ACTIVE</status>
<duration>2</duration>
<codec>PCMU</codec>
</row>
</root>

Click to Call simple HTML example:
The following html snippet create a simple Click2Call web form, allowing you to place brower calls through the xCALLY phone bar:


<html>
<head>
<script type="text/javascript" language="javascript">
function originate_call()
{
//alert(document.getElementById("phone").value);
var s = document.getElementById("phone").value;
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
//document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET", "http://localhost:9888/xcally/svc/originate/xml/" + s, true);
xmlhttp.send();
}
</script>
<title>Application Executer</title>
</head>
<body>
<p>
Phone number
<input type="text" id="phone">
<input type="button" value="ORIGINATE" onclick="originate_call();"/>
</body>
</html>


xcally click to call form