/usr/share/perl5/Asterisk/QCall.pm is in libasterisk-agi-perl 1.01-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | package Asterisk::QCall;
require 5.004;
use Fcntl ':flock';
use Asterisk;
$VERSION = '0.01';
sub version { $VERSION; }
sub new {
my ($class, %args) = @_;
my $self = {};
$self->{QUEUEDIR} = '/var/spool/asterisk/qcall';
$self->{QUEUETIME} = undef;
bless $self, ref $class || $class;
return $self;
}
sub DESTROY { }
sub queuedir {
my ($self, $dir) = @_;
if (defined($dir)) {
$self->{QUEUEDIR} = $dir;
}
return $self->{QUEUEDIR};
}
sub queuetime {
my ($self, $time) = @_;
if (defined($time)) {
$self->{QUEUETIME} = $time;
} elsif (!defined($self->{QUEUETIME})) {
$self->{QUEUETIME} = time();
}
return $self->{QUEUETIME};
}
sub create_qcall {
my ($self, $dialstring, $callerid, $extension, $maxsecs, $identifier, $response) = @_;
my $time = $self->queuetime();
my $queuedir = $self->queuedir();
my $filename = $queuedir . '/' . $time . '.queue';
open(QFILE, ">$filename") || return 0;
flock(QFILE, LOCK_EX);
print QFILE "$dialstring $callerid $extension $maxsecs $identifier $response";
flock(QFILE, LOCK_UN);
close(QFILE);
my $ret = utime($time, $time, $filename);
return 1;
}
1;
|