<?php
//http://65.181.118.232/php-project/chanredirect.php?exten=1010&context=internal&channel=SIP/102-00000004
$pbx="localhost";
$timeout=45;
$chan=$_GET['channel'];
$exten=$_GET['exten'];
$context=$_GET['context'];
if($_GET['channel'] && $_GET['context'] && $_GET['exten']){
$socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n"); //
fputs($socket, "Secret: 456\r\n\r\n"); //
//
$wrets=fgets($socket,128);
echo "<center>$wrets</center>";
fputs($socket, "Action: Redirect\r\n" );
fputs($socket, "Channel:$chan\r\n" );
fputs($socket, "Exten: $exten\r\n" );
fputs($socket, "Context: $context\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
sleep (1);
$wrets=fgets($socket,128);
echo "<center><h2>Transfer completed</h2></center>";
}
?>
No hay comentarios:
Publicar un comentario