Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>CHAMADA ATIVA URA INTELIGENTE</title>
- <meta http-equiv="refresh" content="1"> <!-- See the difference? -->
- </head>
- <body>
- <?php
- //$ramal=$_POST["ramal2"];
- include('https://189.76.240.26/teste/phpagi-asmanager.php');
- $db = 'connection';
- $dbuser = 'root';
- $dbpass = '0319ts';
- $dbhost = 'localhost';
- $conn = new mysqli($dbhost, $dbuser, $dbpass, $db);
- if ($conn->connect_error) {
- die("Erro ao conectar ao banco: " . $conn->connect_error);
- //$agi->exec("NoOp","Erro ao conectar ao banco: " . $conn->connect_error);
- //$agi->hangup();
- }
- // $ramal = "267";
- echo "<h1>Canais ativos para o ramal: $ramal</h1>";
- $asm = new AGI_AsteriskManager();
- if ($asm->connect("189.76.240.26","rapidanet","1234qwer"))
- {
- $channels = $asm->command("core show channels verbose");
- //$data = array();
- foreach(explode("\n", $channels['data']) as $line)
- {
- //$line ="SIP/transit-novo-000 ext-queues 900 42 Up Queue 900,t,,,,,,,, 51997160356 00:11:44 10024 Local/267@from-queue";
- $channel = trim(substr($line,0,21));
- $context = trim(substr($line,21,21));
- $ext = trim(substr($line,42,17));
- $clid = trim(substr($line,111,16));
- //$accountcode = trim(substr($line,136,12)); COMENTEI ESSA LINHA
- $accountcode="10026";
- $dst = trim(substr($line,160,20));
- //echo "$accountcode - $clid - $dst\n";
- if ($accountcode <> "") {
- // if (stristr($dst,$ramal) && stristr($channel,"transit")) { COMENTEI ESSA LINHA
- // dados do cliente
- //$result = $conn->query("SELECT * FROM pabx WHERE Codigo = '$accountcode' LIMIT 1");
- $result = $conn->query("select clientes.*, pabx.* from clientes, pabx where clientes.Codigo = pabx.Cliente and pabx.Codigo = '$accountcode' limit 1");
- $row = $result->fetch_assoc();
- if ($result->num_rows > 0){
- print_r($row);
- }
- // } COMENTEI ESSA LINHA
- }
- //$clid="";
- //$dstch="";
- }
- }
- // echo "$accountcode - $clid - $ext";
- //print_r($v);
- $asm->disconnect();
- $conn->close();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement