Feedback

  • Contents
 

IS_Action_Listen

Definition

This call control action allows an agent to listen to a call specified by the callid attribute. The listen action requires the callid of the call to listen in on. You would need to use the other queue functions in the scripter API to enumerate the call on another users' queue and retrieve one of the call ids and pass that into the listen action. Invoking the IS_Action_Listen element allows an agent to listen to another call; invoking the IS_Action_Listen element again turns off the listen feature. The current or active call of the current campaign in the queue is assumed to be the target of this action, if the CallId attribute is not set.

Scripter will recognize click events from any HTML element whose name has an associated action documented in this API (e.g.: "IS_Action_CallComplte"). If the script needs to associate several buttons with the same action, then define the action using a meta element and call the click event on the meta element from the button(s).

Attributes

The IS_Action_Listen element accepts the following attributes:

callid

The callid to which this action applies (e.g. "89900001"). callid is required. A debug mode error is logged if the callid attribute is not specified.

[callback]

The callback property ensures that this action executes asynchronously in Interaction Connect. Starting with 2018 R3, all Interaction Scripter actions (IS_Actions) provide a callback property for use in Connect scripts only. In the example below, statements inside the highlighted callback function block execute only after the action completes. The callback will return an error if the action fails. See Writing custom scripts for Interaction Connect or Scripter .NET.

Here's how to use the .callback property in a script for Interaction Connect:

function IS_Action_Listen() {
  IS_Action_Listen.callid = document.getElementById("listenId").value;

  IS_Action_Listen.callback = function(error) {     if (error) {       console.error("IS_Action_Listen failed.");     } else {       console.log("IS_Action_Listen succeeded.");     }   } }

Example 1

This example allows an agent to click the “Listen” button to listen to the call specified by the input Interaction ID.

<input type=”text” id=”listenId” placeholder=”Interaction ID">
<button type=”button” onclick=”listen()”>Listen</button>
 
function listen() {

IS_Action_Listen.callid = document.getElementById("listenId").value;

IS_Action_Listen.click();

}


Example 2

This example connects to another agent’s queue and automatically listens to any calls that are added to the queue.

<input type=”text” id=”user” placeholder=”User”>
<button type=”button” onclick=”connectToQueueAndListen()”>Listen to Queue</button>
 
function connectToQueueAndListen() {

var queue = scripter.createQueue();

queue.callObjectAddedHandler = callObjectAdded;

var user = document.getElementById("user").value;

queue.connect(9, user);

}

function callObjectAdded(callObj) {

IS_Action_Listen.callid = callObj.id;

IS_Action_Listen.click();

}