Using Shift8 is rather simple to perform a ChanSpy on a channel from an external application.
Here it goes:
require_once 'libs/Shift8-0.1.2/library/Shift8.php'; $shift8 = new Shift8("<ajam>", "<manager>", "<secret>", $listener, false); if( !$shift8->login() ) { return false; } $extension = "<enter-extension-to-dial>"; $options = "<enter-channel-to-spy>"; if( $_GET['mode'] == 'whisper' ) $options .= ",dqw"; else $options .= ",q"; if( !$shift8->originate( "Local/" . $extension . "@monitoring", false, false, false, 'ChanSpy', $options ) ){ $shift8->logoff(); return false; } $shift8->logoff(); return true;
Then all you need is to add a context named ‘monitoring’ on your dialplan and you are ready
[monitoring] exten => _X.,1,Dial(SIP/${EXTEN},,) exten => _X.,n,Hangup()
Whisper appears to be broken on Asterisk 1.6.x branches though. It should work by just passing ,w on the ChanSpy
Cheers!
Well this library seems to have good potential, and is very easy to use, except there are some bugs which cause certain functions to not work (for example, the DB* stuff seems to be completely broken, but works after some pretty straight forward changes to the Shift8.php library file).