> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# Editing call lists

## Editing parameters in real time

Sometimes you may need to edit some [call list](https://voximplant.com/docs/guides/solutions/calllists) parameters **during the progression** of a call list. In this article, you will learn how to do this.

Voximplant allows editing the following parameters of the call list:

* **start\_at** — updates the earliest time (UNIX timestamp in seconds) for the next attempt to be made
* **attempts\_left** — updates the number of calling attempts left. If set to 0, the current attempt is considered the last, and the task is marked as failed. If not set explicitly, the current number of attempts left will be decreased by 1
* **custom\_data** — updates the data source for the task. If no data is provided, the task data remains intact
* **start\_execution\_time** — updates the starting time for calling attempts. The calls cannot be made earlier than start\_execution\_time. The time format is HH:MM:SS (24-hour format), the time zone is UTC.
* **end\_execution\_time** — updates the ending time for calling attempts. The calls cannot be made later than end\_execution\_time. The time format is HH:MM:SS (24-hour format), the time zone is UTC.

<Info title="Execution time">
  If start\_execution\_time is later than end\_execution\_time, calls are made after start\_execution\_time on one day and before end\_execution\_time on the next day.
</Info>

To update the parameters, use the `CallList.requestNextAttempt()` method. It accepts the new parameters, applies them, and then performs another call attempt with new parameters.

### How it works

Let us create an example to show how it works. You will need:

1. [An application](/platform/voxengine/applications).
2. [A scenario](/platform/voxengine/scenarios) where you describe the logic.
3. [A routing rule](/platform/voxengine/routing-rules) to launch the scenario.
4. [A phone number](/platform/voxengine/phone-numbers) to use as a caller ID.

Prepare the CSV table to pass to the scenario in the [custom data](https://voximplant.com/docs/references/voxengine/voxengine/customdata) field in the following format:

```json
numbers;first_name;last_name
18881231231,18881231232;Elon;Musk
```

<Info title="Custom data">
  Read more about custom data parameters usage [in this article](https://voximplant.com/docs/guides/voxengine/customdata).
</Info>

First, let us process the data from the CSV table. If the call connects, implement some logic, for example, read a message to the customer via [TTS](https://voximplant.com/docs/guides/speech/tts). You can find more information with examples in the main [call list article](https://voximplant.com/docs/guides/solutions/calllists).

If the call fails, let us update some parameters and retry. To do this, create an object with updated call list parameters (`updatedCallListData` in this example), then pass the object to the `CallList.requestNextAttempt()` method. This method makes a new calling attempt with updated parameters automatically.

Refer to this code example to understand how it works:

```javascript title="Editing call lists"
VoxEngine.addEventListener(AppEvents.Started, (e) => {
  const data = JSON.parse(VoxEngine.customData());

  // get the list of numbers from custom data
  const numbers = data['numbers'].split(',');
  // check which of the user numbers we need to dial
  let numberIndex = data['index'] || 0;

  const call = VoxEngine.callPSTN(numbers[numberIndex], 'some_caller_id');

  call.addEventListener(CallEvents.Connected, () => {
    // implement some logic here. for example,
    // read a message to your customer via TTS

    call.addEventListener(CallEvents.Disconnected, () => {
      // report success, terminate session
      CallList.reportResult('success', VoxEngine.terminate);
    });
  });

  call.addEventListener(CallEvents.Failed, () => {
    // number is unreachable, try another one next time
    numberIndex = (numberIndex + 1) % numbers.length;
    data['index'] = numberIndex;

    const updatedCallListData = {};
    // update any of the fields below or all of them at once

    // updates the data source for the task
    updatedCallListData['custom_data'] = JSON.stringify(data);

    // updates the number of calling attempts left
    updatedCallListData['attempts_left'] = 1;

    // updates the earliest time for the next attempt
    // in this case we set this to current time + 1 second
    updatedCallListData['start_at'] = Math.ceil(new Date().getTime() / 1000 + 1);

    // updates the starting time for calling attempts
    updatedCallListData['start_execution_time'] = '05:00:00';

    // updates the ending time for calling attempts
    updatedCallListData['end_execution_time'] = '18:00:00';

    CallList.requestNextAttempt(updatedCallListData, function (ev) {
      Logger.write(JSON.stringify(ev));
      VoxEngine.terminate();
    });
  });
});

```

## Editing a task's next attempt date

In addition to modifying the call list parameters in real time, you can specify the next attempt date for each task. In this case, the task does not start before the specified date.

You can specify the next attempt date in 3 ways:

1. **In real time**: just pass the `next_attempt_time` parameter into the [EditCallListTask](https://voximplant.com/docs/references/httpapi/calllists#editcalllisttask) method, specifying the date in the `2024-10-31T15:00:13.567+03:00` format.

2. **While creating the call list**: specify a new column named `next_attempt_time` in the CSV sheet with call list tasks with the dates in the `2024-10-31T15:00:13.567+03:00` format.

3. **In the VoxEngine scenario**: pass the `next_attempt_time` parameter via the `CallList.requestNextAttempt()` method with the dates in the `2024-10-31T15:00:13.567+03:00` format. See the scenario example below to learn how to do it:

```javascript title="Next attempt date"
require(Modules.CallList);
VoxEngine.addEventListener(AppEvents.Started, function (e) {
  setTimeout(function () {
    updatedCallListSync();
    VoxEngine.terminate();
  }, 1000);
});
function updatedCallListSync() {
  const updatedCallListData = {};
  updatedCallListData['next_attempt_time'] = '2024-10-15T10:40:12.000+03:00';
  let response;
  try {
    Logger.write('[LOGGER] Update the call list');
    response = CallList.requestNextAttempt(updatedCallListData);
    Logger.write(JSON.stringify(response));
  } catch (error) {
    dashboard.clError();
    Logger.write('[LOGGER] Update error: ${error}');
  }
}

```

There are **two restrictions** for the next attempt date parameter:

1. You cannot pass any time in the past, in this case the call list does not accept the value and sets the next attempt date to the request time plus the specified interval between calls.
2. You cannot pass any time more than 9 months in the future, in this case the call list does not accept the value and sets the next attempt date to the request time plus the specified interval between calls.