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 the request is not queued.

Properties
  • request: ACDRequest

    Request that generated the event

ACDEvents.OperatorFailed

The event is triggered when an ACD request tries to reach an operator, but the operator declines the call. IMPORTANT NOTE: This is just a notification, the request processing won't stop. The event will be triggered 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 it's max lenght or EWT, in this case request is not queued.

Properties
  • request: ACDRequest

    Request that generated the event

ACDEvents.Queued

Properties
  • request: ACDRequest

    Request that generated the event

ACDEvents.Waiting

The event is triggered 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

Directs a new request (an incoming call) to the specified queue.

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. All operators belonging to that queue will see the ID.

  • params: ACDEnqueueParams (optional)

    Object with extra parameters.

Returns

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);
});