EOD;
$data = compact_array(query_to_array($sda_query));
if (!is_array($data["data"])) {
    echo out(array("success" => false, "message" => $data));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*
сопоставление номеров групп их символьным обозначениям
скрытие несуществующих номеров
*/
$sda_get_groups = $_SESSION["get_groups"];
// 1 - group, 3 - extension
$sda_get_extensions = $_SESSION["get_extensions"];
// 2 - extension
foreach ($data["data"] as &$row_x) {
    $row_x[2] = extension_number_from_SIP_addresses(base64_decode($row_x[2]));
    // 2 - destination
    $sda_tick_groups = "NO";
    $sda_tick_extensions = "NO";
    foreach ($sda_get_groups as $row_y) {
        if ($row_x[2] == $row_y[3]) {
            $row_x[2] = $row_y[1];
            $sda_tick_groups = "YES";
            break;
        }
    }
    foreach ($sda_get_extensions as $row_z) {
        if ($row_x[2] == $row_z[2]) {
            $sda_tick_extensions = "YES";
            break;
        }
EOD;
$data = compact_array(query_to_array($sda_query));
if (!is_array($data["data"])) {
    echo out(array("success" => false, "message" => $data));
}
$sda_get_groups = $_SESSION["get_groups"];
// 1 - group, 3 - extension
foreach ($data["data"] as $row) {
    $sda_id_table_account = $row[0];
    if ($sda_description == '') {
        $sda_description = $row[1];
    }
    $sda_password_table_account = $row[2];
    $sda_id_table_account_sip = $row[3];
    if ($sda_extension_number == '') {
        $sda_extension_number = extension_number_from_SIP_addresses(base64_decode($row[4]));
    } else {
        foreach ($sda_get_groups as $row_y) {
            if ($sda_extension_number == $row_y[1]) {
                $sda_extension_number = $row_y[3];
                break;
            }
        }
    }
    $sda_id_table_account_sip_caller = $row[5];
    if ($sda_from_whom == '') {
        $sda_from_whom = $row[6];
    }
}
/* - - - - -  ХОД КОНЕМ (КОНЕЦ)  - - - - - */
/* - - - - -  изменение записи в таблице account (НАЧАЛО)  - - - - - */