webdialer-docs
Code Samples
The code samples below demonstrate basic usage of the WebDialer API interfaces to implement click-to-call functionality using in-browser HTML and SOAP requests.
HTML Sample Page
Save the below HTML to a file, and open in a web browser.
Note: be sure to update the CUCM server address in the code.
html
Copy<html>
<head>
<title>WebDialer HTML Example</title>
<script>
function launchWebDialerWindow(url) {
webdialer = window.open(url, "webdialer", "status=no, width=420, height=300, scrollbars=no, resizable=yes, toolbar=no");
}
function launchWebDialerServlet(destination) {
url = 'https://cucm.example.com:8443/webdialer/Webdialer?destination=' + escape(destination);
launchWebDialerWindow(url);
}
</script>
</head>
<body>
<div>
<h1>Sample WebDialer HTML Application</h1>
<p>Make sure the Web Dialer Service is running on the Unified CM server and that the target user has a
provisioned/supported phone device.</p>
<p>Click the number below to call Bill Smith's phone:</p>
Bill Smith Ext.
<a href="javascript:launchWebDialerServlet('1002')">1002</a>
</div>
</body>
</html>
SOAP Sample Requests
The following samples demonstrate using the getPrimaryLine
request to retrieve a user’s primary phone extension (we assume this is the line from which the call should be launched), then using makeCallSoap
to launch the call.
getPrimaryLine
Request
xml
Copy<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:WD70">
<soapenv:Header />
<soapenv:Body>
<urn:getPrimaryLine soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<in0 xsi:type="urn:Credential">
<userID xsi:type="xsd:string">bill</userID>
<password xsi:type="xsd:string">123</password>
</in0>
</urn:getPrimaryLine>
</soapenv:Body>
</soapenv:Envelope>
Response
xml
Copy<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getPrimaryLineResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:WD70">
<getPrimaryLineReturn xsi:type="soapenc:string"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1002</getPrimaryLineReturn>
</ns1:getPrimaryLineResponse>
</soapenv:Body>
</soapenv:Envelope>
makeCallSoap
Request
xml
Copy<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:WD70" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header />
<soapenv:Body>
<urn:makeCallSoap soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<in0 xsi:type="urn:Credential">
<userID xsi:type="xsd:string">bill</userID>
<password xsi:type="xsd:string">123</password>
</in0>
<in1 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:string">1002</in1>
<in2 xsi:type="urn:UserProfile">
<user xsi:type="xsd:string">bill</user>
<deviceName xsi:type="xsd:string">SEPF01FAF38ABC2</deviceName>
<lineNumber xsi:type="xsd:string">?</lineNumber>
</in2>
</urn:makeCallSoap>
</soapenv:Body>
</soapenv:Envelope>
Response
xml
Copy<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:makeCallSoapResponse xmlns:ns1="urn:WD70"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<makeCallSoapReturn href="#id0" />
</ns1:makeCallSoapResponse>
<multiRef xmlns:ns2="urn:WD70" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:CallResponse">
<responseCode xsi:type="xsd:int">0</responseCode>
<responseDescription xsi:type="xsd:string">Success</responseDescription>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
Sample Java Application
A sample Java project demonstrating usage of the Cisco WebDialer SOAP API with Apache Axis to call <makeCallSoap>
is available on GitHub: