# Время ожидания ответа на звонок

Иногда бывает важно знать время ожидания до поднятия трубки, т.к. слишком долгое ожидание может повлиять на качество обслуживания, кроме того знание времени ожидания позволяет управлять нагрузкой на сотрудников и оптимизировать процессы обслуживания клиентов.

Для реализации воспользуемся кастомизацией полей дела:

1. Включаем кастомизацию полей дела в настройках модуля интеграции.<br>

<figure><img src="/files/NafFc6Spuuv3A066CPaC" alt=""><figcaption><p>Кастомизация полей сущности</p></figcaption></figure>

2. Добавляем код в файл **/opt/itgrix\_bx/customizer/actions/customize\_activity.php**

```php
$started_at = date_create($params["start_time"]);
$answered_at = date_create($params["answer_time"]);

$this->logDebug('params: ' . json_encode($started_at));
$this->logDebug('params: ' . json_encode($answered_at));

$wait_time_sec = $answered_at->getTimestamp() - $started_at->getTimestamp();

$this->logDebug('params: ' . json_encode($wait_time_sec));

$activityFields['DESCRIPTION'] = "Время ожидания ответа:  $wait_time_sec сек.";

$this->logDebug("activityFields: ".json_encode($activityFields));

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


```

<figure><img src="/files/d7ESvXbxlzq0BHYHFDCt" alt=""><figcaption><p>Время ожидания ответа</p></figcaption></figure>


---

# 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/vremya-ozhidaniya-otveta-na-zvonok.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.
