From Bright Pattern Documentation
Jump to: navigation, search
Tracy (talk | contribs)
No edit summary
Tracy (talk | contribs)
No edit summary
Line 1: Line 1:
<translate>
<translate>
= Call Someone =
= Call Someone on Specific Service =
You can use the [[Embedded-agent-desktop-sdk-specification/Methods/dialNumber |  dialNumber]] method to have a logged-in agent place a voice call. dialNumber lets you enter a phone number and initiate the call.
You can use the [[Embedded-agent-desktop-api-specification/Methods/dialNumber |  dialNumber]] method to dial a phone number and initiate a call for a logged-in agent.  


You may wish to use dialNumber alongside [[5.3:Embedded-agent-desktop-sdk-specification/Methods/selectService |  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.
Using dialNumber alongside [[5.3:Embedded-agent-desktop-api-specification/Methods/selectService |  selectService]] provides added control over a call. When used together, you can select the service to be used. The [[Embedded-agent-desktop-api-specification/Methods/getState |  getState]] method retrieves agent state and interaction information in the logs.


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.
Methods can be attached to web elements, such as buttons, on your webpage. When clicked, the buttons will process the API methods. Add fields to enter the phone number to be dialed and the name of the service to use.


In this article, you will learn how to:
In this article, you will learn how to:
* Attach dialNumber to a button
* Attach getState, dialNumber, and selectService to buttons
* Add a field to enter the phone number to dial
* Add fields
* Place sample JavaScript into HTML
* 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.


# Paste the [[5.3:Embedded-agent-desktop-sdk-specification/UseCases/Dial#Sample_Code |
== Sample Code ==
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.<br /><br />
In this sample code, the methods are attached to button elements.
# Save and open the page in your web browser. Make sure the agent is logged in.<br /><br />
 
# Enter the phone number to be dialed (optional).<br /><br />[[File:DialNumber12-53.PNG|800px|center|Enter phone number or extension]]<br /><br />
Copy this sample code for pasting into 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 (e.g., "example.brightpattern.com").
# Click '''Dial Number''' to initiate a call. The number will be dialed, even if the agent was in the "Not ready" state.<br /><br />[[File:DialNumber14-53.PNG|800px|center|The call was accepted]]




== Sample Code ==
<syntaxhighlight lang="javascript">
  <script type="text/javascript" src="https://<tenant>.brightpattern.com/agentdesktop/libs/servicepattern-sdk-v1.js">  
  <script type="text/javascript" src="https://<tenant>.brightpattern.com/agentdesktop/libs/servicepattern-sdk-v1.js">  
  </script>
  </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.
  <iframe id="repeater" style="position:absolute; right: 8px; width: 300px; height: 700px;" src="https://<tenant>.brightpattern.com/agentdesktop/UniversalRepeater.jsp"></iframe>
   
   
  <input id="number" type="text" placeholder="Dial number"/>//Field for entering phone number
<button onclick="bpspat.api.getState(log)">Get State</button>
  <button onclick="bpspat.api.dialNumber(document.getElementById('number').value)">Dial</button>//Button with dialNumber method attached
<br>
<br>
<input id="service" type="text" placeholder="Service name"/>
<button onclick="bpspat.api.selectService(document.getElementById('service').value)">Change Service by Name</button>
<br>
<br>
  <input id="number" type="text" placeholder="Dial number"/>
  <button onclick="bpspat.api.dialNumber(document.getElementById('number').value)">Dial</button>
<br>
<br>
   
   
  <<nowiki />div id="log">Logs...</div>//Logs section.
  <div id="log">Logs...</div>
   
   
  <script type="text/javascript">//Uses the log function to place requested data on the page.
  <script type="text/javascript">
  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.
  window.bpspat.api.init("https://<tenant>.brightpattern.com");
  function log(data) {
  function log(data) {
  let div = document.createElement("div");
  let div = document.createElement("div");
Line 42: Line 48:
   
   
  </script>
  </script>
</syntaxhighlight>
== Example Exercise ==
There are many ways to style your page elements and Agent Desktop widget display. The following is provided for example purposes only.
# Paste the [[5.3:Embedded-agent-desktop-sdk-specification/UseCases/Dial#Sample_Code |
sample code]] into the body of your HTML file.<br /><br />
# Save and open the page in your web browser. Make sure the agent is logged in.<br /><br />
# Click '''Get State''' to see if the agent is "Ready" to handle a call. The log data will show interaction status.<br /><br />
# In the '''Service Name''' field, enter the desired service for the call, and click '''Change Service by Name'''.<br /><br />
# Enter the phone number to be dialed. If dialing another contact center user, enter the user's extension number (e.g., "1020").<br /><br />[[File:Call-Service3-53.PNG|350px|center|Enter service name and phone number or extension]]<br /><br />
# Click '''Dial Number''' to initiate a call. The number will be dialed, even if the agent was in the "Not ready" state.<br /><br />[[File:Call-Service2-53.PNG|800px|center|The call was accepted]]





Revision as of 22:50, 26 March 2019

<translate>

Call Someone on Specific Service

You can use the dialNumber method to dial a phone number and initiate a call for a logged-in agent.

Using dialNumber alongside selectService provides added control over a call. When used together, you can select the service to be used. The getState method retrieves agent state and interaction information in the logs.

Methods can be attached to web elements, such as buttons, on your webpage. When clicked, the buttons will process the API methods. Add fields to enter the phone number to be dialed and the name of the service to use.

In this article, you will learn how to:

  • Attach getState, dialNumber, and selectService to buttons
  • Add fields
  • Place sample JavaScript into HTML


Sample Code

In this sample code, the methods are attached to button elements.

Copy this sample code for pasting into 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 (e.g., "example.brightpattern.com").


 <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>
 
 <button onclick="bpspat.api.getState(log)">Get State</button>
 <br>
 <br>
 <input id="service" type="text" placeholder="Service name"/>
 <button onclick="bpspat.api.selectService(document.getElementById('service').value)">Change Service by Name</button>
 <br>
 <br>
 <input id="number" type="text" placeholder="Dial number"/>
 <button onclick="bpspat.api.dialNumber(document.getElementById('number').value)">Dial</button>
 <br>
 <br>
 
 <div id="log">Logs...</div>
 
 <script type="text/javascript">
 window.bpspat.api.init("https://<tenant>.brightpattern.com");
 function log(data) {
 let div = document.createElement("div");
 div.innerHTML = JSON.stringify(data);
 document.getElementById("log").appendChild(div);
 }
 
 </script>


Example Exercise

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.

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

  3. Click Get State to see if the agent is "Ready" to handle a call. The log data will show interaction status.

  4. In the Service Name field, enter the desired service for the call, and click Change Service by Name.

  5. Enter the phone number to be dialed. If dialing another contact center user, enter the user's extension number (e.g., "1020").

    Enter service name and phone number or extension
    Enter service name and phone number or extension


  6. 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




</translate>

< Previous | Next >