This file is indexed.

/usr/share/perl5/Asterisk/Zapata.pm is in libasterisk-agi-perl 1.08-1.

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
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package Asterisk::Zapata;

require 5.004;

=head1 NAME

Asterisk::Zapata - Zapata stuff

=head1 SYNOPSIS

stuff goes here

=head1 DESCRIPTION

description

=cut

use Asterisk;

$VERSION = '0.01';

$DEBUG = 5;

sub version { $VERSION; }

sub new {
	my ($class, %args) = @_;
	my $self = {};
	$self->{'configfile'} = undef;
	$self->{'vars'} = {};
	$self->{'channel'} = {};

	bless $self, ref $class || $class;
#        while (my ($key,$value) = each %args) { $self->set($key,$value); }
	return $self;
}

sub DESTROY { }

sub configfile {
	my ($self, $configfile) = @_;

	if (defined($configfile)) {
		$self->{'configfile'} = $configfile;
	} else {
		$self->{'configfile'} = '/etc/asterisk/zapata.conf' if (!defined($self->{'configfile'}));
	}

	return $self->{'configfile'};
}

sub setvar {
	my ($self, $context, $var, $val) = @_;

	$self->{'vars'}{$context}{$var} = $val;
}

sub channels {
	my ($self, $context, $channels) = @_;

	my @chans = ();
	my $channel = '';
	my $x;

	if ($channels =~ /(\d+)\-(\d+)/) {
		my $beg = $1; my $end = $2;
		if ($end > $beg) {
			for ($x = $beg; $x <= $end; $x++) {
				push(@chans, $x);
			}
		}
	} elsif ($channels =~ /^(\d+)$/) {
		push(@chans, $channels);
	} elsif ($channels =~ /^\d+,/) {
		push(@chans, split(/,/, $channels));
	} else {
		print STDERR "channels got here: $channels\n" if ($DEBUG);
	}	

	foreach $channel (@chans) {

		$self->{'channel'}{$channel}{'channel'} = $channel;
		foreach $var (keys %{$self->{'vars'}{$context}}) {
			$self->{'channel'}{$channel}{$var} = $self->{'vars'}{$context}{$var};
		}
	}

}

sub readconfig {
	my ($self) = @_;

	my $context = '';
	my $line = '';

	my $configfile = $self->configfile();

	open(CF, "<$configfile") || die "Error loading $configfile: $!\n";
	while ($line = <CF>) {
		chop($line);

		$line =~ s/;.*$//;
		$line =~ s/\s*$//;

		if ($line =~ /^;/) {
			next;
		} elsif ($line =~ /^\s*$/) {
			next;
		} elsif ($line =~ /^\[(\w+)\]$/) {
			$context = $1;
			print STDERR "Context: $context\n" if ($DEBUG>3);
		} elsif ($line =~ /^channel\s*[=>]+\s*(.*)$/) {
			$channel = $1;
			$self->channels($context, $1);
			print STDERR "Channel: $channel\n" if ($DEBUG>3);
		} elsif ($line =~ /^(\w+)\s*[=>]+\s*(.*)/) {
			$self->setvar($context, $1, $2);
		} else {
			print STDERR "Unknown line: $line\n" if ($DEBUG);
		}

	}
	close(CF);

return 1;
}

1;