Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

API CTI  – Shuttle 2.4.0 onwards

You can integrate xCALLY Shuttle with any kind of external Web Applications you like (external custom CRM, Ticketing solution, ERP etc…).


Compatibility

The example template was written in Javascript, but the integration can be written in other languages


The template.js file contains the basic elements to create your Custom CTI Integration through the realtime xCally Shuttle connection, thus providing the possibility to manage and autofill your external applications with the data about the call, like the caller number or the agent who answered the call and more. You can automatically open a CTI form or pop-up, and view the call/ticket/crm data on to the xCALLY Shuttle supervisor Realtime Dashboards.

You can download the template.js file here and the service file here

  File Modified

Important: after the download, remember to rename the template.js file!



Event Ringing

The ringing event is dispatched following a ring event on an agent for a queue call

event.ringing = function(data) {
 console.log('ringing');
 wakeup('http://www.google.it', data.peer, 'new_tab');
};


This is the data sample for ringing event

Data sample
{ 
	event: 'ringing',
	queue: 'CC-SIPP',
	agentname: 'John Doe',
	agentnum: '1007',
	peer: 'SIP/john.doe',
	direction: 'inbound',
	uniqueid: '1437069264.914',
	context: 'from-sip',
	extension: '9999',
	trunk: 'SIP/demo.trunk-00000392',
	callernum: '998',
	ringing: true 
}


Event Abandon

The abandon event is dispatched following a ring event on an agent for a queue call

event.abandon = function(data) {
  console.log('abandon');
};


This is the data sample for abandon event

Data sample
 


Event Up

The up event is dispatched following an answer event on an agent for a queue call

event.up = function(data) {
  console.log('up');
  wakeup('http://localhost', data.peer, 'new_frame');
};


This is the data sample for up event

Data sample
{ 
	event: 'up',
	queue: 'CC-SIPP',
	agentname: 'John Doe',
	agentnum: '1007',
	peer: 'SIP/john.doe',
	direction: 'inbound',
	uniqueid: '1437069264.914',
	context: 'from-sip',
	extension: '9999',
	trunk: 'SIP/demo.trunk-00000392',
	callernum: '998',
	holdtime: '2',
	ringtime: '0',
	up: true 
}


Event Hang Up

The hang up event is dispatched following an hangup event on an agent for a queue call

event.hangup = function(data) {
  console.log('hangup');
  wakeup('http://www.google.it', data.peer, 'new_tab');
};


This is the data sample for hangup event

Data sample
{ 
	
}


Event Outbound

The outbound event is dispatched following the initiation of an outbound call by the agent

event.outbound = function(data) {
  console.log('outbound');
  wakeup('http://www.zendesk.it', data.peer, 'new_window');
};


This is the data sample for outbound event

Data sample
{ 
	
}


Open CTI to an Agent

The wakeup method is used to request the agent to open a web page

var wakeup = function(url, peer, mode) {
  socket.emit('AgentCTI', {
    url: url,
    peer: peer,
    mode: mode
  });
};

where

url: the address of the CTI which you want to open

peer: the Agent interface

mode: how the CTI form will be opened. Values: new_tab, new_window, new_frame


Push a notification to the Agent

The notification method is used to send a notification to the agent

var notification = function(peer, type, title, body) {
  socket.emit('AgentCTINotification', {
    peer: peer,
    type: type,
    title: title,
    body: body
  });
};

where

peer: the Agent interface

type: the kind of toast that will be displayed to the Agent. Values: 'success', 'info', 'warning', 'error'

title: the title of the toast that will be displayed to the Agent

body: the message of the toast that will be displayed to the Agent


Push the event into the Integration Realtime section of the Administrator

The pushevent method is used to display trigger action event in Realtime section

var pushevent = function(appname, data, reference, url) {
  data.time = new Date();
  socket.emit('RealtimeCTI', {
    type: appname,
    channel: data,
    reference: reference,
    url: url
  });
};

where

appname: name of the Integration

data: object containing information about the call

reference:  CTI creation id

url: the address of the CTI


Example

For each event you can define which action you want the integration to perform.

In this example we associate to the UP event the CTI opening to an Agent, if the call belongs to the Sales Queue.

We also pass to the Agent a custom variable called ordernumber that we have created into the Shuttle -> Settings -> Integrations -> Custom variables section.

event.up = function(data) {
    var order = customvariables[data.uniqueid]['ordernumber'];
    if(data.queue == ‘Sales’){
         wakeup('http://webservice1/sales?ordernumber='+order, data.peer, 'new_frame');}
    }
};


Add a custom integration service


1. Download the service file ’template’ and save it into the directory /etc/init.d/ of your xCALLY Shuttle server
2. Rename the ‘template’ file with your custom name
3. Open the ’template’ file and change all occurrences of '<name-file>’ with the name of the JavaScript file (template.js) you previously save into /var/www/html
4. Change the permission of the ‘template’ file: chmod 755 /etc/init.d/template (change template with the right name)
5. Add the ’template’ service: chkconfig —add template (change template with the right name)
6. Start the service: service template start (change template with the right name)

With this configuration, your custom service will runs in parallel to xCALLY Shuttle Realtime service.


  • No labels