From Bright Pattern Documentation
Jump to: navigation, search

<translate>

Call Someone

You can use the dialNumber method to have a logged-in agent place a voice call. dialNumber lets you enter a phone number and initiate the call.

You may wish to use dialNumber alongside selectService, for added control over a call. When used together, you can select the service to be used for calling a specified phone number and dial it.

The dialNumber method can be attached to a web element, such as a button, on your webpage. When clicked, the button will process the API method. Add a field to enter the phone number to be dialed.

In this article, you will learn how to:

  • Attach dialNumber to a button
  • Add a field to enter the phone number to dial
  • Place sample JavaScript into HTML

How to Use dialNumber

Of course, there are many ways to style your page elements and Agent Desktop widget display. The following is provided for example purposes only.

  1. Paste the sample code into the body of your HTML file. This is the bare minimum that you need for the SDK to work. Make sure you replace "<tenant>" with the name of your Agent Desktop web server.

  2. Save and open the page in your web browser. Make sure the agent is logged in.

  3. Enter the phone number to be dialed (optional).

    Enter phone number or extension
    Enter phone number or extension


  4. Click Dial Number to initiate a call. The number will be dialed, even if the agent was in the "Not ready" state.

    The call was accepted
    The call was accepted


Sample Code

<script type="text/javascript" src="https://<tenant>.brightpattern.com/agentdesktop/libs/servicepattern-sdk-v1.js"> 
</script>

<iframe id="repeater" style="position:absolute; right: 8px; width: 300px; height: 700px;" src="https://<tenant>.brightpattern.com/agentdesktop/UniversalRepeater.jsp"></iframe>//The Agent Desktop widget ("repeater") and display properties. In the source, replace "<tenant>" with your actual Agent Desktop web server name.

<input id="number" type="text" placeholder="Dial number"/>//Field for entering phone number
<button onclick="bpspat.api.dialNumber(document.getElementById('number').value)">Dial</button>//Button with dialNumber method attached

<div id="log">Logs...//Logs section.

<script type="text/javascript">//Uses the log function to place requested data on the page.
window.bpspat.api.init("https://<tenant>.brightpattern.com");//The window.bpspat.api object will appear on an external webpage ONLY when this part is included in the script. Replace "<tenant>" with your actual Agent Desktop web server name.
function log(data) {
let div = document.createElement("div");
div.innerHTML = JSON.stringify(data);
document.getElementById("log").appendChild(div);
}

</script>



</translate>

< Previous | Next >