- Модуль: voximplant
- Путь к файлу: ~/bitrix/modules/voximplant/classes/general/vi_incoming.php
- Класс: CVoxImplantIncoming
- Вызов: CVoxImplantIncoming::findCallToIntercept
static function findCallToIntercept($userId)
{
$hourAgo = new FieldTypeDateTime();
$hourAgo->add('-1 hour');
$userId = (int)$userId;
$row = VIModelCallTable::getRow([
'select' => [
'CALL_ID'
],
'filter' => [
'>DATE_CREATE' => $hourAgo,
'=STATUS' => VIModelCallTable::STATUS_WAITING,
[
'LOGIC' => 'OR',
[
'=QUEUE.ALLOW_INTERCEPT' => 'Y',
'=QUEUE.BitrixVoximplantModelQueueUserTable:QUEUE.USER_ID' => $userId
],
[
'INCOMING' => CVoxImplantMain::CALL_INCOMING,
'@USER_ID' => new BitrixMainDBSqlExpression("
SELECT
QU.USER_ID
FROM
b_voximplant_queue_user QU
JOIN b_voximplant_queue Q ON Q.ID = QU.QUEUE_ID
WHERE
Q.ALLOW_INTERCEPT='Y'
AND EXISTS(SELECT 'X' FROM b_voximplant_queue_user QU2 WHERE QU2.QUEUE_ID = Q.ID AND QU2.USER_ID = $userId)
")
]
]
],
]);
return $row ? $row['CALL_ID'] : false;
}