• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/classes/general/vi_rest.php
  • Класс: CVoxImplantRestService
  • Вызов: CVoxImplantRestService::saveCallComment
static function saveCallComment($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);
	}

	$callId = $params['CALL_ID'];
	$comment = $params['COMMENT'];
	$call = BitrixVoximplantModelCallTable::getByCallId($callId);
	if ($call)
	{
		BitrixVoximplantModelCallTable::update($call['ID'], [
			'COMMENT' => $comment
		]);

		return 1;
	}

	$statisticCall = BitrixVoximplantStatisticTable::getRow(['filter' => [
		'=CALL_ID' => $callId
	]]);
	if($statisticCall)
	{
		BitrixVoximplantStatisticTable::update($statisticCall['ID'], [
			'COMMENT' => $comment
		]);

		return 1;
	}

	throw new BitrixRestRestException('Call is not found, or finished', 'NOT_FOUND', CRestServer::STATUS_NOT_FOUND);
}