http://65.181.118.232/call_count.php?num=18097143489
Diferentes salidas
Total of active calls 0.5
103 5 Up Playback ss-noservice 0154 00:00:03
###################################
Total of active calls 1
102-00000004 internal 102 1 Ringing AppDial (Outgoing Line) 102 00:00:01
#####################################################
Total of active calls 1
0411 00:00:09 65397a02-9b16-4ba2-a
###############################################
Total of active calls 1
0411 1 Down AppDial (Outgoing Line) 0411 00:00:01
############################################
Total of active calls 1
18097143489 3 Ring Dial SIP/18097143489@cpeak,25 18097143489 00:00:10
Count Script
<?php
$command="core show channels verbose";
$socket = fsockopen("127.0.0.1","5038", $errno, $errstr, 10);
if (!$socket){
echo "$errstr ($errno)\n";
}else{
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n");
fputs($socket, "Secret: ar456\r\n\r\n");
fputs($socket, "Action: Command\r\n");
fputs($socket, "Command: $command\r\n\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
while (!feof($socket)){
$result=fgets($socket);
$result= stristr($result,"active",true);
$d=strlen($result);
if ($d>0){
echo "Total of active calls ".($result/2); //dividimos el total de canales entre 2 para tener el total de lllamadas
echo "<br><br>";
break;
}
}
fclose($socket);
}
?>
Monitor Script
$command="core show channels verbose";
$number=$_GET[num];
$socket = fsockopen("127.0.0.1","5038", $errno, $errstr, 10);
if (!$socket){
echo "$errstr ($errno)\n";
}else{
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n");
fputs($socket, "Secret: aor456\r\n\r\n");
fputs($socket, "Action: Command\r\n");
fputs($socket, "Command: $command\r\n\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
while (!feof($socket)){
$result=fgets($socket);
$result= stristr($result,"$number");
$d=strlen($result);
if ($d>0){
echo "$result<br><br>";
break;
}
}
fclose($socket);
}
?>
No hay comentarios:
Publicar un comentario