This is module required to access call queue functionality of VoxImplant
Queues are configured in VoxImplant Control Panel. You need to create at least one queue and one skill and attach some users to a skill.
You can get EWT and queue position for each request using ACDRequest.getStatus()

To use this module you need to include following code to your scenario

require(Modules.ACD);

Events

ACDEvents.Error

Triggered if ACD service is temporary unavailable

Properties
  • error: string

    Error message

  • request: ACDRequest

    Request that generated the event

ACDEvents.Offline

Triggered if all operators that can process request in specified queue are offline, in this case request it not queued.

Properties
  • request: ACDRequest

    Request that generated the event

ACDEvents.OperatorFailed

Dispatched when ACD request tries to reach operator, but operator declines the call.

IMPORTANT NOTE: This is just a notification, request processing doesn't stop. It will be dispatched to different operators
Properties
  • operatorUserName: string

    Username of failed operator

  • request: ACDRequest

    Request that generated the event

  • statusCode: number

    Call status code

ACDEvents.OperatorReached

Properties
  • operatorCall: Call

    Established call with operator

  • request: ACDRequest

    Request that generated the event

ACDEvents.QueueFull

Triggered if queue has reached its max lenght or EWT, in this case request it not queued.

Properties
  • request: ACDRequest

    Request that generated the event

ACDEvents.Queued

Properties
  • request: ACDRequest

    Request that generated the event

ACDEvents.Waiting

Event dispatched as a result of ACDRequest.getStatus() call.

Properties
  • ewt: number

    Estimated wait time in minutes (value of 0 is also possible)

  • request: ACDRequest

    Request that generated the event

Functions

VoxEngine.enqueueACDRequest(queueName, callerid, params)

ACDRequest

Submit new request to queue

Parameters
  • queueName: String

    Queue name

  • callerid: String

    CallerID of person being put to the queue

  • params: ACDEnqueueParams (optional)

    Extra parameters

Returns

Example

require(Modules.ACD);

var request;
var originalCall;
var callerid;

VoxEngine.addEventListener(AppEvents.CallAlerting, function (e) {
  originalCall = e.call;
  callerid = e.callerid;
  e.call.answer();
  e.call.addEventListener(CallEvents.Connected, function (e) {
    e.call.record();
    //Incoming is a name of the queue that was created in Control Panel
    request = VoxEngine.enqueueACDRequest("Incoming", callerid);
	
    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.");
    });
    e.call.addEventListener(CallEvents.PlaybackFinished, function (e) {
    	e.call.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);
    
    
    
  });

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