# Длительность ожидания клиента на линии

**Задача:** вычислить и записать в поле звонка, какое количество времени клиент ожидал ответа на линии.

#### Как реализовать

В веб-интерфейсе настройки модуля (`http://<Asterisk IP>:8077/config`):

1. Установите галочку **"Включить кастомизацию"**.
2. Установите галочку на пункте **"полей дела"**.

![](/files/-MLbpdkZe-HygpzvzAsn)

3\. Отредактируйте файл кастомизации.

{% hint style="info" %}
Кастомизация настраивается в файле **/opt/itgrix\_bx/customizer/actions/customize\_activity.php.**

Для версий ДО 3.4.0 этот файл находится в каталоге **/opt/itgrix\_bx/custom/**
{% endhint %}

Параметры дела, которые доступны для редактирования, [описаны в статье](/custom_bx.md#1-customize_activity).

```php
$activityFields = array();

if ($params['was_answered'] == false) { // missed
   $key = $params['type'] == 3 ? 'to' : 'from'; // 2 = incoming
   $activityFields['SUBJECT'] = 'Пропущенный от ' . $params[$key];
} else {
   $start_time  = date_create($params["start_time"]);
   $answer_time = date_create($params["answer_time"]);
   $end_time    = date_create($params["end_time"]);
   
   $wait_time_sec = $answer_time->getTimestamp() - $start_time->getTimestamp();
   $duration_time = $end_time->diff($answered_at)->format("%i мин, %s сек.");
   
   $activityFields['DESCRIPTION'] = "Длительность звонка: " . $duration_time .
       " Время ожидания ответа : " . $wait_time_sec . " сек.";
}

return array(
    'state' => 'success',
    'data'  => $activityFields,
);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.itgrix.ru/custom_bx/waiting-duration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
