| 1 | package Asterisk::Extension; | ||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||
| 3 | 1 | require 5.004; | |||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||
| 7 | Asterisk::Extension - Stuff to deal with asterisk extension config | ||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||
| 9 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||
| 11 | stuff goes here | ||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||
| 15 | description | ||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||
| 17 | =over 4 | ||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||
| 19 | =cut | ||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Asterisk; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||
| 23 | 1 | $VERSION = '0.01'; | |||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||
| 25 | 1 | $DEBUG = 1; | |||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub version { $VERSION; } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 30 | 1 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||
| 31 | 1 | my $self = {}; | |||||||||||||||||||||||||||||||||||||
| 32 | 1 | $self->{'exten'} = {}; | |||||||||||||||||||||||||||||||||||||
| 33 | 1 | $self->{'contexts'} = {}; | |||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | bless $self, ref $class || $class; | ||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||||||
| 35 | # while (my ($key,$value) = each %args) { $self->set($key,$value); } | ||||||||||||||||||||||||||||||||||||||
| 36 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub DESTROY { } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | sub exten { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
exten: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my ($self, $context, $extension, $priority, $value) = @_; | |||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||
| 44 | 0 | $self->{'exten'}{$context}{$extension}[$priority] = $value; | |||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub getextensionarr { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
getextensionarr: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my ($self, $context, $extension) = @_; | |||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||
| 50 | 0 | return @{$self->{'exten'}{$context}{$extension}}; | |||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub getextensionlist { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
getextensionlist: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my ($self, $context) = @_; | |||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||
| 56 | 0 | my @list = (); | |||||||||||||||||||||||||||||||||||||
| 57 | #whats the best way to sort here | ||||||||||||||||||||||||||||||||||||||
| 58 | 0 | foreach $ext (sort keys %{$self->{'exten'}{$context}} ) { | |||||||||||||||||||||||||||||||||||||
| 59 | 0 | push(@list, $ext); | |||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||
| 62 | 0 | return @list; | |||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | sub setvar { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
setvar: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my ($self, $context, $var, $val) = @_; | |||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||
| 69 | 0 | $self->{'vars'}{$context}{$var} = $val; | |||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub static { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
static: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my ($self, $static, $context) = @_; | |||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | $self->{'vars'}{$context}{'static'} = $static if defined($static); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 76 | 0 | return $self->{'vars'}{$context}{'static'}; | |||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub writeprotect { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
writeprotect: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my ($self, $wp, $context) = @_; | |||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | $self->{'vars'}{$context}{'writeprotect'} = $wp if defined($wp); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 83 | 0 | return $self->{'vars'}{$context}{'writeprotect'}; | |||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub matchpattern { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
matchpattern: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my ($self, $dialednum, $extension) = @_; | |||||||||||||||||||||||||||||||||||||
| 88 | 0 | my $expr = ''; | |||||||||||||||||||||||||||||||||||||
| 89 | #N 1-9 | ||||||||||||||||||||||||||||||||||||||
| 90 | #X 0-9 | ||||||||||||||||||||||||||||||||||||||
| 91 | #. any one character | ||||||||||||||||||||||||||||||||||||||
| 92 | #_ or - ignore | ||||||||||||||||||||||||||||||||||||||
| 93 | 0 | foreach $chr (split(//,$extension)) { | |||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if (($chr eq '-')||($chr eq '_')) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$chr eq "-" or $chr eq "_"
MC/DC0%0/2
$chr eq "-" or $chr eq "_"
$chr eq "-"
$chr eq "_"
Truth table0%0/3
A or B
A= $chr eq "-"B= $chr eq "_"
| |||||||||||||||||||||||||||||||||||||||
| 95 | 0 | next; | |||||||||||||||||||||||||||||||||||||
| 96 | } elsif ($chr eq 'N') { | ||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $expr .= '[1-9]'; | |||||||||||||||||||||||||||||||||||||
| 98 | } elsif ($chr eq 'X') { | ||||||||||||||||||||||||||||||||||||||
| 99 | 0 | $expr .= '[0-9]'; | |||||||||||||||||||||||||||||||||||||
| 100 | } else { | ||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $expr .= $chr; | |||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | if ($dialednum =~ /^$expr$/) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 106 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||
| 107 | } else { | ||||||||||||||||||||||||||||||||||||||
| 108 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub matchextension { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
matchextension: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my ($self, $context, $dialed) = @_; | |||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my %included = (); | |||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | return 0 if (!defined($context)||!defined($dialed)); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $context and defined $dialed
MC/DC0%0/2
defined $context and defined $dialed
defined $context
defined $dialed
Truth table0%0/3
A and B
A= defined $contextB= defined $dialed
| |||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my @contextlist = ( $context ); | |||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||
| 122 | 0 | foreach $cont (@contextlist) { | |||||||||||||||||||||||||||||||||||||
| 123 | 0 | foreach $ext ($self->getextensionlist($cont)) { | |||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if ($self->matchpattern($dialed, $ext)) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 125 | 0 | return ($ext, $cont); | |||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||
| 130 | 0 | foreach $inccont (keys %{$self->{'contexts'}{$cont}}) { | |||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | if (!defined($included{$inccont})) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 132 | 0 | push(@contextlist, $inccont); | |||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub context { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
context: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my ($self, $context, $include) = @_; | |||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if (!defined($self->{'contexts'}{$context}) ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $self->{'contexts'}{$context} = {}; | |||||||||||||||||||||||||||||||||||||
| 144 | 0 | $self->{'exten'}{$context} = {}; | |||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if (defined($include)) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $self->{'contexts'}{$context}{$include} = 1; | |||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | sub getcontextarr { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
getcontextarr: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my @arr = (); | |||||||||||||||||||||||||||||||||||||
| 159 | 0 | foreach $context ( keys %{$self->{'contexts'}} ) { | |||||||||||||||||||||||||||||||||||||
| 160 | 0 | push(@arr, $context); | |||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||
| 163 | 0 | return @arr; | |||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub writeconfig { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
writeconfig: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my ($self, $filename) = @_; | |||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | return if (!defined($filename)); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | open(CFG, ">$filename") || die $!; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 173 | # my @contextarr = ( 'general' ); | ||||||||||||||||||||||||||||||||||||||
| 174 | 0 | push(@contextarr, $self->getcontextarr()); | |||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||
| 176 | 0 | foreach $context (@contextarr) { | |||||||||||||||||||||||||||||||||||||
| 177 | 0 | print CFG "[$context]\n"; | |||||||||||||||||||||||||||||||||||||
| 178 | 0 | foreach $var (keys %{$self->{'vars'}{$context}}) { | |||||||||||||||||||||||||||||||||||||
| 179 | 0 | print CFG "$var = " . $self->{'vars'}{$context}{$var} . "\n"; | |||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||
| 182 | 0 | foreach $exten ($self->getextensionlist($context)) { | |||||||||||||||||||||||||||||||||||||
| 183 | 0 | my @extarr = $self->getextensionarr($context, $exten); | |||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | for ($x=0; $x<=$#extarr; $x++) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | print CFG "exten => $exten,$x,$extarr[$x]\n" if ($extarr[$x]); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | sub readconfig { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
readconfig: not called CC=16 SCAR=56.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my ($self, $filename) = @_; | |||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my $context = ''; | |||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $line = ''; | |||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $filename = '/etc/asterisk/extensions.conf' if (!defined($filename)); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | open(FN, "<$filename") || die $!; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | while ($line = <FN>) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 206 | 0 | chop($line); | |||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $line =~ s/;(.*)$//; | |||||||||||||||||||||||||||||||||||||
| 210 | 0 | $line =~ s/\s*$//; | |||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | if ($line =~ /^;/) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||
| 212 | 0 | next; | |||||||||||||||||||||||||||||||||||||
| 213 | } elsif ($line =~ /^\s*$/) { | ||||||||||||||||||||||||||||||||||||||
| 214 | 0 | next; | |||||||||||||||||||||||||||||||||||||
| 215 | } elsif ($line =~ /^static\s*[=>]\s*(.*)$/i) { | ||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $self->static($1,$context); | |||||||||||||||||||||||||||||||||||||
| 217 | } elsif ($line =~ /^writeprotect\s*[=>]\s*(.*)$/i) { | ||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $self->writeprotect($1,$context); | |||||||||||||||||||||||||||||||||||||
| 219 | } elsif ($line =~ /^\[(\w+)\]$/) { | ||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $context = $1; | |||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | print STDERR "Context: $context\n" if ($DEBUG>3); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $self->context($context); | |||||||||||||||||||||||||||||||||||||
| 223 | } elsif ($line =~ /^include\s*[=>]+>\s*(.+)$/) { | ||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my $include = $1; | |||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | print STDERR "Include: $include\n" if ($DEBUG>3); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $self->context($context, $include); | |||||||||||||||||||||||||||||||||||||
| 227 | } elsif ($line =~ /^exten\s*[=>]+\s*(.+)/) { | ||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $extenstr = $1; | |||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | print STDERR "ExtensionString: $extenstr\n" if ($DEBUG>3); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my @extarr = split(/,/,$extenstr); | |||||||||||||||||||||||||||||||||||||
| 231 | 0 | my $exten = shift(@extarr); | |||||||||||||||||||||||||||||||||||||
| 232 | 0 | my $pri = shift(@extarr); | |||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $addtl = join(',', @extarr); | |||||||||||||||||||||||||||||||||||||
| 234 | 0 | $self->exten($context, $exten, $pri, $addtl); | |||||||||||||||||||||||||||||||||||||
| 235 | } elsif ($line =~ /^(\w+)\s*[=>]+\s*(.*)/) { | ||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $self->setvar($context, $1, $2); | |||||||||||||||||||||||||||||||||||||
| 237 | } else { | ||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | print STDERR "Unknown line: $line\n" if ($DEBUG); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||
| 244 | 0 | close(FN); | |||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||
| 253 | 1 | 1; | |||||||||||||||||||||||||||||||||||||