You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

812 lines
27 KiB

<?php
/*
* Variavel global modifica o layoute. Valor 1 nao mostra os menus.
*/
$tpLayout = 0;
$ret = '';
/*
* Conecta ao servidor de socket
*/
$socket = ConectaManager(GetSckConnect());
/*
* Guarda totalizações
*/
$totaliza = array("numPlacaDahdi" => 0, "numAlarmPlaca" => 0, "numCanalDahdi" => 0, "numAlarmCanal" => 0,
"numDgvGsm" => 0, "numAlarmGsm" => 0, "numDgvE1" => 0, "numAlarmE1" => 0, "numCanalDGV" => 0, "numAlarmDGV" => 0);
/*
* Ancoras para canais com alarme.
*/
$canaisDgvA = '';
$canaisDahdiA = '';
/*
* Lista informações sobre placas dahdi instaladas no servidor.
*/
$resultados = DahdiShowStatus($socket);
if (count($resultados) > 1) {
$ret = DisplayShowStatus($resultados) . "<br>";
}
/*
* Monitora os canais dahdi */
$resultados = DahdiShowChannels($socket);
if (count($resultados) > 1) {
$ret .= DisplayShowChannels($resultados) . "<br>";
}
/*
* Reseta as estatisticas dgv
*/
if (isset($_POST['btEstatDgv'])) {
DgvResetStatistics($socket);
}
$resultados = DgvShowChannels($socket);
if (count($resultados) > 1) {
$ret .= DisplayDgvShowChannels($resultados) . "<br>";
}
$resultados = DgvShowAlarmsAll($socket);
if (count($resultados) > 1) {
$ret .= DisplayDgvShowAlarms($socket, $resultados);
}
$numPlacaDahdi = $totaliza["numPlacaDahdi"];
$numAlarmPlaca = $totaliza["numAlarmPlaca"];
$numCanalDahdi = $totaliza["numCanalDahdi"];
$numAlarmCanal = $totaliza["numAlarmCanal"];
$numDgvGsm = $totaliza["numDgvGsm"];
$numAlarmGsm = $totaliza["numAlarmGsm"];
$numDgvE1 = $totaliza["numDgvE1"];
$numAlarmE1 = $totaliza["numAlarmE1"];
$numCanalDGV = $totaliza["numCanalDGV"];
$numAlarmDGV = $totaliza["numAlarmDGV"];
$ultAtu = date("H:i:s");
$ret .= str_repeat("<br /> ", 110);
if (IsAjax()) {
$ret = "$ret@$numPlacaDahdi@$numAlarmPlaca@$numCanalDahdi@$numAlarmCanal@$numDgvGsm@$numAlarmGsm@$numDgvE1@$numAlarmE1@$numCanalDGV@$numAlarmDGV@$ultAtu";
echo $ret;
exit;
} else {
$jsStartup[] = "var idSet = window.setInterval(\"MoitorE1()\",10000);";
$jsStartup[] = "SetAncorAlarmsDahdi('$canaisDahdiA');";
$jsStartup[] = "SetAncorAlarmsDgv('$canaisDgvA');";
$smarty->assign('resultados', $ret);
$smarty->assign('numPlacaDahdi', $numPlacaDahdi);
$smarty->assign('numCanalDahdi', $numCanalDahdi);
$smarty->assign('numAlarmPlaca', $numAlarmPlaca);
$smarty->assign('numAlarmCanal', $numAlarmCanal);
$smarty->assign('numCanalDGV', $numCanalDGV);
$smarty->assign('numAlarmDGV', $numAlarmDGV);
$smarty->assign('numDgvGsm', $numDgvGsm);
$smarty->assign('numAlarmGsm', $numAlarmGsm);
$smarty->assign('numDgvE1', $numDgvE1);
$smarty->assign('numAlarmE1', $numAlarmE1);
$smarty->assign('ultAtu', $ultAtu);
$smarty->display("monitorE1.tpl");
}
/*
* functions
*/
function DisplayShowStatus($tabela) {
$start = 0;
$result = "<table width=\"100%\" class=\"grid\">\n";
$titulo = "<a name=\"placa_dahdi\" id=\"placa_dahdi\">Placas Dadhi Instaladas";
$colspan = count($tabela[0]) + 1;
$numPlaca = 0;
$numAlars = 0;
$result .= "<tr><td colspan=\"$colspan\" align=\"center\"><div style=\"width:100%; background-color:#FFC; font:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold; color:#F90;\">$titulo</div></td></tr>\n";
foreach ($tabela as $linha) {
$result .= "<tr>";
foreach ($linha as $coluna) {
$result .= !$start ? "<th>$coluna</th>" : "<td>$coluna</td>";
}
$status = trim(strtoupper($linha[1]));
if (($status != 'OK') && ($start)) {
$statusDisp = "<img src=\"imgSite/ledRed.png\" border=\"0\" width=\"20\" height=\"20\">";
$numAlars++;
} else {
$statusDisp = "<img src=\"imgSite/ledGreen.png\" border=\"0\" width=\"20\" height=\"20\">";
}
$result .= !$start ? "<th align=\"center\" width=\"40\">Status</th>" : "<td align=\"center\">$statusDisp</td>";
if ($start)
$numPlaca++;
$result .= "</tr>\n";
$start++;
}
$result .= "</table>\n";
$GLOBALS["totaliza"]["numPlacaDahdi"] = $numPlaca;
$GLOBALS["totaliza"]["numAlarmPlaca"] = $numAlars;
return $result;
}
function DisplayShowChannels($tabela) {
$start = 0;
$result = "<table width=\"100%\" class=\"grid\">\n";
$titulo = "<a name=\"canais_dahdi\" id=\"canais_dahdi\">Canais Dadhi";
$colspan = count($tabela[0]) + 1;
$result .= "<tr><td colspan=\"$colspan\" align=\"center\"><div style=\"width:100%; background-color:#FFC; font:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold; color:#F90;\">$titulo</div></td></tr>\n";
$numCanal = 0;
$numAlars = 0;
$alarmasA = '';
foreach ($tabela as $linha) {
$idLinha = $linha[0];
$result .= "<tr id=\"canais_dahdi_$idLinha\">";
foreach ($linha as $coluna) {
$result .= !$start ? "<th>$coluna</th>" : "<td>$coluna</td>";
}
$status = trim(strtoupper($linha[7]));
if (($status == 'BLOCK') && ($start)) {
$statusDisp = "<a name=\"canais_dahdi_$idLinha\"><img src=\"imgSite/ledRed.png\" border=\"0\" width=\"20\" height=\"20\"></a>";
$alarmasA .= !$alarmasA ? $idLinha : ";$idLinha";
$numAlars++;
} else {
$statusDisp = "<img src=\"imgSite/ledGreen.png\" border=\"0\" width=\"20\" height=\"20\">";
}
$result .= !$start ? "<th align=\"center\" width=\"40\">Status</th>" : "<td align=\"center\">$statusDisp</td>";
$result .= "</tr>";
if ($start)
$numCanal++;
$start++;
}
$result .= "</table>";
$GLOBALS["totaliza"]["numCanalDahdi"] = $numCanal;
$GLOBALS["totaliza"]["numAlarmCanal"] = $numAlars;
$GLOBALS["canaisDahdiA"] = $alarmasA;
return $result;
}
function DisplayDgvShowChannels($tabela) {
$start = 0;
$result = "<table width=\"100%\" class=\"grid\">\n";
$titulo = "<a name=\"canais_dgv\" id=\"canais_dgv\">Canais Digivoice";
$colspan = count($tabela[0]) + 1;
$result .= "<tr><td colspan=\"$colspan\" align=\"center\"><div style=\"width:100%; background-color:#FFC; font:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold; color:#F90;\">$titulo</div></td></tr>\n";
$numCanalDGV = 0;
$numAlarmDGV = 0;
$canaisDgvA = '';
foreach ($tabela as $linha) {
$result .= "<tr>";
foreach ($linha as $coluna) {
$result .= !$start ? "<th>$coluna</th>" : "<td>$coluna</td>";
}
$status = trim(strtoupper($linha[5]));
if (($status) && ($start)) {
$idCanal = $linha[0];
$statusDisp = "<a name=\"canais_dgv_$idCanal\"><img src=\"imgSite/ledRed.png\" border=\"0\" width=\"20\" height=\"20\"></a>";
$numAlarmDGV++;
$canaisDgvA .= !$canaisDgvA ? $idCanal : ";$idCanal";
} else {
$statusDisp = "<img src=\"imgSite/ledGreen.png\" border=\"0\" width=\"20\" height=\"20\">";
}
if ($start) {
$numCanalDGV++;
}
$result .= !$start ? "<th align=\"center\" width=\"40\">Status</th>" : "<td align=\"center\">$statusDisp</td>";
$result .= "</tr>";
$start++;
}
$result .= "</table>";
$GLOBALS["totaliza"]["numCanalDGV"] = $numCanalDGV;
$GLOBALS["totaliza"]["numAlarmDGV"] = $numAlarmDGV;
$GLOBALS["canaisDgvA"] = $canaisDgvA;
return $result;
}
function DisplayDgvShowAlarms($socket, $resultados) {
$resultAlarm = array();
$alarms = array();
$ret = '';
foreach ($resultados as $result) {
if (array_search($result[0], $alarms) === false) {
$alarms[] = $result[0];
$resultAlarm = DgvShowAlarms($socket, $result[0], $result[1]);
$ret .= (($result[1] == "GSM") ? DisplayDgvShowAlarmGSM($resultAlarm) : DisplayDgvShowAlarmE1($resultAlarm)) .
"<table width=\"100%\" border=0><tr><td style=\"height:15;\"><img src=\"imgSite/blank.png\" width=\"15\" height=\"15\"></td></tr></table>\n";
}
}
return $ret;
}
function DisplayDgvShowAlarmGSM($tabela) {
$start = 0;
$result = "<table align=\"left\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr><td align=\"center\">\n";
$result .= "<table align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=\"400\" class=\"grid\">\n";
$titulo = "<a name=\"placa_gsm\" id=\"placa_gsm\"></a>Alarms Digivoice(GSM)";
$colspan = count($tabela[0]) + 1;
$result .= "<tr><td colspan=\"$colspan\" align=\"center\"><div style=\"width:100%; background-color:#FFC; font:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold; color:#F90;\">$titulo</div></td></tr>\n";
$reset = 0;
$dispReset = '';
$numAlarmGsm = 0;
$ultres = 0;
foreach ($tabela as $linha) {
$linha = trim($linha);
if ((stripos($linha, 'Reset') !== false)) {
$reset++;
}
$aln = "";
if ($reset == 1) {
$dispReset = $linha;
$reset++;
} else if ($reset == 2) {
$linha = $dispReset . ' ' . $linha;
$reset = 0;
$aln = " align=\"center\"";
$ultres = 1;
}
if (!$reset) {
if ($start && (stripos($linha, "Nenhum") !== false)) {
$color = "#FF0000";
$numAlarmGsm++;
} else {
$color = $ultres ? "#000000" : "#00FF00";
}
$result .= "<tr>";
$result .= !$start ? "<th>$linha</th>" : "<td$aln><pre><font color=\"$color\"><strong>$linha</strong></font></pre></td>";
$result .= "</tr>";
}
$start++;
}
$result .= "</table></td></tr></table>";
$GLOBALS["totaliza"]["numAlarmGsm"] = $numAlarmGsm;
return $result;
}
function DisplayDgvShowAlarmE1($tabela) {
$start = 0;
$result = "<table align=\"left\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr><td align=\"center\">\n";
$result .= "<table width=\"400\" class=\"grid\" cellpadding=\"2\" cellspacing=\"0\">\n";
$titulo = "<a name=\"placa_e1\" id=\"placa_e1\">Alarms Digivoice(E1)";
$colspan = count($tabela[0]) + 2;
$result .= "<tr><td colspan=\"$colspan\" align=\"center\"><div style=\"width:100%; background-color:#FFC; font:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold; color:#F90;\">$titulo</div></td></tr>\n";
$numAlarmE1 = 0;
foreach ($tabela as $linha) {
if ($start > 0) {
$result .= "<tr>";
if ((stripos($linha[0], 'Reset') !== false)) {
break;
}
foreach ($linha as $coluna) {
//if(!$coluna) $coluna = '-';
$result .= $start == 1 ? "<th align=\"center\">$coluna</th>" : "<td align=\"left\">" . ($coluna ? $coluna : '-' ) . "</td>";
$irslip = strpos($coluna, 'ALARM_RSLIP') !== false;
$str = $irslip ? "000" : "Off";
$status = (stripos($coluna, $str) !== false); //$irslip ? (stripos($coluna, $str) === false) : (stripos($coluna, $str) !== false);
if (!$status) {
$statusDisp = $coluna ? "<img src=\"imgSite/ledRed.png\" border=\"0\" width=\"20\" height=\"20\">" : '-';
if ($start > 1)
$numAlarmE1++;
}
else {
$statusDisp = "<img src=\"imgSite/ledGreen.png\" border=\"0\" width=\"20\" height=\"20\">";
}
$result .= $start == 1 ? "<th align=\"center\" width=\"40\">Status</th>" : "<td align=\"center\">$statusDisp</td>";
}
$result .= "</tr>";
}
$start++;
}
$GLOBALS["totaliza"]["numAlarmE1"] = $numAlarmE1;
$reset = 0;
$coluna1 = '';
$legend = false;
$colspan++;
foreach ($tabela as $linha) {
if ((stripos($linha[0], 'Reset') !== false)) {
$reset++;
} else if (($reset) && (stripos($linha[0], 'Alarm') !== false)) {
$result .= "<tr><td colspan=\"$colspan\" align=\"center\"><div style=\"width:100%; background-color:#FFC; font:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold; color:#F90;\">Legenda</div></td></tr>\n";
$reset = false;
$legend = true;
} else if ($reset) {
$coluna1 = "Ultimo Reset: " . $linha[0];
$result .= "<tr><td align=\"center\" colspan=\"$colspan\"><strong>$coluna1</strong></td></tr>";
} else if ($legend) {
$result .= "<tr><th align=\"left\">$linha[0]</th><td align=\"left\" colspan=3><strong>$linha[1]</strong></td></tr>";
}
}
$result .= "<tr><td colspan=\"$colspan\" align=\"center\"><input name=\"btEstatDgv\" id=\"btEstatDgv\" type=\"submit\" value=\"Reiniciar Estatísticas\"></td></tr>";
$result .= "</table></td></tr>";
$result .= "</table>\n";
return $result;
}
function DahdiShowStatus($socket) {
/*
* Executa comandos no servidor.
*/
$comandos = array();
$comandos[] = "action: command";
$comandos[] = "command: dahdi show status";
ExecutaMonitorE1($socket, $comandos);
$fimComando = "--END COMMAND--";
$resultado = array();
$start = 0;
$Desc = "";
$Alm = "";
$IR = "";
$bpv = "";
$crc = "";
while (!feof($socket)) {
$buffer = fgets($socket);
/*
* Encerra o loop quando identifica o fim dos commandos
*/
if (strpos($buffer, $fimComando) !== false) {
break;
}
/*
* Inicia a coleta das informações
*/
if ((stripos($buffer, 'Description') !== false) && (stripos($buffer, 'Alarms') !== false)) {
$start++;
}
$extDados = trim($buffer);
if ($start && $extDados) {
$Desc = trim(substr($buffer, 0, 40));
$Alm = trim(substr($buffer, 41, 11));
$IR = trim(substr($buffer, 52, 11));
$bpv = trim(substr($buffer, 63, 11));
$crc = trim(substr($buffer, 74, 4));
$resultado[] = array($Desc, $Alm, $IR, $bpv, $crc);
}
/*
* Garante que o socket não vai procurar para sempre
*/
if ($buffer === false) {
break;
}
}
return $resultado;
}
function DahdiShowChannels($socket) {
/*
* Executa comandos no servidor.
*/
$comandos = array();
$comandos[] = "action: command";
$comandos[] = "command: mfcr2 show channels";
ExecutaMonitorE1($socket, $comandos);
$fimComando = "--END COMMAND--";
$resultado = array();
$start = 0;
//Chan Variant Max ANI Max DNIS ANI First Immediate Accept Tx CAS Rx CAS
$Chan = '';
$Variant = '';
$Max_ANI = '';
$Max_DNIS = '';
$ANI_First = '';
$Immediate = '';
$Tx_Cas = '';
$Rx_CAS = '';
while (!feof($socket)) {
$buffer = fgets($socket);
/*
* Encerra o loop quando identifica o fim dos commandos
*/
if (strpos($buffer, $fimComando) !== false) {
break;
}
/*
* Inicia a coleta das informações
*/
if ((stripos($buffer, 'Chan') !== false) && (stripos($buffer, 'Variant') !== false)) {
$start++;
}
$extDados = trim($buffer);
if (($start && $extDados) || (($start > 1) && (stripos($buffer, 'Chan') === false))) {
$Chan = trim(substr($buffer, 0, 5));
$Variant = trim(substr($buffer, 5, 8));
$Max_ANI = trim(substr($buffer, 13, 8));
$Max_DNIS = trim(substr($buffer, 21, 9));
$ANI_First = trim(substr($buffer, 30, 10));
$Immediate = trim(substr($buffer, 40, 17));
$Tx_Cas = trim(substr($buffer, 57, 9));
$Rx_CAS = trim(substr($buffer, 66, 9));
$resultado[] = array($Chan, $Variant, $Max_ANI, $Max_DNIS, $ANI_First, $Immediate, $Tx_Cas, $Rx_CAS);
}
/*
* Garante que o socket não vai procurar para sempre
*/
if ($buffer === false) {
break;
}
}
return $resultado;
}
function DgvResetStatistics($socket) {
/*
* Executa comandos no servidor.
*/
$comandos = array();
$comandos[] = "action: command";
$comandos[] = "command: dgv alarms reset all all";
ExecutaMonitorE1($socket, $comandos);
$fimComando = "--END COMMAND--";
while (!feof($socket)) {
$buffer = fgets($socket);
/*
* Encerra o loop quando identifica o fim dos commandos
*/
if (strpos($buffer, $fimComando) !== false) {
$resultado = true;
break;
}
/*
* Garante que o socket não vai procurar para sempre
*/
if ($buffer === false) {
$resultado = false;
break;
}
}
return $resultado;
}
function DgvShowChannels($socket) {
/*
* Executa comandos no servidor.
*/
$comandos = array();
$comandos[] = "action: command";
$comandos[] = "command: dgv show channels";
ExecutaMonitorE1($socket, $comandos);
$fimComando = "--END COMMAND--";
$resultado = array();
$Chan = '';
$Grp = '';
$Context = '';
$PortId = '';
$Rsrvd = '';
$Alrmd = '';
$Lckd = '';
$Extension = '';
$CardType = '';
$Intrf = '';
while (!feof($socket)) {
$buffer = fgets($socket);
/*
* Encerra o loop quando identifica o fim dos commandos
*/
if (strpos($buffer, $fimComando) !== false) {
break;
}
/*
* Inicia a coleta das informações
*/
if ((stripos($buffer, 'Chan') !== false) && (stripos($buffer, 'Rsrvd') !== false)) {
$start++;
}
$extDados = trim($buffer);
if ($start && $extDados) {
$Chan = trim(substr($buffer, 0, 5));
$Grp = trim(substr($buffer, 6, 3));
$Context = trim(substr($buffer, 10, 15));
$PortId = trim(substr($buffer, 27, 12));
$Rsrvd = trim(substr($buffer, 40, 5));
$Alrmd = trim(substr($buffer, 46, 5));
$Lckd = trim(substr($buffer, 52, 4));
$Extension = trim(substr($buffer, 57, 11));
$CardType = trim(substr($buffer, 69, 12));
$Intrf = trim(substr($buffer, 82, 6));
if (($start == 1) || (($start > 1) && (stripos($buffer, 'Chan') === false))) {
$resultado[] = array($Chan, $Grp, $Context, $PortId, $Rsrvd, $Alrmd, $Lckd, $Extension, $CardType, $Intrf);
}
$start++;
}
/*
* Garante que o socket não vai procurar para sempre
*/
if ($buffer === false) {
break;
}
}
return $resultado;
}
function DgvShowAlarmsAll($socket) {
/*
* Executa comandos no servidor.
*/
$comandos = array();
$comandos[] = "action: command";
$comandos[] = "command: dgv show alarms all";
$fimComando = "--END COMMAND--";
ExecutaMonitorE1($socket, $comandos);
$resultado = [];
$numCanalGsm = 0;
$numCanalE1 = 0;
while (!feof($socket)) {
$buffer = fgets($socket);
/*
* Encerra o loop quando identifica o fim dos commandos
*/
if (strpos($buffer, $fimComando) !== false) {
break;
}
/*
* Inicia a coleta das informações
*/
if (stripos($buffer, 'CARD:') !== false) {
$start++;
}
$ini = 0;
$tam = 0;
$extDados = trim($buffer);
if ($start && $extDados) {
$ini = strpos($buffer, '<') + 1;
$tam = strpos($buffer, ',') - $ini;
$card = substr($buffer, $ini, $tam);
$card = explode(":", $card);
$tipo = (stripos($buffer, 'GSM') !== false) ? "GSM" : "E1";
$resultado[] = array($card[1], $tipo);
}
/*
* Garante que o socket não vai procurar para sempre
*/
if ($buffer === false) {
break;
}
}
$numcards = array();
foreach ($resultado as $rest) {
if (!array_search($rest[0], $numcards)) {
$numcards[] = $rest[0];
if ($rest[1] == "GSM") {
$numCanalGsm++;
} else {
$numCanalE1++;
};
}
}
$GLOBALS["totaliza"]["numDgvGsm"] = $numCanalGsm;
$GLOBALS["totaliza"]["numDgvE1"] = $numCanalE1;
return $resultado;
}
function DgvShowAlarms($socket, $alarm, $tipo) {
/*
* Executa comandos no servidor.
*/
$comandos = array();
$comandos[] = "action: command";
$comandos[] = "command: dgv show alarms $alarm";
ExecutaMonitorE1($socket, $comandos);
$fimComando = "--END COMMAND--";
$resultado = "";
$start = 0;
$span1 = '';
$span2 = '';
$startSpan = false;
$startLegend = 0;
while (!feof($socket)) {
$buffer = fgets($socket);
/*
* Encerra o loop quando identifica o fim dos commandos
*/
if (strpos($buffer, $fimComando) !== false) {
break;
}
/*
* Inicia a coleta das informações
*/
if (stripos($buffer, 'DigiVoice') !== false) {
$start++;
}
if ($tipo == "GSM") {
if ((stripos($buffer, '+') !== false) && (stripos($buffer, '-') !== false)) {
$buffer = str_replace("+", "", $buffer);
$buffer = str_replace("-", "", $buffer);
}
$linha = '';
$extDados = trim($buffer);
if ($start && $extDados) {
$linha = trim($buffer);
if (substr($linha, 0, 1) == "|") {
$tam = strlen($linha) - 2;
$linha = substr($linha, 1, $tam);
}
$extDados = trim(str_replace("|", "", $buffer));
if ($extDados)
$resultado[] = $linha;
}
}
else {
$linha = '';
$extDados = trim(str_replace("|", "", $buffer));
if ($start && $extDados) {
$span1 = '';
$span2 = '';
/* Linha de Cabecalio */
if (stripos($buffer, 'DigiVoice') !== false) {
$span1 = trim($buffer);
$span2 = 'cabecalio';
} else if (stripos($buffer, 'Span: 1') !== false) {
$span1 = trim(substr($buffer, 8, 9));
$span2 = trim(substr($buffer, 39, 9));
$startSpan = true;
} else if (($startSpan) && (stripos($buffer, '+') !== false)) {
$startSpan = false;
$startLegend++;
} else if ($startSpan) {
$span1 = trim(substr($buffer, 4, 29));
$span2 = trim(substr($buffer, 35, 29));
} else if ($startLegend) {
if ($startLegend == 1) {
$span1 = trim($buffer);
$span2 = "Legenda";
} else {
$span1 = trim(substr($buffer, 11, 14));
$span2 = trim(substr($buffer, 28));
}
$startLegend++;
}
if ($span1) {
$resultado[] = array($span1, $span2);
}
}
}
/*
DigiVoice - Alarmes E1 - Placa E1: 2
+---[ Span: 1 ]----------------+---[ Span: 2 ]----------------+
| | |
| ALARM_LOSS Off 000 | ALARM_LOSS Off 000 |
| ALARM_AISS Off 000 | ALARM_AISS Off 000 |
| ALARM_AIS16S Off 000 | ALARM_AIS16S Off 000 |
| ALARM_SYNC Off 000 | ALARM_SYNC Off 000 |
| ALARM_MFSYNC Off 000 | ALARM_MFSYNC Off 000 |
| ALARM_RAIS Off 000 | ALARM_RAIS Off 000 |
| ALARM_CRC4SYNC Off 000 | ALARM_CRC4SYNC Off 000 |
| ALARM_RSLIP 000 | ALARM_RSLIP 000 |
| | |
| Ultimo Reset: | Ultimo Reset: |
| 2012-11-09 00:00:01 | 2012-11-09 00:00:01 |
| | |
+------------------------------+------------------------------+
Descricoes dos Alarmes:
|
|_ ALARM_LOSS - Indicacao de Perda de Sinal.
|_ ALARM_AISS - Status de Indicacao de Alarme.
|_ ALARM_AIS16S - Indicacao de Alarme no Canal 16.
|_ ALARM_SYNC - Perda de Sincronismo de Quadro.
|_ ALARM_MFSYNC - Perda de Sincronismo de Multiquadro.
|_ ALARM_RAIS - Indicacao de Alarme Remoto.
|_ ALARM_CRC4SYNC - Erro de CRC-4.
|_ ALARM_RSLIP - Escorregamento.
*/
/*
* Garante que o socket não vai procurar para sempre
*/
if ($buffer === false) {
break;
}
}
return $resultado;
}
function GetResult($socket, $fimComando) {
while (!feof($socket)) {
$buffer = fgets($socket);
//list($param, $value) = explode(':', $buffer);
/*
* Garante que o socket não vai procurar para sempre
*/
if (strpos($buffer, $fimComando) !== false) {
break;
}
if ($buffer === false) {
break;
}
}
}
function ExecutaMonitorE1($socket, $comandos) {
$actionid = rand(000000000, 9999999999);
foreach ($comandos as $comando) {
$comando = trim($comando);
fwrite($socket, "$comando\r\n");
}
/*
* Finaliza o comando
*/
fwrite($socket, "ActionID: " . $actionid . "\r\n\r\n");
return $actionid;
}
function GetConnection($conStr) {
$ret = pg_connect($conStr);
if (!$ret) {
logTrb('GetConnection', "Conexao com banco de dados", "Erro ao executar conexao no banco", 'ERRO', $conStr);
}
return $ret;
}
?>