public static function sipDelete($arParams, $nav, $server) { if (!CVoxImplantMain::CheckAccess()) { throw new \Bitrix\Rest\AccessException(); } $arParams = array_change_key_case($arParams, CASE_UPPER); $dbResCnt = \Bitrix\Voximplant\SipTable::getList(array('filter' => array('CONFIG_ID' => $arParams["CONFIG_ID"], 'APP_ID' => $server->getAppId()), 'select' => array("CNT" => new Bitrix\Main\Entity\ExpressionField('CNT', 'COUNT(1)')))); $arResCnt = $dbResCnt->fetch(); if (!$arResCnt || $arResCnt["CNT"] <= 0) { throw new Bitrix\Rest\RestException("Specified CONFIG_ID is not found", Bitrix\Rest\RestException::ERROR_NOT_FOUND, CRestServer::STATUS_WRONG_REQUEST); } $viSip = new CVoxImplantSip(); $result = $viSip->Delete($arParams['CONFIG_ID']); if (!$result || $viSip->GetError()->error) { throw new Bitrix\Rest\RestException($viSip->GetError()->msg, $viSip->GetError()->code, CRestServer::STATUS_WRONG_REQUEST); } return 1; }
private function CreateSipRegistration($sipId, $configId, $server, $login, $password = '') { $viHttp = new CVoxImplantHttp(); $result = $viHttp->CreateSipRegistration($server, $login, $password); if (!$result) { return false; } VI\SipTable::update($sipId, array('REG_ID' => $result->reg_id)); $this->Update($configId, array('TYPE' => self::TYPE_CLOUD, 'SEARCH_ID' => 'reg' . $result->reg_id)); return $result; }