<?php
error_reporting (E_ALL);
set_time_limit(60);
ob_implicit_flush(false);
$ip_asterisk = "127.0.0.1";
$channel = $_GET[c];
$dtmf = $_GET[d];
$oSocket = fsockopen($ip_asterisk, 5038, $errnum, $errdesc) or
die("Connection to host failed");
fputs($oSocket, "Action: login\r\n");
fputs($oSocket, "Username: admin\r\n");
fputs($oSocket, "Secret: 1456\r\n\r\n");
fputs($oSocket, "Action: PlayDTMF\r\n");
fputs($oSocket, "Channel: $channel\r\n");
fputs($oSocket, "Digit: $dtmf\r\n\r\n");
/*
usleep(500000);
fputs($oSocket, "Action: PlayDTMF\r\n");
fputs($oSocket, "Channel: $canal\r\n");
fputs($oSocket, "Digit: 8\r\n\r\n");
usleep(500000);
fputs($oSocket, "Action: Logoff\r\n\r\n");
*/
// Carga toda la respuesta recibida en un string
$loaded = "";
while (!feof($oSocket)){
$buffer = fgets($oSocket, 4096);
$loaded .= $buffer;
}
$vec = explode("<br>", $loaded);
$len = count($vec);
print_r($vec);
?>
http://165.181.11.23/dtmf.php?c=SIP/400-000000df&d=1
http://lists.digium.com/pipermail/asterisk-users/2009-October/238570.html
No hay comentarios:
Publicar un comentario