Updated on 2023-10-12 GMT+08:00

Implementing the One-Click Outbound Call Function

When an enterprise page is integrated into the multi-tenant framework of the CEC, an agent can click a customer's phone number on the enterprise page to make an outbound call by one click, without entering the phone number. The agent status on the connection bar is consistent. The outbound call function can be invoked on a third-party page integrated into the multi-tenant framework, as shown in Figure 1.

The one-click outbound call function supports only external pages whose Open Mode is set to Embed in the New Incoming Call Pop-up Screen dialog box. For details about the setting, see Figure 1.

Figure 1 One-click outbound call function

For example, an inbound call screen pop-up path is configured for a tenant space. On the enterprise page loaded after the agent workbench is opened, you can make an outbound call by one click. The API parameters are transferred. The API reference code is as follows. For details about the name and parameters of the API, see CC-Gateway Development Guide.

let targetOrigin =gettUrlParam()['origin'];        
   function sendMsg(){             
       let ele =document.getElementById("calloutinput");        
   let data={'name':'callout','param':[]};        
   let number =ele.value;         
   data.param.push(number);         
   data.param.push('audio'); 

  top.postMessage(JSON.stringify(data),targetOrigin)         
  }   

  function  gettUrlParam() 
  {         
  let url = location.href;         
  let paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");         
  let paraObj = {};         
  for (let i = 0; i < paraString.length; i++) {             
      let j = paraString[i];             
      paraObj[j.substring(0, j.indexOf("="))] = j.substring(j.indexOf("=") + 1, j.length);         
  }         
  return paraObj;     
  }     
  1. A third-party system can invoke data in either of the following formats:
    • let data={

      name:'callout',

      param:{

      number:'88880523',//Number for making an outbound call

      mode:'audio'//The options are audio (voice call) and video (video call).

      }

      }

    • data={

      name:'callout',

      param:['88880813','video']

      }

  2. The top.postMessage(JSON.stringify(data),targetOrigin) message is supported by the early connection bar and is compatible with the top.postMessage(data,targetOrigin) message.