Asterisk - Click2Spy One click to spy an agent using a PHP script
<?php
$from = $_GET[from];
$to = $_GET[to];
$socket = fsockopen("localhost","5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: USERNAME\r\n");
fputs($socket, "Secret: PASSWORD\r\n\r\n");
$wrets=fgets($socket,128);
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: SIP/".$from."\r\n" );
fputs($socket, "Application: ChanSpy\r\n" );
fputs($socket, "Data: SIP/".$to."\r\n\r\n" );
$wrets=fgets($socket,128);
sleep(3);