Asterisk/Conf/Zapata.pm

filter: Statementstmt 14.4% 26 / 180 Branchbran 0.0% 0 / 84 Conditioncond 3.7% 1 / 27 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 30.7% 4 / 13 Podpod 0.0% 0 / 8 totaltotal 9.4% 31 / 328 CC 61 SCAR 63.1
CC
61
Cov
9%
cgiform
1122.0
readconfig
132.0
channels
90.0
CRAP 549.6
« Asterisk/Conf.pm ↑ Summary Asterisk/Extension.pm »
1 package Asterisk::Conf::Zapata;
2  
3 1 require 5.004;
4  
5 =head1 NAME
6  
7 Asterisk::Config::Zapata - Zapata configuration stuff
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 1 ▶use Asterisk::Conf;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 @ISA = ('Asterisk::Conf');
24  
25 1 $VERSION = '0.01';
26  
27 1 $DEBUG = 5;
28  
29 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod undocumented
30 1 my ($class, %args) = @_;
31 1 my $self = {};
32 1 $self->{'name'} = 'Zapata';
33 1 $self->{'description'} = 'Zaptel Channel Driver Configuration';
34 1 $self->{'configfile'} = '/etc/asterisk/zapata.conf';
35 1 $self->{'config'} = {};
36 1 $self->{'configtemp'} = {};
37 1 $self->{'contextorder'} = ( 'channels' );
38 1 $self->{'channelgroup'} = {};
39  
40 1 $self->{'variables'} = {
41 'language' => { 'default' => 'en', 'type' => 'text', 'regex' => '^\w\w$' },
42 'context' => { 'default' => 'default', 'type' => 'text', 'regex' => '^\w*$' },
43 'switchtype' => { 'default' => 'national', 'type' => 'one', 'values' => [ 'national', 'dms100', '4ess', '5ess', 'euroisdn'] },
44 'signalling' => { 'default' => 'fxo_ls', 'type' => 'one', 'values' => ['em', 'em_w', 'featd', 'featdmf', 'featb', 'fxs_ls', 'fxs_gs', 'fxs_ks', 'fxo_ls', 'fxo_gs', 'gxo', 'ks', 'pri_cpe', 'pri_net'] },
45 'prewink' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
46 'preflash' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
47 'wink' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
48 'flash' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
49 'start' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
50 'rxwink' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
51 'rxflash' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
52 'debounce' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
53 'rxwink' => { 'default' => '300', 'type' => 'text', 'regex' => '^\d*$' },
54 'usecallerid' => { 'default' => 'yes', 'type' => 'one', 'values' => ['yes', 'no'] },
55 'hidecallerid' => { 'default' => 'no', 'type' => 'one', 'values' => ['yes', 'no'] },
56 'callwaiting' => { 'default' => 'yes', 'type' => 'one', 'values' => ['yes', 'no'] },
57 'callwaitingcallerid' => { 'default' => 'yes', 'type' => 'one', 'values' => ['yes', 'no'] },
58 'threewaycalling' => { 'default' => 'yes', 'type' => 'one', 'values' => ['yes', 'no'] },
59 'transfer' => { 'default' => 'yes', 'type' => 'one', 'values' => ['yes', 'no'] },
60 'cancallforward' => { 'default' => 'yes', 'type' => 'one', 'values' => ['yes', 'no'] },
61 'mailbox' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
62 'echocancel' => { 'default' => 'yes', 'type' => 'one', 'values' => ['yes', 'no'] },
63 'echocancelwhenbridged' => { 'default' => 'no', 'type' => 'one', 'values' => ['yes', 'no'] },
64 'rxgain' => { 'default' => '0.0', 'type' => 'text', 'regex' => '^[\d\.]*$' },
65 'txgain' => { 'default' => '0.0', 'type' => 'text', 'regex' => '^[\d\.]*$' },
66 'group' => { 'default' => '1', 'type' => 'text', 'regex' => '^\d*$' },
67 'immediate' => { 'default' => undef, 'type' => 'one', 'values' => ['yes', 'no'] },
68 'callerid' => { 'default' => undef, 'type' => 'text', 'regex' => '^.*$' },
69 'amaflags' => { 'default' => undef, 'type' => 'one', 'values' => ['default', 'omit', 'billing', 'documentation'] },
70 'accountcode' => { 'default' => undef, 'type' => 'text', 'regex' => '^\w*$' },
71 'adsi' => { 'default' => undef, 'type' => 'one', 'values' => ['yes', 'no'] },
72 'musiconhold' => { 'default' => undef, 'type' => 'text', '^\w*$' },
73  
74 'idledial' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
75 'idleext' => { 'default' => undef, 'type' => 'text', 'regex' => '^\w*$' },
76 'minunused' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
77 'minidle' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' },
78  
79 'channel' => { 'default' => undef, 'type' => 'text', 'regex' => '^[\d\,\-]*$' },
80 'stripmsd' => { 'default' => undef, 'type' => 'text', 'regex' => '^\d*$' }
81 };
82  
83  
84 1 ▶ bless $self, ref $class || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
85 # while (my ($key,$value) = each %args) { $self->set($key,$value); }
86 1 return $self;
87 }
88  
89 0 ▶sub DESTROY { }
Subroutine DESTROY: not called CC=1 SCAR=0.0
90  
91 0 ▶sub _setvar {
Subroutine _setvar: not called CC=1 SCAR=6.9
92 0 my ($self, $context, $var, $val, $order, $precomment, $postcomment) = @_;
93  
94 0 $self->{'configtemp'}{$context}{$var}{val} = $val;
95 0 $self->{'configtemp'}{$context}{$var}{precomment} = $precomment;
96 0 $self->{'configtemp'}{$context}{$var}{postcomment} = $postcomment;
97 0 $self->{'configtemp'}{$context}{$var}{order} = $order;
98  
99 }
100  
101 0 ▶sub _group {
Subroutine _group: not called CC=2 SCAR=17.9
102 0 my ($self, $context, $channels) = @_;
103  
104 0 ▶ if ($channels) {
Branch: 1 branch
BranchTrueFalseTotal
if ($channels) { } 0 0 0
105 0 push(@{$self->{channelgroup}{$context}}, $channels);
106 } else {
107 0 return @{$self->{channelgroup}{$context}};
108 }
109 }
110  
111 0 ▶sub channels {
Subroutine channels: not called CC=9 SCAR=45.0
Pod undocumented
112 0 my ($self, $context, $channels, $order, $precomment, $postcomment) = @_;
113  
114 0 my @chans = ();
115 0 my $channel = '';
116 0 my $x;
117  
118 0 $self->_group($context, $channels);
119 0 ▶ if ($channels =~ /(\d+)\-(\d+)/) {
Branch: 3 branches
BranchTrueFalseTotal
if ($channels =~ /(\d+)\-(\d+)/) { } 0 0 0
elsif ($channels =~ /^(\d*)$/) { } 0 0 0
elsif ($channels =~ /^\d*,/) { } 0 0 0
120 0 my $beg = $1; my $end = $2;
121 0 ▶ if ($end > $beg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($end > $beg) 0 0 0
122 0 ▶ for ($x = $beg; $x <= $end; $x++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($x <= $end) 0 0 0
123 0 push(@chans, $x);
124 }
125 }
126 } elsif ($channels =~ /^(\d*)$/) {
127 0 push(@chans, $channels);
128 } elsif ($channels =~ /^\d*,/) {
129 0 push(@chans, split(/,/, $channels));
130 } else {
131 0 ▶ print STDERR "channels got here: $channels\n" if ($DEBUG);
Branch: 1 branch
BranchTrueFalseTotal
if $DEBUG 0 0 0
132 }
133 0 @chans = ( $channels );
134 0 foreach $channel (@chans) {
135  
136 # $self->{'config'}{$context}{$channel}{'channel'} = $channel;
137 0 foreach $var (keys %{$self->{'configtemp'}{$context}}) {
138 0 $self->{'config'}{$context}{$channel}{$var}{precomment} = $self->{'configtemp'}{$context}{$var}{precomment};
139 0 $self->{'config'}{$context}{$channel}{$var}{postcomment} = $self->{'configtemp'}{$context}{$var}{postcomment};
140 0 $self->{'config'}{$context}{$channel}{$var}{val} = $self->{'configtemp'}{$context}{$var}{val};
141 0 $self->{'config'}{$context}{$channel}{$var}{order} = $self->{'configtemp'}{$context}{$var}{order};
142 }
143 }
144  
145 }
146  
147 0 ▶sub readconfig {
Subroutine readconfig: not called CC=11 SCAR=48.8
Pod undocumented
148 0 my ($self) = @_;
149  
150 0 my $context = '';
151 0 my $line = '';
152 0 my $precomment = '';
153 0 my $postcomment = '';
154  
155 0 my $configfile = $self->configfile();
156 0 my $contextorder = 0;
157 0 my $order = 0;
158  
159 0 ▶ open(CF, "<$configfile") || die "Error loading $configfile: $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open CF, "<$configfile" or die "Error loading ${configfile}: $!\n" 0 0 0
160 0 ▶ while ($line = <CF>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($line = readline CF)) 0 0 0
161 # chop($line);
162  
163  
164 #deal with comments
165 0 ▶ if ($line =~ /^;/) {
Branch: 4 branches
BranchTrueFalseTotal
if ($line =~ /^;/) { } 0 0 0
elsif ($line =~ /^;ACZ(\w*):\s*(.*)/) { } 0 0 0
elsif ($line =~ /(;.*)$/) { } 0 0 0
elsif ($line =~ /^\s*$/) { } 0 0 0
166 0 $precomment .= $line;
167 0 next;
168 } elsif ($line =~ /^;ACZ(\w*):\s*(.*)/) {
169 0 print STDERR "ACZ Variable $1 = $2\n";
170 0 next;
171 } elsif ($line =~ /(;.*)$/) {
172 0 $postcomment .= $1;
173 0 $line =~ s/;.*$//;
174 } elsif ($line =~ /^\s*$/) {
175 0 $precomment = '';
176 0 $postcomment = '';
177 0 next;
178 }
179  
180 0 chop($line);
181 #strip off whitespace at the end of the line
182 0 $line =~ s/\s*$//;
183  
184  
185 0 ▶ if ($line =~ /^\[(\w+)\]$/) {
Branch: 3 branches
BranchTrueFalseTotal
if ($line =~ /^\[(\w+)\]$/) { } 0 0 0
elsif ($line =~ /^channel\s*[=>]+\s*(.*)$/) { } 0 0 0
elsif ($line =~ /^(\w+)\s*[=>]+\s*(.*)/) { } 0 0 0
186 0 $context = $1;
187 0 $self->_addcontext($context, $contextorder);
188 0 $contextorder++;
189 } elsif ($line =~ /^channel\s*[=>]+\s*(.*)$/) {
190 0 $channel = $1;
191 0 $self->channels($context, $1, $order, $precomment, $postcomment);
192 0 $precomment = '';
193 0 $postcomment = '';
194 0 $order++;
195 } elsif ($line =~ /^(\w+)\s*[=>]+\s*(.*)/) {
196 0 $self->_setvar($context, $1, $2, $order, $precomment, $postcomment);
197 0 $precomment = '';
198 0 $postcomment = '';
199 0 $order++;
200 } else {
201 0 ▶ print STDERR "Unknown line: $line\n" if ($DEBUG);
Branch: 1 branch
BranchTrueFalseTotal
if $DEBUG 0 0 0
202 }
203  
204 }
205 0 close(CF);
206  
207 0 return 1;
208 }
209  
210 0 ▶sub writeconfig {
Subroutine writeconfig: not called CC=9 SCAR=45.0
Pod undocumented
211 0 my ($self, $fh) = @_;
212  
213 0 ▶ if (!$fh) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($fh) 0 0 0
214 0 $fh = \*STDERR;
215 }
216  
217 0 foreach $context ($self->_contextorder()) {
218 0 print $fh "[$context]\n";
219  
220 0 foreach $channelgroup ($self->_group($context)) {
221 0 print $fh ";ACZGroup: $channelgroup\n";
222 }
223  
224 0 foreach $channel (sort {$a <=> $b} keys %{$self->{config}{$context}}) {
225 0 foreach $key (keys %{$self->{config}{$context}{$channel}}) {
226 0 ▶ next if ($key eq 'channel');
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "channel" 0 0 0
227 0 ▶ if ($self->{config}{$context}{$channel}{$key}{val}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"config"}{$context}{$channel}{$key}{"val"}) 0 0 0
228 0 print $fh $self->{config}{$context}{$channel}{$key}{'precomment'};
229 0 print $fh "$key => " . $self->{config}{$context}{$channel}{$key}{val};
230 0 ▶ if ($self->{config}{$context}{$channel}{$key}{postcomment}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'config'}{$context}{$channel}{$key}{'postcomment'}) { } 0 0 0
231 0 print $fh ' ' . $self->{config}{$context}{$channel}{$key}{postcomment};
232 } else {
233 0 print $fh "\n";
234 }
235 }
236 }
237 0 print $fh "channel => $channel\n";
238 0 print $fh "\n";
239 }
240 }
241 }
242  
243 0 ▶sub deletechannel {
Subroutine deletechannel: not called CC=1 SCAR=6.9
Pod undocumented
244 0 my ($self, $context, $channel) = @_;
245  
246 # if (defined($self->{config}{$context}{$channel})) {
247 # $self->{config}{$context}{$channel} = {};
248 # }
249  
250 0 delete($self->{config}{$context}{$channel});
251 0 return 1;
252 }
253  
254 1 ▶sub setvariable {
Subroutine setvariable: called CC=1 SCAR=0.0
Pod undocumented
255 1 my ($self, $context, $channel, $var, $val) = @_;
256  
257 1 $self->{config}{$context}{$channel}{$var}{val} = $val;
258 1 $self->{config}{$context}{$channel}{$var}{precomment} = ";Modified by Asterisk::Config::Zapata\n";
259  
260 }
261  
262 0 ▶sub helptext {
Subroutine helptext: not called CC=1 SCAR=6.9
Pod undocumented
263 0 my ($self, $helpname) = @_;
264  
265  
266 }
267  
268 0 ▶sub cgiform {
Subroutine cgiform: not called CC=33 SCAR=70.2
Pod undocumented
269 0 my ($self, $action, $context, %vars) = @_;
270  
271 #actions can be show, list, add, addform, modify, modifyform, delete, deleteform
272  
273 0 my $html = '';
274  
275 0 my $channel = $vars{'channel'};
276  
277 0 my $module = $self->{'name'};
278 0 my $URL = $ENV{'REQUEST_URI'};
279 0 ▶ if (!$context) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($context) 0 0 0
280 0 $html .= "<p>Context must be specified\n";
281 0 return $html;
282 }
283  
284 #if no action specified then default to list
285 0 ▶ if (!$action) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($action) 0 0 0
286 0 $action = 'list';
287 }
288  
289 0 ▶ if ($action =~ /(.*)form$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($action =~ /(.*)form$/) 0 0 0
290 0 $html .= "<form method=\"post\">\n";
291 0 $html .= "<input type=\"hidden\" name=\"module\" value=\"$module\"\n";
292 0 $html .= "<input type=\"hidden\" name=\"channel\" value=\"$channel\">\n";
293 0 $html .= "<input type=\"hidden\" name=\"context\" value=\"$context\">\n";
294 0 $html .= "<input type=\"hidden\" name=\"action\" value=\"$1\">\n";
295 }
296  
297
298  
299 0 ▶ if ($action eq 'list') {
Branch: 1 branch
BranchTrueFalseTotal
if ($action eq "list") 0 0 0
300 0 foreach $channel ( sort keys %{$self->{config}{$context}} ) {
301 0 $html .= "<a href=\"$URL?module=$module&action=show&context=$context&channel=$channel\">Channel $channel</a>\n";
302 }
303 }
304  
305 0 ▶ if ($action eq 'show' || $action =~ /^modify/ || $action =~ /^delete/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($action eq "show" or $action =~ /^modify/ or $action =~ /^delete/) 0 0 0
Condition0%0/6
$action eq "show" or $action =~ /^modify/ or $action =~ /^delete/
l!l&&r!l&&!r
000
$action eq "show" or $action =~ /^modify/
l!l&&r!l&&!r
000
MC/DC0%0/3
$action eq "show" or $action =~ /^modify/ or $action =~ /^delete/
$action eq "show" $action =~ /^modify/ $action =~ /^delete/
Truth table0%0/4
A or B or C
A= $action eq "show"B= $action =~ /^modify/C= $action =~ /^delete/
ABCresult
1XX1
01X1
0011
0000
306 0 ▶ if (!$channel || !$self->{'config'}{$context}{$channel}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($channel and $self->{"config"}{$context}{$channel}) 0 0 0
Condition0%0/3
$channel and $self->{"config"}{$context}{$channel}
!ll&&!rl&&r
000
MC/DC0%0/2
$channel and $self->{"config"}{$context}{$channel}
$channel $self->{"config"}{$context}{$channel}
Truth table0%0/3
A and B
A= $channelB= $self->{"config"}{$context}{$channel}
ABresult
0X0
100
111
307 0 $html .= "<p>Channel not specified, or channel does not exist\n";
308 0 return $html;
309 }
310 }
311  
312 0 ▶ if ($action eq 'deleteform') {
Branch: 3 branches
BranchTrueFalseTotal
if ($action eq 'deleteform') { } 0 0 0
elsif ($action eq 'delete') { } 0 0 0
elsif ($action eq 'show' or $action =~ /^modify/ or $action =~ /^add/) { } 0 0 0
313 0 $html .= "<br>Are you sure you want to delete channel $channel?\n";
314 0 $html .= "<br><a href=\"$URL?module=$module&action=delete&context=$context&channel=$channel&doit=1\">Confirm</a>\n";
315  
316 } elsif ($action eq 'delete') {
317 0 ▶ if ($vars{'doit'} == 1 && $self->deletechannel($context, $channel)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($vars{'doit'} == 1 and $self->deletechannel($context, $channel)) { } 0 0 0
Condition0%0/3
$vars{"doit"} == 1 and $self->deletechannel($context, $channel)
!ll&&!rl&&r
000
MC/DC0%0/2
$vars{"doit"} == 1 and $self->deletechannel($context, $channel)
$vars{"doit"} == 1 $self->deletechannel($context, $channel)
Truth table0%0/3
A and B
A= $vars{"doit"} == 1B= $self->deletechannel($context, $channel)
ABresult
0X0
100
111
318 0 $html .= "<br>Channel $channel has been deleted\n";
319 } else {
320 0 $html .= "<br>Unable to delete channel $channel\n";
321  
322 }
323 ▶ } elsif ( $action eq 'show' || $action =~ /^modify/ || $action =~ /^add/ ) {
Condition0%0/6
$action eq "show" or $action =~ /^modify/ or $action =~ /^add/
l!l&&r!l&&!r
000
$action eq "show" or $action =~ /^modify/
l!l&&r!l&&!r
000
MC/DC0%0/3
$action eq "show" or $action =~ /^modify/ or $action =~ /^add/
$action eq "show" $action =~ /^modify/ $action =~ /^add/
Truth table0%0/4
A or B or C
A= $action eq "show"B= $action =~ /^modify/C= $action =~ /^add/
ABCresult
1XX1
01X1
0011
0000
324  
325  
326 0 ▶ if ($action eq 'show') {
Branch: 1 branch
BranchTrueFalseTotal
if ($action eq "show") 0 0 0
327 0 $html .= "<a href=\"$URL?module=$module&action=modify&context=$context&channel=$channel\">Modify</a>\n";
328 0 $html .= "<a href=\"$URL?module=$module&action=delete&context=$context&channel=$channel\">Delete</a>\n";
329 }
330  
331 #loop through allowed variables
332 0 foreach $var ( sort keys %{$self->{'variables'}} ) {
333  
334 0 my $value = '';
335 0 ▶ if ($self->{'config'}{$context}{$channel}{$var}{'val'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'config'}{$context}{$channel}{$var}{'val'}) { } 0 0 0
336 0 $value = $self->{'config'}{$context}{$channel}{$var}{'val'};
337 } else {
338 0 $value = $self->{'variables'}{$var}{'default'};
339 }
340  
341 0 ▶ if ($action eq 'show') {
Branch: 3 branches
BranchTrueFalseTotal
if ($action eq 'show') { } 0 0 0
elsif ($action =~ /(.*)form$/) { } 0 0 0
elsif ($action eq 'modify' or $action eq 'add') { } 0 0 0
342 0 $html .= "<br>$var: $value\n";
343 } elsif ($action =~ /(.*)form$/) {
344 0 my $subaction = $1;
345 0 my $fieldtype = $self->{'variables'}{$var}{'type'};
346 0 $html .= "<input type=\"hidden\" name=\"OLD$var\" value=\"$value\">\n";
347 0 ▶ if ($fieldtype eq 'text') {
Branch: 2 branches
BranchTrueFalseTotal
if ($fieldtype eq 'text') { } 0 0 0
elsif ($fieldtype eq 'one') { } 0 0 0
348 0 $html .= "<br>$var: <input type=\"text\" name=\"$var\" value=\"$value\">\n";
349 } elsif ($fieldtype eq 'one') {
350 0 $html .= "<br>$var: \n";
351 0 foreach $item (@{$self->{'variables'}{$var}{'values'}}) {
352 0 ▶ my $checked = 'checked' if ($item eq $value);
Branch: 1 branch
BranchTrueFalseTotal
if $item eq $value 0 0 0
353 0 $html .= "<input type=\"radio\" name=\"$var\" value=\"$item\" $checked> $item\n";
354 }
355 }
356  
357 ▶ } elsif ($action eq 'modify' || $action eq 'add') {
Condition0%0/3
$action eq "modify" or $action eq "add"
l!l&&r!l&&!r
000
MC/DC0%0/2
$action eq "modify" or $action eq "add"
$action eq "modify" $action eq "add"
Truth table0%0/3
A or B
A= $action eq "modify"B= $action eq "add"
ABresult
1X1
011
000
358 0 ▶ if ($action eq 'add' || ($vars{$var} ne $vars{"OLD$var"})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($action eq "add" or $vars{$var} ne $vars{"OLD$var"}) 0 0 0
Condition0%0/3
$action eq "add" or $vars{$var} ne $vars{"OLD$var"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$action eq "add" or $vars{$var} ne $vars{"OLD$var"}
$action eq "add" $vars{$var} ne $vars{"OLD$var"}
Truth table0%0/3
A or B
A= $action eq "add"B= $vars{$var} ne $vars{"OLD$var"}
ABresult
1X1
011
000
359 0 my $newval = $vars{$var};
360 #need to check for valid value here
361 0 ▶ if ($self->variablecheck($context, $var, $newval)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->variablecheck($context, $var, $newval)) 0 0 0
362 0 $self->setvariable($context, $channel, $var, $newval);
363 }
364 }
365  
366 }
367  
368 }
369  
370 }
371  
372 0 ▶ if ($action =~ /form$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($action =~ /form$/) 0 0 0
373 0 $html .= "</form>\n";
374 }
375  
376 0 return $html;
377 }
378  
379  
380 1 1;
« Asterisk/Conf.pm ↑ Summary Asterisk/Extension.pm »