CallList module is designed to interact with VoxImplant's call list processing functionality.
If there is a *.CSV file with names/phone numbers/id etc. you could pass it to the JS scenario.
When an HTTP Request is executed with the CreateCallList API function,
all data available in *.CSV file will be available at VoxEngine.customData() as JSON object, so it can be accessed in AppEvents.Started handler.

It's recommended that application will return call result to processor (see reportResult and reportError). The returned result could be found in call's log in Control Panel.

To use this module, you need to include followig line into your scenario:

 require(Modules.CallList);

Functions

CallList.reportError(error, whenDone)

void

Report error to Call List processor

Parameters
  • error: String|Object

    Error string or JSON

  • whenDone: Function (optional)

    Callback that is executed when notification is processed

CallList.reportProgress(progress, whenDone)

void

Report progress to Call List processor

Parameters
  • progress: String|Object

    Progress description string or JSON

  • whenDone: Function (optional)

    Callback that is executed when notification is processed

CallList.reportResult(result, whenDone)

void

Report result to Call List processor

Parameters
  • result: String|Object

    Result description string or JSON

  • whenDone: Function (optional)

    Callback that is executed when notification is processed

Example

 require(Modules.CallList);

 var isSent = false;

 VoxEngine.addEventListener(AppEvents.HttpRequest,function(e){return 1;});
 VoxEngine.addEventListener(AppEvents.Started, function(e){
  var data = JSON.parse(VoxEngine.customData());
  if(typeof data["phone"] == "undefined"){
    VoxEngine.terminate();
    return;
  }
  
  var call = VoxEngine.callPSTN(data.phone);
  call.addEventListener(CallEvents.Connected, function(e){
    call.hangup();
    if(!isSent){
      isSent = true;
      CallList.reportResult({result:true}, VoxEngine.terminate);
    }
  });
  call.addEventListener(CallEvents.Disconnected, function(e){
    if(!isSent){
      isSent = true;
      CallList.reportError({result:false, msg:"Disconnect"}, VoxEngine.terminate);
    }
  });
  call.addEventListener(CallEvents.Failed, function(e){
    if(!isSent){
      isSent = true;
      CallList.reportError({result:false, msg:"Failed", code: e.code}, VoxEngine.terminate);
    }
  });
});