[Asterisk-Users] Asterisk Manager API and ZapBarge or ChanSpy

Dan Littlejohn dan.littlejohn at gmail.com
Wed Jan 11 08:59:30 MST 2006


Am trying to monitor and record an in-process phone call using a
remote computer and the Asterisk Manager API.  Have something that is
working, but the call recording volume is to low to be usable.

dialplan

exten => 8159,1,ZapBarge(Zap/1)

remote application with Asterisk Manager API

      $telnet->print("Action: Originate\nChannel:
Local/8159\@default\nApplication: ChanSpy\nData: |q\nPriority:
1\n\n");
      $telnet->waitfor('/Response: Success/');

      # get all the local channels and look for the extension in use
      $telnet->print("Action: Command\nCommand: Local Show Channels\n\n");
      $telnet->waitfor('/Response: Follows/');
      while (($line = $telnet->getline) && ($line !~ /END COMMAND/i)) {
        push(@channels,$line);
      }

      # start the monitor
      while ($line = pop(@channels)) {
        $pattern = "Local\/" . $exten;
        if ($line =~ m/$pattern/i) {
          print $line;

          # start monitor
          $recording = $timestamp . "-" . $uniqueid;
          print $recording;
          $telnet->print("Action: Monitor\nMix: 1\nFormat:
wav49\nChannel: " . $currentChannel ."\nFile: " . $recording .
"\n\n");
          $telnet->waitfor('/Response: Success/');
        }
      }

What I think is happening is that a call is originated for the 8159
extension, which then executes the dialplan zapbarge on in process zap
channel call, then the chanspy listens in.  This barely works, but the
call volume is just not usable.  I am pretty sure I need to get rid of
the zapbarge or chanspy, but I am not sure how to go about originating
the call so it will work.  Any advice would be appreciated.

Thanks;
Dan



More information about the asterisk-users mailing list