Guest User

Untitled

a guest
Apr 21st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.25 KB | None | 0 0
  1. #!/usr/bin/perl
  2. @calls = `pbxf -x "core show channels concise"`;
  3.  
  4. foreach $call(@calls) {
  5.         chomp $call;
  6.         if ( $call ) {
  7.  
  8.                 @channel = split('\!', $call);
  9.                 $channel = $channel[0];
  10.                 $channel =~ s/40m//;
  11.                 chomp $channel;
  12.                 @ChannelInfo = `pbxf -x "core show channel $channel"`;
  13.                 my %callinfo;
  14.                 foreach $chan(@ChannelInfo) {
  15.                         @CallInfo = split(':', $chan);
  16.                         chomp $CallInfo[0];
  17.                         chomp $CallInfo[1];
  18.                         $callinfo{$CallInfo[0]} = $CallInfo[1];
  19.                 }
  20.                 $time = $callinfo{"   Elapsed Time"};
  21.                 @hours = split('h', $time);
  22.                 @minutes = split('m', $hours[1]);
  23.                 @seconds = split('s', $minutes[1]);
  24.  
  25.  
  26.                 print "for call $call call time = $hours[0] hours $minutes[0] minutes and $seconds[0] seconds\n";
  27.                 if ( $hours[0] >= 2 ) {
  28.                         print "hanging up call $channel\n";
  29.                         `pbxf -x soft hangup $channel`;
  30.                 }
  31.  
  32.         }
  33.         else {
  34.                 print "call = nothing -> $call\n";
  35.         }
  36. }
Add Comment
Please, Sign In to add comment