• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/callqueue.php
  • Класс: BitrixVoximplantCallQueue
  • Вызов: CallQueue::getCallToDequeue
static function getCallToDequeue($userId)
{
	$isDayOpen = CVoxImplantUser::GetActiveStatusByTimeman($userId);

	$query = CallTable::query()
		->setSelect(['CALL_ID'])
		->where('STATUS', CallTable::STATUS_ENQUEUED)
		->where('DATE_CREATE', '>', new SqlExpression("date_sub(now(), interval 1 hour)"))
		->where('QUEUE.BitrixVoximplantModelQueueUserTable:QUEUE.USER_ID', $userId)
		->setOrder(['ID' => 'asc'])
		->setLimit(1);

	if(!$isDayOpen)
	{
		$query->where('CONFIG.TIMEMAN', 'N');
	}

	$cursor = $query->exec();
	$row = $cursor->fetch();
	if(!$row)
	{
		return false;
	}
	return Call::load($row['CALL_ID']);
}