@ -100,6 +100,7 @@
$id = $_POST["id"];
$id = $_POST["id"];
$nome = LimpaString($_POST["nome"], true);
$nome = LimpaString($_POST["nome"], true);
$nome_asterisk = "$org_id$nome";
$nomeOld = trim($_POST["nomeOld"]);
$nomeOld = trim($_POST["nomeOld"]);
$type = trim($_POST["type"]);
$type = trim($_POST["type"]);
@ -112,6 +113,7 @@
$host = trim($_POST["host"]);
$host = trim($_POST["host"]);
$dtmfmode = trim($_POST["dtmfmode"]);
$dtmfmode = trim($_POST["dtmfmode"]);
$context = trim($_POST["context"]);
$context = trim($_POST["context"]);
$context_asterisk = "$org_id$context";
$registro = trim($_POST["registro"]);
$registro = trim($_POST["registro"]);
$canreinvite = 'no';
$canreinvite = 'no';
$callerid = trim($_POST["callerid"]);
$callerid = trim($_POST["callerid"]);
@ -153,10 +155,10 @@
if ($acao == "inseri") {
if ($acao == "inseri") {
$query = " INSERT INTO pbx_troncos_sip (nome, username, secret, \"type\", context, callerid, host, port,
$query = " INSERT INTO pbx_troncos_sip (nome, username, secret, \"type\", context, callerid, host, port,
deny, permit, qualify, nat, canreinvite, disallow, allow, dtmfmode, fromuser, fromdomain, max_ligacoes,
deny, permit, qualify, nat, canreinvite, disallow, allow, dtmfmode, fromuser, fromdomain, max_ligacoes,
pedido_registro, registro, contrato, portabilidade, org_id)
pedido_registro, registro, contrato, portabilidade, org_id, nome_asterisk, context_asterisk )
VALUES ('$nome', '$username', '$secret', '$type', '$context', '$callerid', '$host', '$port', '0.0.0.0/0.0.0.0',
VALUES ('$nome', '$username', '$secret', '$type', '$context', '$callerid', '$host', '$port', '0.0.0.0/0.0.0.0',
'$permit', '$qualify', '$nat', '$canreinvite', 'all', '$allow2', '$dtmfmode', '$fromuser', '$fromdomain',
'$permit', '$qualify', '$nat', '$canreinvite', 'all', '$allow2', '$dtmfmode', '$fromuser', '$fromdomain',
'$max_ligacoes', '$pedido_registro', '$registro', '$contrato', '$portabilidade', $org_id);";
'$max_ligacoes', '$pedido_registro', '$registro', '$contrato', '$portabilidade', $org_id, '$nome_asterisk', '$context_asterisk' );";
pg_query($dbcon, $query);
pg_query($dbcon, $query);
}
}
@ -165,8 +167,9 @@
SET nome = '$nome', username='$username', secret='$secret', \"type\"='$type', context='$context', callerid='$callerid',
SET nome = '$nome', username='$username', secret='$secret', \"type\"='$type', context='$context', callerid='$callerid',
host='$host', port='$port', deny='0.0.0.0/0.0.0.0', permit='$permit', qualify='$qualify', nat='$nat', canreinvite='$canreinvite',
host='$host', port='$port', deny='0.0.0.0/0.0.0.0', permit='$permit', qualify='$qualify', nat='$nat', canreinvite='$canreinvite',
disallow='all', allow='$allow2', dtmfmode='$dtmfmode', fromuser='$fromuser', fromdomain='$fromdomain', max_ligacoes='$max_ligacoes',
disallow='all', allow='$allow2', dtmfmode='$dtmfmode', fromuser='$fromuser', fromdomain='$fromdomain', max_ligacoes='$max_ligacoes',
pedido_registro='$pedido_registro', registro='$registro', contrato='$contrato', portabilidade = '$portabilidade'
pedido_registro='$pedido_registro', registro='$registro', contrato='$contrato', portabilidade = '$portabilidade', nome_asterisk = '$nome_asterisk',
WHERE id=$id";
context_asterisk = '$context_asterisk'
WHERE id=$id and org_id = $org_id";
pg_query($dbcon, $query);
pg_query($dbcon, $query);
}
}
if (!$msg) {
if (!$msg) {