Skip to content

Instantly share code, notes, and snippets.

@kevin39
Last active September 23, 2016 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevin39/1116392cc4b0965f9490a8ae1fa4cecc to your computer and use it in GitHub Desktop.
Save kevin39/1116392cc4b0965f9490a8ae1fa4cecc to your computer and use it in GitHub Desktop.
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment