Skip to content

How to perform ChanSpy from Asterisk Manager using Shift8

twmobius edited this page Apr 17, 2015 · 2 revisions

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!

Clone this wiki locally