• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/callqueue.php
  • Класс: BitrixVoximplantCallQueue
  • Вызов: CallQueue::getCallPosition
static function getCallPosition($callId)
{
	$call = Call::load($callId);
	if(!$call)
	{
		throw new ArgumentException("Call " . $callId . " is not found");
	}

	$row = ModelCallTable::getRow([
		'select' => [
			'CNT' => new BitrixMainEntityExpressionField('CNT', 'count('*')')
		],
		'filter' => [
			'=STATUS' => ModelCallTable::STATUS_ENQUEUED,
			'=QUEUE_ID' => $call->getQueueId(),
			'>DATE_CREATE' => new SqlExpression("date_sub(now(), interval 1 hour)"),
			' $call->getId()
		]
	]);

	return $row['CNT'] + 1;
}