Beispiel #1
0
                 if ($_POST['NUMBER_ID'] > 0) {
                     $result = Bitrix\Voximplant\ConfigTable::getById($_POST['NUMBER_ID']);
                     if ($row = $result->fetch()) {
                         $result = CVoxImplantPhone::EnqueueDeactivatePhoneNumber($row['SEARCH_ID']);
                         if (!$result) {
                             $arSend['ERROR'] = 'ERROR';
                         }
                     }
                 }
                 echo CUtil::PhpToJsObject($arSend);
             } else {
                 if ($_POST['VI_CANCEL_UNLINK_NUMBER'] == 'Y') {
                     $arSend['ERROR'] = '';
                     $_POST['NUMBER_ID'] = intval($_POST['NUMBER_ID']);
                     if ($_POST['NUMBER_ID'] > 0) {
                         $result = Bitrix\Voximplant\ConfigTable::getById($_POST['NUMBER_ID']);
                         if ($row = $result->fetch()) {
                             $result = CVoxImplantPhone::CancelDeactivatePhoneNumber($row['SEARCH_ID']);
                             if (!$result) {
                                 $arSend['ERROR'] = 'ERROR';
                             }
                         }
                     }
                     echo CUtil::PhpToJsObject($arSend);
                 } else {
                     echo CUtil::PhpToJsObject(array('ERROR' => 'UNKNOWN_ERROR'));
                 }
             }
         }
     }
 }
Beispiel #2
0
}
/**
 * @var $arParams array
 * @var $arResult array
 * @var $this CBitrixComponent
 * @var $APPLICATION CMain
 */
/********************************************************************
				Input params
********************************************************************/
/***************** BASE ********************************************/
$arParams["ID"] = intval($arParams["ID"] > 0 ? $arParams["ID"] : $_REQUEST["ID"]);
/********************************************************************
				/Input params
********************************************************************/
$arResult = array("ITEM" => Bitrix\Voximplant\ConfigTable::getById($arParams["ID"])->fetch(), "QUEUE" => array(), "SIP_CONFIG" => array(), "~QUEUE" => array());
if (!!$arResult["ITEM"]) {
    if (!empty($arResult["ITEM"]["WORKTIME_DAYOFF"])) {
        $arResult["ITEM"]["WORKTIME_DAYOFF"] = explode(",", $arResult["ITEM"]["WORKTIME_DAYOFF"]);
    }
    $db_res = Bitrix\Voximplant\QueueTable::getList(array('filter' => array('=CONFIG_ID' => $arResult["ITEM"]["ID"])));
    while ($res = $db_res->fetch()) {
        $arResult["QUEUE"][$res["USER_ID"]] = $res;
        $arResult["~QUEUE"][$res["ID"]] = $res["USER_ID"];
    }
    if ($arResult["ITEM"]["PORTAL_MODE"] == CVoxImplantConfig::MODE_SIP) {
        $viSip = new CVoxImplantSip();
        $arResult["SIP_CONFIG"] = $viSip->Get($arParams["ID"]);
        $arResult["SIP_CONFIG"]['PHONE_NAME'] = $arResult['ITEM']['PHONE_NAME'];
    }
}