Monday, March 25, 2013

Open CTI - An Introduction

What is CTI?

CTI stands for "Computer Telephony Integration". Typically, the technology that allows interactions on a telephone and a computer to be integrated or coordinated. The term is predominantly used to describe desktop-based interaction for helping users be more efficient, though it can also refer to server-based functionality such as automatic call routing.

What is Open CTI?

Differentiate itself from desktop CTI, open CTI from salesforce.com doesn't need any desktop integration. It's a "CTI in the cloud".

It has all the features of traditional Desktop CTI like:
  1. Screen popping - Call information display (caller's number (ANI), number dialed (DNIS), and Screen pop on answer, with or without using calling line data. Generally this is used to search a business application for the caller's details.
  2. Dialing - Automatic dialing and computer-controlled dialing (power dial, preview dial, and predictive dial).
  3. Phone control - Includes call control (answer, hang up, hold, conference, etc.) and feature control (DND, call forwarding, etc.).
  4. Transfers - Coordinated phone and data transfers between two parties (i.e., pass on the Screen pop with the call.).
  5. Call center - Allows users to log in as a call center agent and control their agent state (Ready, Busy, Not ready, Break, etc.).

Also,  its ability to incorporate any web-based 3rd party application opens up a realm of possibilities for developers, partners and customers. Developers can expect to design, maintain, innovate a more robust CTI solution. 

Where is the technical architecture Open CTI?

This article on salesforce.com site has a very good overview of open CTI. 


What can I learn from this blog?

We plan to also expand CTI to SMS, Chat, or even video conferences as our blog explores the technology more. Be sure to stay tuned for more articles to come.


Tuesday, March 19, 2013

Setup Open CTI Call Center and Developer Environment


This article covers the basic information and instructions needed to setup an open CTI environment in Salesforce. Most of the information are available in Salesforce document. The purpose is just to summarize and save reader time to jump through several docs.

  1. Go to the setup page (right upper coner, click your name, then setup).
  2. Find or type Call Centers in quick find.
  3. Hit Import.
  4. Import the file.
If you don’t have an open cti setting file, save the following text as a file like myAdapter.xml:

<callCenter>
  <section sortOrder="0" name="reqGeneralInfo" label="General Information">
   <item sortOrder="0" name="reqInternalName" label="InternalName">My Open Adapter</item>
   <item sortOrder="1" name="reqDisplayName" label="Display Name">My Open CTI Call Center</item>
   <item sortOrder="2" name="reqAdapterUrl" label="CTI Adapter URL">http://MYSERVER/MySoftPhone.html</item>
   <item sortOrder="3" name="reqUseApi" label="Use CTI API">true</item>
   <item sortOrder="4" name="reqSoftphoneHeight" label="Softphone Height">300</item>
   <item sortOrder="5" name="reqSoftphoneWidth" label="Softphone Width">500</item>
  </section>
  <section sortOrder="1" name="reqDialingOptions" label="Dialing Options">
   <item sortOrder="0" name="reqOutsidePrefix" label="Outside Prefix">9</item>
   <item sortOrder="1" name="reqLongDistPrefix" label="Long Distance Prefix">1</item>
   <item sortOrder="2" name="reqInternationalPrefix" label="International Prefix">01</item>
  </section>
</callCenter>



5. Add yourself as a user by clicking on “Manage Call Center Users” button.

6. Now let’s develop a very easy softphone for your open cti. We want to save it to your url specified above: http://MYSERVER/MySoftPhone.html

<html>
<head>
     <!-- Imports Open CTI JavaScript library. It should point to a valid Salesforce domain. -->
     <script src="http://YOURURL.TO.salesforce.com/support/api/27.0/interaction.js"></script>
     <script type="text/javascript">
            // Callback of API method: isInConsole
            var isInConsoleCallback = function (response) {
                 // Returns true if method is executed in Service Cloud console, false otherwise.
                 if (response.result) {
                     alert('SoftPhone is in Service Cloud console.');
                 } else {
                     alert('SoftPhone is not in Service Cloud console.');
                 }
             };
             // Invokes API method: isInConsole
             function isInConsole() {
                      sforce.interaction.isInConsole(isInConsoleCallback);
             }
             // Callback of API method: getCallCenterSettings
             var getCallCenterSettingsCallback = function (response) {
                    // Result returns call center settings as a JSON string.
                    if (response.result) {
                           alert(response.result);
                    } else {
                           alert('Error retrieving call center settings ' + response.error);
                    }
              };
              // Invokes API method: getCallCenterSettings
              function getCallCenterSettings() {
                       sforce.interaction.cti.getCallCenterSettings(getCallCenterSettingsCallback);
              }
              // Callback of API method: setSoftphoneHeight
              var setSoftphoneHeightCallback = function (response) {
                       // Returns true if SoftPhone height was set successfully, false otherwise.
              if (response.result) {
                      alert('Setting SoftPhone height to 300px was successful.');
              } else {
                     alert('Setting softphone height failed.');
              }
              };
              // Invokes setSoftphoneHeight API method.
              function setSoftphoneHeight() {
                      sforce.interaction.cti.setSoftphoneHeight(300, setSoftphoneHeightCallback);
              }
              // Callback of API method: getPageInfo
              var getPageInfoCallback = function (response) {
                     if (response.result) {
                            alert(response.result);
                     } else {
                            alert('Error occured while trying to get page info: ' + response.error);
                     }
              }
              // Invokes API method getPageInfo
              function getPageInfo() {
                      sforce.interaction.getPageInfo(getPageInfoCallback);
              }
              //dial a number
              function dial() {
               var number = document.getElementById("dialPadText").value;
               alert("dialing number: " + number);
              }
     </script>
</head>
<body>
     <input type="text" id="dialPadText"/><button onclick="dial()">dial</button><br/>
     <button onclick="isInConsole();">isInConsole</button></br>
     <button onclick="getCallCenterSettings();">getCallCenterSettings</button></br>
     <button onclick="setSoftphoneHeight();">setSoftphoneHeight(300)</button></br>
     <button onclick="getPageInfo();">getPageInfo</button>
</body>
</html>

Now you have your basic open CTI in Salesforce. We'll discuss more about open CIT later.