Browse Source

Integração Teams para ramais PBX

spr_change_address_bd
Lucas Awade 1 year ago
parent
commit
d9ec22cc1b
  1. 414
      admin/cadRamais.php
  2. 34
      admin/funcoes.php

414
admin/cadRamais.php

@ -12,9 +12,9 @@ if ($_GET['ajax'] == 1) {
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="admin/css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="ISO-8859-1" />
@ -37,8 +37,7 @@ if ($_GET['ajax'] == 1) {
});
function seleciona_tudo(val)
{
function seleciona_tudo(val) {
for (i = 0; i < document.form1.elements.length; i++)
if (document.form1.elements[i].type == "checkbox")
if (document.form1.elements[i].name == "allow[]")
@ -46,10 +45,8 @@ if ($_GET['ajax'] == 1) {
}
function TodosMarcados()
{
for (i = 0; i < document.form1.elements.length; i++)
{
function TodosMarcados() {
for (i = 0; i < document.form1.elements.length; i++) {
if (document.form1.elements[i].type == "checkbox")
if (document.form1.elements[i].name != "grava")
if ((document.form1.elements[i].name != 'marcaTodos') && (!document.form1.elements[i].checked))
@ -78,13 +75,11 @@ if ($_GET['ajax'] == 1) {
document.form1.v_numero.disabled = true;
}
if (!document.form1.v_numero.disabled)
{
if (!document.form1.v_numero.disabled) {
document.form1.v_numero.disabled = (numRamais != 1);
}
if (document.form1.v_numero.disabled)
{
if (document.form1.v_numero.disabled) {
document.getElementById('v_numero').value = '';
document.getElementById('v_nome').value = '';
document.getElementById('v_nome').disabled = true;
@ -98,19 +93,15 @@ if ($_GET['ajax'] == 1) {
}
function SetRamal(ramal)
{
function SetRamal(ramal) {
if (document.getElementById("acao").value.toUpperCase() == 'INSERI')
{
if (!ramal)
{
if (document.getElementById("acao").value.toUpperCase() == 'INSERI') {
if (!ramal) {
document.getElementById("callerid2").value = "";
document.getElementById("secret").value = "";
document.getElementById("senha_facilidade3").value = "";
document.getElementById("dispositivo2").value = "";
} else
{
} else {
document.getElementById("callerid2").value = ramal;
document.getElementById("secret").value = "<?php echo $prefixoSenha; ?>" + ramal;
document.getElementById("senha_facilidade3").value = ramal;
@ -120,13 +111,11 @@ if ($_GET['ajax'] == 1) {
}
function incExcecao()
{
function incExcecao() {
var exc = document.getElementById('ramalSecretariaExcessao');
var numero = exc.value;
if (numero)
{
if (numero) {
var lista = document.getElementById('ramalSecExcecoesInc');
var op = document.createElement("OPTION");
@ -134,31 +123,24 @@ if ($_GET['ajax'] == 1) {
op.text = numero;
lista.options.add(op);
exc.value = "";
} else
{
} else {
alert('Informe um Número!');
}
}
function remExcecao()
{
function remExcecao() {
var selectBox = document.getElementById("ramalSecExcecoesInc");
if (selectBox.options[selectBox.selectedIndex])
{
if (selectBox.options[selectBox.selectedIndex]) {
selectBox.options[selectBox.selectedIndex] = null;
}
}
function marca_todos()
{
function marca_todos() {
for (var i = 0; i < document.form1.ramalSecExcecoesInc.length; i++)
{
for (var i = 0; i < document.form1.ramalSecExcecoesInc.length; i++) {
document.form1.ramalSecExcecoesInc.options[i].selected = true;
}
}
</script>
<link href="admin/css/forms.css" rel="stylesheet" type="text/css">
<style type="text/css">
@ -169,6 +151,7 @@ if ($_GET['ajax'] == 1) {
-->
</style>
</head>
<body>
<?php
$acao = $_GET["acao"];
@ -233,13 +216,15 @@ if ($_GET['ajax'] == 1) {
$habilita_prepago = !HabilitaPrepago() ? '0' : $_POST['habilita_prepago'];
$ringTime = trim($_POST["ring_time"]);
$extranet = trim($_POST["extranet"]);
$midiaramal = isset($_POST['midiaramal']) ? 'S' : 'N';
$ispbx_tronco = trim($_POST['ispbx_tronco']);
$fields = array('id', 'nome', 'type', 'secret', 'qualify', 'port', 'permit', 'nat', 'mailbox', 'host', 'dtmfmode', 'context', 'canreinvite',
$fields = array(
'id', 'nome', 'type', 'secret', 'qualify', 'port', 'permit', 'nat', 'mailbox', 'host', 'dtmfmode', 'context', 'canreinvite',
'callerid', 'accountcode', 'allow', 'disallow', 'call-limit', 'deny', 'fromuser', 'fromdomain', 'insecure', 't38pt_udptl', 'videosupport',
'espera', 'sigame_interno', 'sigame_externo', 'sigame_naoatende', 'sigame_ocupado', 'gravacao_chamada', 'musica_espera', 'nao_pertube',
'cadeado', 'senha_voice', 'dispositivo', 'gravacao_saida', 'senha_facilidade', 'callerid2', 'timeout', 'ramalSecretaria',
'habilita_prepago', 'ring_time', 'extranet', 'midiaramal');
'habilita_prepago', 'ring_time', 'extranet', 'ispbx_tronco'
);
if ($v_numero <> '') {
$mailbox = $v_numero;
@ -343,11 +328,11 @@ if ($_GET['ajax'] == 1) {
$query = "INSERT INTO pbx_sip_ramais(nome, type, secret, qualify, port, permit,
nat, mailbox, host, dtmfmode, context, canreinvite, callerid,
accountcode, \"call-limit\", allow, disallow,deny,fromuser,fromdomain,insecure,t38pt_udptl,videosupport,
espera,sigame_interno,sigame_externo,sigame_naoatende,sigame_ocupado,gravacao_chamada,musica_espera,nao_pertube,cadeado,senha_voice,dispositivo,gravacao_saida,senha_facilidade, callerid2, timeout, ramalSecretaria, habilita_prepago, ring_time, extranet, midiaramal)
espera,sigame_interno,sigame_externo,sigame_naoatende,sigame_ocupado,gravacao_chamada,musica_espera,nao_pertube,cadeado,senha_voice,dispositivo,gravacao_saida,senha_facilidade, callerid2, timeout, ramalSecretaria, habilita_prepago, ring_time, extranet, ispbx_tronco)
VALUES ('$nome2', '$type', '$secret', '$qualify', '$port', '$permit', '$nat',
'$mailbox', '$host', '$dtmfmode', '$context', '$canreinvite', '$callerid',
'$accountcode', '$call_limit', '$allow2', 'all','$deny','$fromuser','$fromdomain','$insecure','$t38pt_udptl','$videosupport',
'$espera','$sigame_interno','$sigame_externo','$sigame_nao_atende','$sigame_ocupado','$gravacao','$musicclass','$pertube','$cadeado','$v_senha','$dispositivo','$gravacao_saida','$senha_facilidade', '$callerid2', '$timeout', '$ramalSecretaria', '$habilita_prepago', '$ringTime', '$extranet', '$midiaramal')";
'$espera','$sigame_interno','$sigame_externo','$sigame_nao_atende','$sigame_ocupado','$gravacao','$musicclass','$pertube','$cadeado','$v_senha','$dispositivo','$gravacao_saida','$senha_facilidade', '$callerid2', '$timeout', '$ramalSecretaria', '$habilita_prepago', '$ringTime', '$extranet', '$ispbx_tronco')";
$result = pg_query($dbcon, $query);
@ -372,14 +357,16 @@ if ($_GET['ajax'] == 1) {
$query = "select max(id) as id from pbx_sip_ramais";
$result = pg_query($dbcon, $query);
$id_ult = pg_fetch_row($result);
$novo = array('id' => $id_ult[0], 'nome' => $nome, 'type' => $type, 'secret' => $secret, 'qualify' => $qualify, 'port' => $port, 'permit' => $permit, 'nat' => $nat, 'mailbox' => $mailbox,
$novo = array(
'id' => $id_ult[0], 'nome' => $nome, 'type' => $type, 'secret' => $secret, 'qualify' => $qualify, 'port' => $port, 'permit' => $permit, 'nat' => $nat, 'mailbox' => $mailbox,
'host' => $host, 'dtmfmode' => $dtmfmode, 'context' => $context, 'canreinvite' => $canreinvite, 'callerid' => $callerid, 'accountcode' => $accountcode,
'allow' => $allow2, 'disallow' => 'all', 'call-limit' => $call_limit, 'deny' => $deny, 'fromuser' => $fromuser, 'fromdomain' => $fromdomain,
'insecure' => $insecure, 't38pt_udptl' => $t38pt_udptl, 'videosupport' => $videosupport, 'espera' => $espera, 'sigame_interno' => $sigame_interno,
'sigame_externo' => $sigame_externo, 'sigame_naoatende' => $sigame_nao_atende, 'sigame_ocupado' => $sigame_ocupado, 'gravacao_chamada' => $gravacao,
'musica_espera' => $musicclass, 'nao_pertube' => $pertube, 'cadeado' => $cadeado, 'senha_voice' => $v_senha, 'dispositivo' => $dispositivo,
'gravacao_saida' => $gravacao_saida, 'senha_facilidade' => $senha_facilidade, 'callerid2' => $callerid2, 'timeout' => $timeout, 'extranet' => $extranet, 'midiaramal' => $midiaramal,
'ramalSecretaria' => $ramalSecretaria, 'habilita_prepago' => $habilita_prepago, 'ring_time' => $ringTime);
'gravacao_saida' => $gravacao_saida, 'senha_facilidade' => $senha_facilidade, 'callerid2' => $callerid2, 'timeout' => $timeout, 'extranet' => $extranet, 'ispbx_tronco' => $ispbx_tronco,
'ramalSecretaria' => $ramalSecretaria, 'habilita_prepago' => $habilita_prepago, 'ring_time' => $ringTime
);
GrvAudita($dbcon, $idProg, 'pbx_sip_ramais', 'INS', array(), $novo, $fields, array('id'), true);
@ -414,7 +401,6 @@ if ($_GET['ajax'] == 1) {
}
////executa insersao na base interna do asterisk
if ($midiaramal == 'N') {
CommandAsterisk2($dbcon, 'ESPERA', $nome2, $espera); //executa insersao na base interna do asterisk
CommandAsterisk2($dbcon, 'SIGAME-INTERNO', $nome2, $sigame_interno2); //executa insersao na base interna do asterisk
CommandAsterisk2($dbcon, 'SIGAME-EXTERNO', $nome2, $sigame_externo2); //executa insersao na base interna do asterisk
@ -426,7 +412,11 @@ if ($_GET['ajax'] == 1) {
CommandAsterisk2($dbcon, 'CADEADO', $nome2, $cadeado); //executa insersao na base interna do asterisk
CommandAsterisk2($dbcon, 'NAOPERTUBE', $nome2, $pertube); //executa insersao na base interna do asterisk
CommandAsterisk2($dbcon, 'SENHA', $nome2, $senha_facilidade); //executa insersao na base interna do asterisk
if ($ispbx_tronco) {
CommandAsterisk2($dbcon, 'DISPOSITIVO', $nome2, $ispbx_tronco . '/' . $nome2);
} else {
CommandAsterisk2($dbcon, 'DISPOSITIVO', $nome2, $dispositivo);
}
CommandAsterisk2($dbcon, 'BINA-NOME', $nome2, $callerid);
CommandAsterisk2($dbcon, 'BINA-EXTERNO', $nome2, $callerid2);
CommandAsterisk2($dbcon, 'TIMEOUT-RAMAL', $nome2, $timeout);
@ -436,7 +426,6 @@ if ($_GET['ajax'] == 1) {
}
}
}
}
if ($z >= 1) {
echo "<script>javascript:alert('$msg');</script>";
echo "<script>javascript:history.back();</script>";
@ -459,20 +448,22 @@ if ($_GET['ajax'] == 1) {
espera='$espera', sigame_interno='$sigame_interno', sigame_externo='$sigame_externo',
sigame_naoatende='$sigame_nao_atende', sigame_ocupado='$sigame_ocupado', gravacao_chamada='$gravacao', musica_espera='$musicclass',
nao_pertube='$pertube', cadeado='$cadeado', senha_voice='$v_senha',dispositivo='$dispositivo',gravacao_saida='$gravacao_saida', {$updPassFacilidades} callerid2 = '$callerid2',
timeout='$timeout', ramalSecretaria = '$ramalSecretaria', habilita_prepago='$habilita_prepago', ring_time='$ringTime', extranet='$extranet', midiaramal='$midiaramal'
timeout='$timeout', ramalSecretaria = '$ramalSecretaria', habilita_prepago='$habilita_prepago', ring_time='$ringTime', extranet='$extranet', ispbx_tronco='$ispbx_tronco'
WHERE id=$id";
pg_query($dbcon, $query);
$velho = GetDadosOld();
$novo = array('id' => $id, 'nome' => $nome, 'type' => $type, 'secret' => $secret, 'qualify' => $qualify, 'port' => $port, 'permit' => $permit, 'nat' => $nat, 'mailbox' => $mailbox,
$novo = array(
'id' => $id, 'nome' => $nome, 'type' => $type, 'secret' => $secret, 'qualify' => $qualify, 'port' => $port, 'permit' => $permit, 'nat' => $nat, 'mailbox' => $mailbox,
'host' => $host, 'dtmfmode' => $dtmfmode, 'context' => $context, 'canreinvite' => $canreinvite, 'callerid' => $callerid, 'accountcode' => $accountcode,
'allow' => $allow2, 'disallow' => 'all', 'call-limit' => $call_limit, 'deny' => $deny, 'fromuser' => $fromuser, 'fromdomain' => $fromdomain,
'insecure' => $insecure, 't38pt_udptl' => $t38pt_udptl, 'videosupport' => $videosupport, 'espera' => $espera, 'sigame_interno' => $sigame_interno,
'sigame_externo' => $sigame_externo, 'sigame_naoatende' => $sigame_nao_atende, 'sigame_ocupado' => $sigame_ocupado, 'gravacao_chamada' => $gravacao,
'musica_espera' => $musicclass, 'nao_pertube' => $pertube, 'cadeado' => $cadeado, 'senha_voice' => $v_senha, 'dispositivo' => $dispositivo,
'gravacao_saida' => $gravacao_saida, 'senha_facilidade' => $senha_facilidade, 'callerid2' => $callerid2, 'timeout' => $timeout,
'ramalSecretaria' => $ramalSecretaria, 'habilita_prepago' => $habilita_prepago, 'ring_time' => $ringTime, 'extranet' => '$extranet', 'midiaramal' => $midiaramal);
'ramalSecretaria' => $ramalSecretaria, 'habilita_prepago' => $habilita_prepago, 'ring_time' => $ringTime, 'extranet' => '$extranet', 'ispbx_tronco' => $ispbx_tronco
);
GrvAudita($dbcon, $idProg, 'pbx_sip_ramais', 'UPD', $velho, $novo, $filds, array('id'), true);
InsereRotasRamais($dbcon, $rotas, $nome);
@ -534,7 +525,7 @@ if ($_GET['ajax'] == 1) {
if ($musicclass == '') {
$musicclass = 'default';
} //executa insersao na base interna do asterisk
if ($midiaramal == 'N') {
CommandAsterisk2($dbcon, 'ESPERA', $nome, $espera); //executa insersao na base interna do asterisk
CommandAsterisk2($dbcon, 'SIGAME-INTERNO', $nome, $sigame_interno); //executa insersao na base interna do asterisk
CommandAsterisk2($dbcon, 'SIGAME-EXTERNO', $nome, $sigame_externo); //executa insersao na base interna do asterisk
@ -546,20 +537,22 @@ if ($_GET['ajax'] == 1) {
CommandAsterisk2($dbcon, 'CADEADO', $nome, $cadeado); //executa insersao na base interna do asterisk
CommandAsterisk2($dbcon, 'NAOPERTUBE', $nome, $pertube); //executa insersao na base interna do asterisk
CommandAsterisk2($dbcon, 'SENHA', $nome, $senha_facilidade); //executa insersao na base interna do asterisk
if ($ispbx_tronco) {
CommandAsterisk2($dbcon, 'DISPOSITIVO', $nome, $ispbx_tronco . '/' . $nome);
} else {
CommandAsterisk2($dbcon, 'DISPOSITIVO', $nome, $dispositivo);
}
CommandAsterisk2($dbcon, 'BINA-NOME', $nome, $callerid);
CommandAsterisk2($dbcon, 'BINA-EXTERNO', $nome, $callerid2);
CommandAsterisk2($dbcon, 'TIMEOUT-RAMAL', $nome, $timeout);
CommandAsterisk2($dbcon, 'TEMPO-RING-RAMAL', $nome, $ringTime);
}
} //gera arquivos e executa o reload dos dados no asterisk
if ($passa) {
if ($midiaramal == 'N') {
gera_arquivos($dbcon, 'SIP_RAMAIS', 1, 0); //gera arquivos e executa o reload dos dados no asterisk
gera_arquivos($dbcon, 'VOICEMAIL', 1, 0);
gera_arquivos($dbcon, 'QUEUES_GRUPOS', 1, 1);
}
echo "<script>
opener.location.reload();
@ -572,7 +565,7 @@ if ($_GET['ajax'] == 1) {
}
if ($acao == "edita") {
$id = $_GET["id"] ?? "0";
$id = $_GET["id"] ? $_GET["id"] : "0";
$query = "SELECT * FROM pbx_sip_ramais where id=$id";
$result = pg_query($dbcon, $query);
} else {
@ -635,7 +628,7 @@ if ($_GET['ajax'] == 1) {
$habilita_prepago = !HabilitaPrepago() ? '0' : $dados["habilita_prepago"];
$ringTime = $dados["ring_time"];
$extranet = $dados["extranet"];
$midiaramal = $dados["midiaramal"];
$ispbx_tronco = $dados["ispbx_tronco"];
SetDadosOld();
if ($id) {
@ -681,12 +674,15 @@ if ($_GET['ajax'] == 1) {
<input name="qtde" type="text" class="validate[required,custom[onlyNumber],length[0,100]] caixas" id="qtde2" value="1" size="5" maxlength="10" onchange="valida_voice();" />
</fieldset>
</td>
<td width="25%"><fieldset>
<td width="25%">
<fieldset>
<legend class="labels">Gera Voicemail:</legend>
<input name="gera_voice" type="checkbox" id="gera_voice2" value="sim" onclick="valida_voice();" />
</fieldset></td>
</fieldset>
</td>
<td width="25%"><fieldset>
<td width="25%">
<fieldset>
<legend class="labels">Habilita Pré-pago</legend>
<input name="habilita_prepago" type="radio" value="1" <?php
if (!HabilitaPrepago())
@ -747,14 +743,16 @@ if ($_GET['ajax'] == 1) {
<div align="left">
<fieldset>
<legend class="labels">Senha SIP:</legend>
<input name="secret" type="password" class="validate[optional] caixas" id="secret" value="<?php if ($acao == 'edita') {
<input name="secret" type="password" class="validate[optional] caixas" id="secret" value="<?php
if ($acao == 'edita') {
echo $secret;
} ?>" size="10" maxlength="100" />
}
?>" size="10" maxlength="100" />
<img id="hide-password-ramal" title="Clique para exibir a senha do ramal!" onclick="MostraSenhaRamal('<?= $idProg; ?>', '<?= $nome; ?>');" src="imgSite/hide-password-16.png" border="0" style="vertical-align: middle;">
</fieldset>
</div>
</td>
<td width="14%">
<td width="12%">
<div align="left">
<fieldset>
<legend class="labels">Senha Facilidades:</legend>
@ -768,7 +766,7 @@ if ($_GET['ajax'] == 1) {
</fieldset>
</div>
</td>
<td width="33%">
<td width="28%">
<div align="left">
<fieldset>
<legend class="labels">Tipo:</legend>
@ -802,7 +800,7 @@ if ($_GET['ajax'] == 1) {
</fieldset>
</div>
</td>
<td width="13%">
<td width="12%">
<div align="left">
<fieldset>
<legend class="labels"><span class="style5"> Monitorar:</span></legend>
@ -827,22 +825,36 @@ if ($_GET['ajax'] == 1) {
</div>
</td>
<td width="10%">
<td width="18%">
<div align="left">
<fieldset>
<legend class="labels"><span class="style5">Mídia:</span></legend>
<input name="midiaramal" type="checkbox" value="N" <?php
if ($midiaramal == "S") {
echo "checked=\"checked\"";
<legend class="labels"><span class="style5">Tronco PBX:</span></legend>
<select name="ispbx_tronco" class="caixas">
<option value=""> ----------------------------- </option>
<?php
$query2 = "SELECT id, username, nome, tipo FROM pbx_troncos ORDER BY nome;";
$result2 = pg_query($dbcon, $query2);
$troncos = pg_fetch_all($result2);
foreach ($troncos as $v) {
$selected = "";
$dispPbx = $v['tipo'] . '/' . $v['username'];
if ($dispPbx == $ispbx_tronco) {
$selected = "selected";
}
?> /> Ativar
$options .= sprintf("<option value='%s' %s>%s</option>", $dispPbx, $selected, $v['nome']);
}
echo $options;
?>
</select>
</fieldset>
</div>
</td>
</tr>
</table>
</div> <div align="right"></div></td>
</div>
<div align="right"></div>
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td bgcolor="#EAEAEA" class="labels">
@ -871,9 +883,11 @@ if ($_GET['ajax'] == 1) {
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td bgcolor="#EAEAEA" class="labels"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<td bgcolor="#EAEAEA" class="labels">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" width="15%"><fieldset>
<td colspan="2" width="15%">
<fieldset>
<legend class="labels">Porta:</legend>
<input name="port" type="text" class="validate[required,custom[onlyNumber]] caixas" id="port2" value="<?php
if ($acao == 'edita') {
@ -897,7 +911,8 @@ if ($_GET['ajax'] == 1) {
?>" />
<!--<span class="labels2"></span>-->
</td>
<td width="19%"><fieldset>
<td width="19%">
<fieldset>
<legend class="labels">Nat:</legend>
<span class="style5">
<input name="nat" type="radio" value="yes" <?php
@ -918,8 +933,10 @@ if ($_GET['ajax'] == 1) {
}
?> />
N&atilde;o</span>
</fieldset></td>
<td width="20%"><fieldset>
</fieldset>
</td>
<td width="20%">
<fieldset>
<legend class="labels">Fax:</legend>
<span class="style5">
<input name="t38pt_udptl" type="radio" value="yes" <?php
@ -940,8 +957,10 @@ if ($_GET['ajax'] == 1) {
}
?> />
N&atilde;o</span>
</fieldset></td>
<td width="20%"><fieldset>
</fieldset>
</td>
<td width="20%">
<fieldset>
<legend class="labels">Suporte a V&iacute;deo:</legend>
<span class="style5">
<input name="videosupport" type="radio" value="yes" <?php
@ -962,8 +981,10 @@ if ($_GET['ajax'] == 1) {
}
?> />
N&atilde;o</span>
</fieldset></td>
<td width="20%"><div align="left">
</fieldset>
</td>
<td width="20%">
<div align="left">
<fieldset>
<legend class="labels">Tempo de Ring:</legend>
<input name="ring_time" type="text" class="validate[required,custom[onlyNumber]] caixas" id="ring_time" value="<?php
@ -975,15 +996,19 @@ if ($_GET['ajax'] == 1) {
?>" size="10" />
<span class="style5"></span>
</fieldset>
</div></td>
</div>
</td>
</tr>
</table></td>
</table>
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td bgcolor="#EAEAEA" class="labels"><div align="right"><span class="style5"> </span></div>
<td bgcolor="#EAEAEA" class="labels">
<div align="right"><span class="style5"> </span></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%"><fieldset>
<td width="25%">
<fieldset>
<legend class="labels">M&uacute;sica de Espera:</legend>
<select name="musicclass" class="caixas">
<option value="">---------</option>
@ -1001,8 +1026,11 @@ if ($_GET['ajax'] == 1) {
?>><?php echo $dados2['nome']; ?></option>
<?php } ?>
</select>
</fieldset></td>
<td width="25%"><fieldset> <legend class="labels"><span class="style5">Tratar conex&otilde;es dos Peers:</span></legend>
</fieldset>
</td>
<td width="25%">
<fieldset>
<legend class="labels"><span class="style5">Tratar conex&otilde;es dos Peers:</span></legend>
<select name="insecure" class="caixas" id="insecure">
<option value="" <?php
if ($insecure == '') {
@ -1035,8 +1063,10 @@ if ($_GET['ajax'] == 1) {
}
?>>no</option>
</select>
</fieldset></td>
<td width="25%"><fieldset>
</fieldset>
</td>
<td width="25%">
<fieldset>
<legend class="labels"><span class="style5">Servidor:</span></legend>
<input name="host" type="text" class="caixas" id="host2" value="<?php
if ($acao == 'edita') {
@ -1046,8 +1076,10 @@ if ($_GET['ajax'] == 1) {
}
?>" />
<span class="labels2"></span>
</fieldset></td>
<td width="25%"><fieldset>
</fieldset>
</td>
<td width="25%">
<fieldset>
<legend class="labels">Modo DTMF:</legend>
<select name="dtmfmode" class="caixas">
<option value="rfc2833" <?php
@ -1071,15 +1103,20 @@ if ($_GET['ajax'] == 1) {
}
?>>auto</option>
</select> <span class="labels"><span class="style5"></span></span>
</fieldset></td>
</fieldset>
</td>
</tr>
</table> </td>
</table>
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td bordercolor="#EAEAEA" bgcolor="#EAEAEA" class="labels"><div align="right"></div> <div align="right">
<td bordercolor="#EAEAEA" bgcolor="#EAEAEA" class="labels">
<div align="right"></div>
<div align="right">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%"><div align="left">
<td width="20%">
<div align="left">
<fieldset>
<legend class="labels">Limite de Liga&ccedil;&atilde;o:</legend>
<input name="call-limit" type="text" class="caixas" id="call-limit2" value="<?php
@ -1091,8 +1128,10 @@ if ($_GET['ajax'] == 1) {
?>" size="10" />
<span class="style5"></span>
</fieldset>
</div></td>
<td width="20%"><div align="left">
</div>
</td>
<td width="20%">
<div align="left">
<fieldset>
<legend class="labels"><span class="style5">Contexto:</span></legend>
<select name="context" class="caixas">
@ -1112,8 +1151,10 @@ if ($_GET['ajax'] == 1) {
<?php } ?>
</select>
</fieldset>
</div></td>
<td width="20%"><div align="left">
</div>
</td>
<td width="20%">
<div align="left">
<fieldset>
<legend class="labels"><span class="style5">Bina:</span></legend>
<input name="callerid" type="text" class="caixas" id="callerid2" value="<?php
@ -1123,7 +1164,8 @@ if ($_GET['ajax'] == 1) {
?>" size="15" />
<span class="labels2"></span>
</fieldset>
</div></td>
</div>
</td>
<td width="20%">
<div align="left">
<fieldset>
@ -1139,13 +1181,17 @@ if ($_GET['ajax'] == 1) {
</td>
</tr>
</table>
</div> </td>
</div>
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td bgcolor="#EAEAEA" class="labels"><div align="right"> </div> <div align="right">
<td bgcolor="#EAEAEA" class="labels">
<div align="right"> </div>
<div align="right">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="left">
<td>
<div align="left">
<fieldset>
<legend class="labels">Dispositivo:</legend>
<input name="dispositivo" type="text" class="validate[optional,length[0,100]] caixas" id="dispositivo2" value="<?php
@ -1154,8 +1200,10 @@ if ($_GET['ajax'] == 1) {
}
?>" size="20" maxlength="20" />
</fieldset>
</div></td>
<td><div align="left">
</div>
</td>
<td>
<div align="left">
<fieldset>
<legend class="labels">Siga-me Interno:</legend>
<input name="sigame_interno" type="text" class="validate[optional,custom[onlyNumber],length[0,100]] caixas" id="sigame_interno2" value="<?php
@ -1164,8 +1212,10 @@ if ($_GET['ajax'] == 1) {
}
?>" size="20" maxlength="20" />
</fieldset>
</div></td>
<td><div align="left">
</div>
</td>
<td>
<div align="left">
<fieldset>
<legend class="labels">Siga-me Externo:</legend>
<input name="sigame_externo" type="text" class="validate[optional,custom[onlyNumber],length[0,100]] caixas" id="sigame_externo2" value="<?php
@ -1174,8 +1224,10 @@ if ($_GET['ajax'] == 1) {
}
?>" size="20" maxlength="20" />
</fieldset>
</div></td>
<td><div align="left">
</div>
</td>
<td>
<div align="left">
<fieldset>
<legend class="labels">Siga-me N&atilde;o Atende:</legend>
<input name="sigame_nao_atende" type="text" class="validate[optional,custom[onlyNumber],length[0,100]] caixas" id="sigame_nao_atende2" value="<?php
@ -1184,8 +1236,10 @@ if ($_GET['ajax'] == 1) {
}
?>" size="20" maxlength="20" />
</fieldset>
</div></td>
<td><div align="left">
</div>
</td>
<td>
<div align="left">
<fieldset>
<legend class="labels">Siga-me Ocupado:</legend>
<input name="sigame_ocupado" type="text" class="validate[optional,custom[onlyNumber],length[0,100]] caixas" id="sigame_ocupado2" value="<?php
@ -1194,16 +1248,21 @@ if ($_GET['ajax'] == 1) {
}
?>" size="20" maxlength="20" />
</fieldset>
</div></td>
</div>
</td>
</tr>
</table>
</div></td>
</div>
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td bgcolor="#EAEAEA" class="labels"><div align="right"></div> <div align="right">
<td bgcolor="#EAEAEA" class="labels">
<div align="right"></div>
<div align="right">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="left">
<td>
<div align="left">
<fieldset>
<legend class="labels">Chamada em Espera:</legend>
<span class="style5">
@ -1226,8 +1285,10 @@ if ($_GET['ajax'] == 1) {
?> />
N&atilde;o<span class="labels2"></span></span>
</fieldset>
</div></td>
<td><div align="left">
</div>
</td>
<td>
<div align="left">
<fieldset>
<legend class="labels">Cadeado:</legend>
<span class="style5">
@ -1250,8 +1311,10 @@ if ($_GET['ajax'] == 1) {
?> />
N&atilde;o<span class="labels2"></span></span>
</fieldset>
</div></td>
<td><div align="left">
</div>
</td>
<td>
<div align="left">
<fieldset>
<legend class="labels">N&atilde;o Pertube:</legend>
<span class="style5">
@ -1274,8 +1337,10 @@ if ($_GET['ajax'] == 1) {
?> />
N&atilde;o<span class="labels2"></span></span>
</fieldset>
</div></td>
<td><div align="left">
</div>
</td>
<td>
<div align="left">
<fieldset>
<legend class="labels"><span class="style5">Grava&ccedil;&atilde;o de Entrada:</span></legend>
<span class="style5">
@ -1292,8 +1357,10 @@ if ($_GET['ajax'] == 1) {
?> />
N&atilde;o<span class="labels2"></span></span>
</fieldset>
</div></td>
<td><div align="left">
</div>
</td>
<td>
<div align="left">
<fieldset>
<legend class="labels"><span class="style5">Grava&ccedil;&atilde;o de Saida:</span></legend>
<span class="style5">
@ -1310,8 +1377,10 @@ if ($_GET['ajax'] == 1) {
?> />
N&atilde;o<span class="labels2"></span></span>
</fieldset>
</div></td>
<td><div align="left">
</div>
</td>
<td>
<div align="left">
<fieldset>
<legend class="labels"><span class="style5">Tempo da Ligação:</span></legend>
<span class="style5">
@ -1322,10 +1391,12 @@ if ($_GET['ajax'] == 1) {
?>" size="10" maxlength="10" />
<span class="labels2"></span></span>
</fieldset>
</div></td>
</div>
</td>
</tr>
</table>
</div></td>
</div>
</td>
</tr>
<?php
if (($acao == 'inseri') || (trim($mailbox) == '')) {
@ -1350,14 +1421,18 @@ if ($_GET['ajax'] == 1) {
}
?>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA" class="labels" background="img/button03.gif">
<td class="cabecalho"><div align="center">VOICEMAIL
<td class="cabecalho">
<div align="center">VOICEMAIL
<input name="inseri_voice" type="hidden" id="inseri_voice" value="<?php echo $inseri_voice; ?>" />
</div></td>
</div>
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td class="labels"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<td class="labels">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17%"><fieldset>
<td width="17%">
<fieldset>
<legend class="labels">N&uacute;mero da Caixa:</legend>
<span class="style5"> </span><span class="style5">
<input name="v_numero" type="text" class="validate[optional] caixas" id="v_numero" value="<?php
@ -1368,8 +1443,10 @@ if ($_GET['ajax'] == 1) {
}
?>" size="15" />
</span>
</fieldset></td>
<td width="30%"><fieldset>
</fieldset>
</td>
<td width="30%">
<fieldset>
<legend class="labels">Nome:</legend>
<span class="style5"> </span><span class="style5">
<input name="v_nome" type="text" class="validate[optional] caixas" id="v_nome" value="<?php
@ -1380,8 +1457,10 @@ if ($_GET['ajax'] == 1) {
}
?>" size="30" />
</span>
</fieldset></td>
<td width="14%"><fieldset>
</fieldset>
</td>
<td width="14%">
<fieldset>
<legend class="labels">Senha:</legend>
<span class="style5"> </span><span class="style5">
<input name="v_senha" type="password" class="validate[optional] caixas" id="v_senha" value="<?php
@ -1392,8 +1471,10 @@ if ($_GET['ajax'] == 1) {
}
?>" size="10" />
</span>
</fieldset></td>
<td width="39%"><fieldset>
</fieldset>
</td>
<td width="39%">
<fieldset>
<legend class="labels">E-mail:</legend>
<span class="style5"> </span><span class="style5">
<input name="v_email" autocomplete="off" type="text" class="validate[optional] caixas" id="v_email3" value="<?php
@ -1404,14 +1485,18 @@ if ($_GET['ajax'] == 1) {
}
?>" size="30" />
</span>
</fieldset></td>
</fieldset>
</td>
</tr>
</table></td>
</table>
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class="labels">
<td><fieldset>
<td>
<fieldset>
<legend class="labels"> Reproduzir Data e Hora:</legend>
<span class="style5"> </span><span class="style5">
<input name="envelope" type="radio" value="yes" <?php
@ -1432,8 +1517,10 @@ if ($_GET['ajax'] == 1) {
}
?> />
N&atilde;o </span>
</fieldset></td>
<td><fieldset>
</fieldset>
</td>
<td>
<fieldset>
<legend class="labels"> Enviar Anexo:</legend>
<span class="style5"> </span><span class="style5">
<input name="attach" type="radio" value="yes" <?php
@ -1454,8 +1541,10 @@ if ($_GET['ajax'] == 1) {
}
?> />
N&atilde;o </span>
</fieldset></td>
<td><fieldset>
</fieldset>
</td>
<td>
<fieldset>
<legend class="labels">Reproduzir Identifica&ccedil;&atilde;o:</legend>
<span class="style5">
<input name="saycid" type="radio" value="yes" <?php
@ -1476,8 +1565,10 @@ if ($_GET['ajax'] == 1) {
}
?> />
N&atilde;o </span>
</fieldset></td>
<td><fieldset>
</fieldset>
</td>
<td>
<fieldset>
<legend class="labels"> Deletar ap&oacute;s o envio:</legend>
<span class="style5"> </span><span class="style5">
<input name="delete" type="radio" value="yes" <?php
@ -1498,11 +1589,13 @@ if ($_GET['ajax'] == 1) {
}
?> />
N&atilde;o </span>
</fieldset></td>
</fieldset>
</td>
</tr>
</table></td>
</table>
</td>
</tr>
<tr class="labels">
<td width="100%">
@ -1593,7 +1686,8 @@ if ($_GET['ajax'] == 1) {
<div class="boxChefeSec">
<table width="0%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td rowspan="2" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<td rowspan="2" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>Ramal Secret&aacute;ria</td>
</tr>
@ -1615,7 +1709,8 @@ if ($_GET['ajax'] == 1) {
<tr>
<td>&nbsp;</td>
</tr>
</table></td>
</table>
</td>
<td>&nbsp;</td>
<td>Exce&ccedil;&otilde;es</td>
</tr>
@ -1624,7 +1719,8 @@ if ($_GET['ajax'] == 1) {
<input type="button" name="btIncluirRamalExecao" id="btIncluirRamalExecao" value="&gt;" onclick="incExcecao();" />
<br />
<input type="button" name="btExcluirExcessao" id="btExcluirExcessao" value="&lt;" onclick="remExcecao();" />
<br /></td>
<br />
</td>
<td align="center" valign="top">
<select name="ramalSecExcecoesInc[]" size="6" multiple="multiple" id="ramalSecExcecoesInc" style="width:170px;">
<?php
@ -1647,10 +1743,12 @@ if ($_GET['ajax'] == 1) {
</td>
</tr>
<tr bordercolor="#EAEAEA" bgcolor="#EAEAEA">
<td><div align="center"><span class="style1"></span><span class="style1"></span><span class="style1"></span><span class="style1">
<td>
<div align="center"><span class="style1"></span><span class="style1"></span><span class="style1"></span><span class="style1">
<input name="Submit2" type="button" class="labels" onclick="fecha_popup();" value="Fechar" id="btfechar">
<input name="Submit" type="submit" class="labels" value="Salvar" onclick="marca_todos();">
</span></div></td>
</span></div>
</td>
</tr>
</table>
</form>
@ -1660,17 +1758,17 @@ if ($_GET['ajax'] == 1) {
$('#btfechar').click(function () {
var $ = window.parent.$;
var jQuery = window.parent.jQuery;
$.unblockUI({fadeOut: 200});
$.unblockUI({
fadeOut: 200
});
});
});
if (TodosMarcados())
{
if (TodosMarcados()) {
document.getElementById('marcaTodos').checked = 'checked';
}
function LimpaImagem()
{
function LimpaImagem() {
$('#imgSim').attr("src", "imgSite/bullet-link-active.gif");
$('#imgNao').attr("src", "imgSite/bullet-link-active.gif");
$('#imgSenha').attr("src", "imgSite/bullet-link-active.gif");
@ -1766,10 +1864,10 @@ if ($_GET['ajax'] == 1) {
}
});
});
</script>
</body>
</html>
<?php

34
admin/funcoes.php

@ -862,33 +862,19 @@ function gera_arquivos($dbcon, $tipo, $reload = 1, $reloadUra = 1) {
$arq = $caminho_producao . "sip_ramais.conf";
$escreve = fopen($arq, 'w');
$query = "SELECT nome,
type,
secret,
callerid,
qualify,
port,
case when nat = 'yes' then 'force_rport,comedia' else nat end as nat,
host,
dtmfmode,
context,
canreinvite,
disallow,
allow,
\"call-limit\",
videosupport,
fromdomain,
t38pt_udptl,
mailbox,
pickupgroup,
callgroup,
insecure,
accountcode,
extranet,
'DYNAMIC_FEATURES=solintel-lgpd' as setvar
$query = "SELECT nome,type,secret,callerid,qualify,port,case when nat = 'yes' then 'force_rport,comedia' else nat end as nat,host,dtmfmode,context,canreinvite,disallow,allow,\"call-limit\",videosupport,fromdomain,t38pt_udptl,mailbox,pickupgroup,callgroup,insecure,accountcode, extranet, ispbx_tronco
FROM pbx_sip_ramais order by id asc";
$result = pg_query($dbcon, $query);
while ($dados = pg_fetch_array($result)) {
//
// Se o ramal for marcado como PBX não escreve a linha no sip_ramais.conf
//
$ispbxTroncos = trim($dados['ispbx_tronco']);
if($ispbxTroncos){
continue;
}
for ($i = 0; pg_num_fields($result) > $i; $i++) {
$nomeCampo = pg_field_name($result, $i);
if ($nomeCampo == "nome") {

Loading…
Cancel
Save