lunes, 15 de agosto de 2016

asterik spy avatar

[spy]
exten => s,1,Answer
same=>n,ChanSpy(${chan},Bq)   ; channel passed from the url
same=>n,hangup()

<?php



/*parameters */

$param= array("host"=>"localhost","port"=>5038,"trunk"=>"tw0","timeout"=>45);

/*form variables */

$dest=$_GET['dest'];
$cid=$_GET['cid'];
$name=$_GET['name'];
$msg=$_GET['message'];
$chan=$_GET['chan'];

$socket = fsockopen($param['host'],$param['port'], $errno, $errstr,$param['timeout']);
 fputs($socket, "Action: Login\r\n");
 fputs($socket, "UserName: admin\r\n");
 fputs($socket, "Secret:1456\r\n\r\n");
     $wrets=fgets($socket,128);
              echo $wrets;
              fputs($socket, "Action: Originate\r\n" );
              fputs($socket, "Channel: Local/s@spy\r\n" );
              fputs($socket, "Application: playback\r\n" );
              fputs($socket, "Data: $msg\r\n" );
              fputs($socket, "CallerID: $cid\r\n" );
              fputs($socket, "Variable: __var1=$src\r\n" );
              fputs($socket, "Variable: __chan=$chan\r\n" );
              fputs($socket, "Async: yes\r\n\r\n" );
              fputs($socket, "Action: Logoff\r\n\r\n");

 sleep (1);
 $wrets=fgets($socket,128);
/* test url


http://65.18.118.22/dialer/background.php?chan=SIP/1005-00000718&message=/var/www/dialer_upgraded/audio/561fc5964275f
*/
?>



$_GET['chan'];=channel where  audio will be played, as using B, audio will be played   to  both channels

If you want to play the audio file to   an specific channel only use the W  option






No hay comentarios:

Publicar un comentario