SIGN UP

CallList

The CallList module is designed to interact with Voximplant's call list processing functionality. If there is a *.CSV file with names/phone numbers/UTC etc. of your customers, you could upload it to the Voximplant cloud. Then cloud starts to call customers from this list, string by string. If a customer answers a call, a data from the corresponding CSV line will be available via the VoxEngine.customData method (see the example below) as JSON object and it can be handled in AppEvents.Started handler. To upload *.CSV file you can use: 1) an HTTP Request with the CreateCallList API function. This method also launches the Call list 2) GUI interface.

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

IMPORTANT: the account's balance should be equal or greater than 1 USD. If the balance is lower than 1 USD, the call list processing won't start, or it stops immediately if it was active.

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

 require(Modules.CallList);

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

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()); // here we get the data from CSV line 
  if(typeof data["phone"] == "undefined"){
    VoxEngine.terminate();
    return;
  }

  const callerId = "+1234567890"; // Purchased or confirmed phone number
  var call = VoxEngine.callPSTN(data.phone, callerId);
  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);
    }
  });
});

functions

reportError

reportError(error: String|Object, whenDone: Function): void

Report error to CallList module

Parameters

  • error:

    String|Object

    Error string or JSON

  • whenDone:

    Function
    Optional

    Callback that is executed when a result is processed

Returns

  • Return:

    void

reportProgress

reportProgress(progress: String|Object, whenDone: Function): void

Report progress to CallList module

Parameters

  • progress:

    String|Object

    Progress description string or JSON

  • whenDone:

    Function
    Optional

    Callback that is executed when a result is processed

Returns

  • Return:

    void

reportResult

reportResult(result: String|Object, whenDone: Function): void

Report result to CallList module

Parameters

  • result:

    String|Object

    Result description string or JSON

  • whenDone:

    Function
    Optional

    Callback that is executed when a result is processed

Returns

  • Return:

    void