Skip to content


How to perform ChanSpy from Asterisk Manager using Shift8

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!

Posted in PHP, Telephony.

Tagged with , , , , , .


2 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Leif Madsen says

    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).

Continuing the Discussion

  1. asteriskforce.com » Blog Archive » How to perform ChanSpy from Asterisk Manager using Shift8 - Just another WordPress weblog linked to this post on June 10, 2010

    [...] Read more from the original source: How to perform ChanSpy from Asterisk Manager using Shift8 [...]



Some HTML is OK

or, reply to this post via trackback.