Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- @calls = `pbxf -x "core show channels concise"`;
- foreach $call(@calls) {
- chomp $call;
- if ( $call ) {
- @channel = split('\!', $call);
- $channel = $channel[0];
- $channel =~ s/40m//;
- chomp $channel;
- @ChannelInfo = `pbxf -x "core show channel $channel"`;
- my %callinfo;
- foreach $chan(@ChannelInfo) {
- @CallInfo = split(':', $chan);
- chomp $CallInfo[0];
- chomp $CallInfo[1];
- $callinfo{$CallInfo[0]} = $CallInfo[1];
- }
- $time = $callinfo{" Elapsed Time"};
- @hours = split('h', $time);
- @minutes = split('m', $hours[1]);
- @seconds = split('s', $minutes[1]);
- print "for call $call call time = $hours[0] hours $minutes[0] minutes and $seconds[0] seconds\n";
- if ( $hours[0] >= 2 ) {
- print "hanging up call $channel\n";
- `pbxf -x soft hangup $channel`;
- }
- }
- else {
- print "call = nothing -> $call\n";
- }
- }
Add Comment
Please, Sign In to add comment