- Модуль: voximplant
- Путь к файлу: ~/bitrix/modules/voximplant/lib/routing/router.php
- Класс: BitrixVoximplantRoutingRouter
- Вызов: Router::buildIvrActionGraph
protected function buildIvrActionGraph($ivrActionId)
{
$config = $this->call->getConfig();
$root = new IvrAction($ivrActionId);
$lastNode = $root;
$action = IvrActionTable::getRowById($ivrActionId);
if($action['ACTION'] === BitrixVoximplantIvrAction::ACTION_QUEUE)
{
$queueId = $action['PARAMETERS']['QUEUE_ID'];
$queueNode = $this->buildQueueGraph($queueId, $config['TIMEMAN'] === 'Y');
if($queueNode instanceof Node)
{
$lastNode->setNext($queueNode);
}
}
else if ($action['ACTION'] === BitrixVoximplantIvrAction::ACTION_USER)
{
$userId = $action['PARAMETERS']['USER_ID'];
list($userNode, $nextNode) = $this->buildUserGraph($userId, 'ivr', 'voicemail');
$lastNode->setNext($userNode);
$lastNode = $nextNode;
}
else if ($action['ACTION'] === BitrixVoximplantIvrAction::ACTION_PHONE)
{
$phoneNumber = $action['PARAMETERS']['PHONE_NUMBER'];
$pstnNode = new Pstn(CVoxImplantPhone::stripLetters($phoneNumber), 'voicemail');
$lastNode->setNext($pstnNode);
}
else if ($action['ACTION'] === BitrixVoximplantIvrAction::ACTION_DIRECT_CODE)
{
$entityInfo = CVoxImplantIncoming::getByInternalPhoneNumber($this->call->getGatheredDigits());
if($entityInfo)
{
if ($entityInfo['ENTITY_TYPE'] === 'user')
{
list($directNode, $nextNode) = static::buildUserGraph($entityInfo['ENTITY_ID'], 'direct', 'voicemail');
$lastNode->setNext($directNode);
$lastNode = $nextNode;
}
else
{
$queueNode = static::buildQueueGraph($entityInfo['ENTITY_ID'], $config['TIMEMAN' === 'Y']);
$lastNode->setNext($queueNode);
$lastNode = $queueNode;
}
}
else
{
return new Hangup(404, 'Could not find user with extension number ' . $this->call->getGatheredDigits());
}
}
return $root;
}