SIGN UP

ACD

The ACD module is required to access calls queue functionality. The Queues can be configured in the Control Panel. You need to create at least one queue. Then you need to create at least one skill; specify the queue for that skill and assign the users. You can get EWT (Estimated Wait Time) and queue position for each request using the ACDRequest.getStatus() method. Web SDK can receive ACD status and status change notifications via client-side API, see this article for details.

Add the following line to your scenario code to use the module:

 require(Modules.ACD);

All functions, events and classes of the module can be used only after this line.

Example

 require(Modules.ACD);

 VoxEngine.addEventListener(AppEvents.CallAlerting, function (e) {
  var originalCall = e.call;
  var callerid = e.callerid;
  originalCall.answer();
  originalCall.addEventListener(CallEvents.Connected, function (e) {
    originalCall.record();
    //Incoming is a name of the queue that was created in Control Panel
    var request = VoxEngine.enqueueACDRequest("Incoming", "callerid", {
        headers: { "X-header": "title"},
        priority: 1
    });
	
    request.addEventListener(ACDEvents.Queued, function (a) {
      request.getStatus();
    });
    
    request.addEventListener(ACDEvents.Offline, function (a) {
    	originalCall.say("Your call can't be processed right now"); 
      	originalCall.addEventListener(CallEvents.PlaybackFinished, function(b) {
          VoxEngine.terminate();
      	});
    });
    
    request.addEventListener(ACDEvents.Waiting, function (a) {
      
      originalCall.say("You are in the queue at posision "+a.position+
                       ". You will reach operator in "+(a.ewt+1)+" minutes.");
    });
    originalCall.addEventListener(CallEvents.PlaybackFinished, function (e) {
    	originalCall.startPlayback("http://cdn.voximplant.com/toto.mp3");  
    });
    
    request.addEventListener(ACDEvents.OperatorReached, function (e) {
        
        //Operator is ready, let's send audio between calls
	VoxEngine.sendMediaBetween(e.operatorCall, originalCall);
      	e.operatorCall.addEventListener(CallEvents.Disconnected, VoxEngine.terminate);
        clearInterval(statusInterval);
    });
    
    statusInterval = setInterval(function (){
      request.getStatus();
    }, 30000);
     
  });

  originalCall.addEventListener(CallEvents.Failed, VoxEngine.terminate);
  originalCall.addEventListener(CallEvents.Disconnected, VoxEngine.terminate);
});

functions

VoxEngine.enqueueACDRequest(queueName: String, callerid: String, params: ACDEnqueueParams): ACDRequest

Adds a new request to the specified queue. The request will be dispatched to the free operator according to the operator's status (must be "Ready") and skills.

Parameters

  • queueName:

    String

    The name of the queue, where the call will be directed. Queue name must be specified exactly as in the Control panel.

  • callerid:

    String

    ID of the caller which will be put to the queue. After request is dispatched to the operator, it's possible to get this ID by assigning a handler to the ACDEvents.OperatorReached event. In the operatorCall property will be stored a call, so you can use the Call.callerid() method. IMPORTANT: virtual numbers rented from Voximplant can't be used as CallerID, use only real numbers.

  • params:

    ACDEnqueueParamsOptional

    Object with extra parameters.

Returns