- Модуль: voximplant
- Путь к файлу: ~/bitrix/modules/voximplant/classes/general/vi_rest.php
- Класс: CVoxImplantRestService
- Вызов: CVoxImplantRestService::sendWait
static function sendWait($params, $n, $server)
{
if ($server->getAuthType() !== BitrixRestSessionAuthAuth::AUTH_TYPE)
{
throw new BitrixRestRestException("This method is only available for internal usage.", "WRONG_AUTH_TYPE", CRestServer::STATUS_FORBIDDEN);
}
$call = BitrixVoximplantModelCallTable::getByCallId($params['CALL_ID']);
if (!$call)
{
throw new BitrixRestRestException("Call is not found, or already finished", BitrixRestRestException::ERROR_NOT_FOUND, CRestServer::STATUS_NOT_FOUND);
}
if ($call['STATUS'] !== BitrixVoximplantModelCallTable::STATUS_WAITING)
{
throw new BitrixRestRestException("Call is already answered", "ERROR_WRONG_STATE");
}
$result = CVoxImplantIncoming::SendCommand(
[
'CALL_ID' => $params['CALL_ID'],
'COMMAND' => CVoxImplantIncoming::RULE_WAIT,
'DEBUG_INFO' => $params['DEBUG_INFO']
],
true
);
if (!$result->isSuccess())
{
$errors = $result->getErrors();
throw new BitrixRestRestException($errors[0]->getMessage(), $errors[0]->getCode());
}
return [
"SUCCESS" => true
];
}