blib/lib/SignalWire/Relay/Call.pm

filter: Statementstmt 33.3% 64 / 192 Branchbran 23.8% 10 / 42 Conditioncond 21.8% 7 / 32 MC/DCmcdc 5.8% 1 / 17 Subroutinesub 28.5% 18 / 63 Podpod 0.0% 0 / 42 totaltotal 25.7% 100 / 388 CC 36 SCAR 37.8
CC
36
Cov
30%
dispatch_event
155.1
_start_action
30.0
receive_fax
30.0
CRAP 43.8
« bin/swaig-test ↑ Summary blib/lib/SignalWire/Skills/Builtin/WikipediaSearch.pm »
1 package SignalWire::Relay::Call;
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use SignalWire::Relay::Action;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use SignalWire::Relay::Constants qw(CALL_TERMINAL_STATES ACTION_TERMINAL_STATES);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 has 'call_id' => ( is => 'ro', required => 1 );
10 0 ▶has 'node_id' => ( is => 'rw', default => sub { '' } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
11 12 ▶has 'tag' => ( is => 'ro', default => sub { '' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
12 16 ▶has 'state' => ( is => 'rw', default => sub { 'created' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
13 14 ▶has 'device' => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
14 17 ▶has 'end_reason' => ( is => 'rw', default => sub { '' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
15 17 ▶has 'peer' => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
16 16 ▶has 'context' => ( is => 'rw', default => sub { '' } );
Subroutine __ANON__: called CC=1 SCAR=0.0
17 17 ▶has 'dial_winner' => ( is => 'rw', default => sub { 0 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
18  
19 13 ▶has '_client' => ( is => 'rw', default => sub { undef } );
Subroutine __ANON__: called CC=1 SCAR=0.0
20 17 ▶has '_actions' => ( is => 'rw', default => sub { {} } ); # control_id => Action
Subroutine __ANON__: called CC=1 SCAR=0.0
21 17 ▶has '_on_event' => ( is => 'rw', default => sub { [] } ); # event callbacks
Subroutine __ANON__: called CC=1 SCAR=0.0
22  
23 # Helper to generate a UUID-like control_id
24 0 ▶sub _generate_uuid {
Subroutine _generate_uuid: not called CC=1 SCAR=6.9
25 0 my @hex = map { sprintf('%02x', int(rand(256))) } 1..16;
26 0 $hex[6] = sprintf('%02x', (hex($hex[6]) & 0x0f) | 0x40);
27 0 $hex[8] = sprintf('%02x', (hex($hex[8]) & 0x3f) | 0x80);
28 0 return join('-',
29 join('', @hex[0..3]),
30 join('', @hex[4..5]),
31 join('', @hex[6..7]),
32 join('', @hex[8..9]),
33 join('', @hex[10..15]),
34 );
35 }
36  
37 0 ▶sub _base_params {
Subroutine _base_params: not called CC=1 SCAR=6.9
38 0 my ($self) = @_;
39 return (
40 0 node_id => $self->node_id,
41 call_id => $self->call_id,
42 );
43 }
44  
45 0 ▶sub _execute {
Subroutine _execute: not called CC=2 SCAR=17.9
46 0 my ($self, $method, %extra) = @_;
47 0 my $client = $self->_client;
48 0 ▶ die "No client attached to call" unless $client;
Branch: 1 branch
BranchTrueFalseTotal
unless $client 0 0 0
49 0 my %params = ($self->_base_params, %extra);
50 0 return $client->execute($method, \%params);
51 }
52  
53 # Start an action-based method: creates the Action, registers it, executes the RPC
54 0 ▶sub _start_action {
Subroutine _start_action: not called CC=5 SCAR=34.0
55 0 my ($self, $method, $action_class, %extra) = @_;
56 0 my $control_id = _generate_uuid();
57 0 my %params = ($self->_base_params, control_id => $control_id, %extra);
58  
59 0 my $action = $action_class->new(
60 control_id => $control_id,
61 call_id => $self->call_id,
62 node_id => $self->node_id,
63 _client => $self->_client,
64 );
65 0 $self->_actions->{$control_id} = $action;
66  
67 0 my $client = $self->_client;
68 0 ▶ if ($client) {
Branch: 1 branch
BranchTrueFalseTotal
if ($client) 0 0 0
69 0 my $result = $client->execute($method, \%params);
70 # If call is gone (404/410), resolve action immediately
71 0 ▶ if (ref $result eq 'HASH' && $result->{code} && $result->{code} =~ /^(404|410)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $result eq "HASH" and $result->{"code"} and $result->{"code"} =~ /^(404|410)$/) 0 0 0
Condition0%0/6
ref $result eq "HASH" and $result->{"code"} and $result->{"code"} =~ /^(404|410)$/
!ll&&!rl&&r
000
ref $result eq "HASH" and $result->{"code"}
!ll&&!rl&&r
000
MC/DC0%0/3
ref $result eq "HASH" and $result->{"code"} and $result->{"code"} =~ /^(404|410)$/
ref $result eq "HASH" $result->{"code"} $result->{"code"} =~ /^(404|410)$/
Truth table0%0/4
A and B and C
A= ref $result eq "HASH"B= $result->{"code"}C= $result->{"code"} =~ /^(404|410)$/
ABCresult
0XX0
10X0
1100
1111
72 0 $action->_resolve(undef);
73 }
74 }
75  
76 0 return $action;
77 }
78  
79 # --- Event dispatch ---
80  
81 15 ▶sub dispatch_event {
Subroutine dispatch_event: called CC=25 SCAR=50.4
Pod undocumented
82 15 my ($self, $event) = @_;
83 15 ▶ my $event_type = $event->event_type // '';
Condition50%1/2
$event->event_type // ""
l!l
150
MC/DC0%0/1
$event->event_type // ""
$event->event_type
Truth table50%1/2
A
A= $event->event_type
Aresult
11
00
84  
85 # Update call state from state events
86 15 ▶ if ($event_type eq 'calling.call.state') {
Branch: 2 branches
BranchTrueFalseTotal
if ($event_type eq 'calling.call.state') { } 15 0 15
elsif ($event_type eq 'calling.call.connect') { } 0 0 0
87 15 ▶ my $new_state = $event->call_state // '';
Condition50%1/2
$event->call_state // ""
l!l
150
MC/DC0%0/1
$event->call_state // ""
$event->call_state
Truth table50%1/2
A
A= $event->call_state
Aresult
11
00
88 15 $self->state($new_state);
89 15 ▶ $self->end_reason($event->end_reason) if $event->can('end_reason') && $event->end_reason;
Branch: 1 branch
BranchTrueFalseTotal
if $event->can("end_reason") and $event->end_reason 2 13 15
Condition66%2/3
$event->can("end_reason") and $event->end_reason
!ll&&!rl&&r
0132
MC/DC50%1/2
$event->can("end_reason") and $event->end_reason
$event->can("end_reason") $event->end_reason
Truth table66%2/3
A and B
A= $event->can("end_reason")B= $event->end_reason
ABresult
0X0
100
111
90 15 ▶ $self->peer($event->peer) if $event->can('peer') && ref $event->peer eq 'HASH' && %{$event->peer};
Branch: 1 branch
BranchTrueFalseTotal
if $event->can("peer") and ref $event->peer eq "HASH" and %{$event->peer;} 0 15 15
Condition33%2/6
$event->can("peer") and ref $event->peer eq "HASH" and %{$event->peer;}
!ll&&!rl&&r
0150
$event->can("peer") and ref $event->peer eq "HASH"
!ll&&!rl&&r
0015
MC/DC0%0/3
$event->can("peer") and ref $event->peer eq "HASH" and %{$event->peer;}
$event->can("peer") ref $event->peer eq "HASH" %{$event->peer;}
Truth table25%1/4
A and B and C
A= $event->can("peer")B= ref $event->peer eq "HASH"C= %{$event->peer;}
ABCresult
0XX0
10X0
1100
1111
91  
92 # If call ended, resolve all pending actions
93 15 ▶ if (CALL_TERMINAL_STATES->{$new_state}) {
Branch: 1 branch
BranchTrueFalseTotal
if ({"ended" => 1}->{$new_state}) 5 10 15
94 5 $self->_resolve_all_actions;
95 }
96 }
97 elsif ($event_type eq 'calling.call.connect') {
98 0 ▶ $self->peer($event->peer) if $event->can('peer');
Branch: 1 branch
BranchTrueFalseTotal
if $event->can("peer") 0 0 0
99 }
100  
101 # Route to action by control_id
102 15 ▶ my $control_id = $event->can('control_id') ? $event->control_id : '';
Branch: 1 branch
BranchTrueFalseTotal
$event->can('control_id') ? : 0 15 15
103 15 ▶ if ($control_id && exists $self->_actions->{$control_id}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($control_id and exists $self->_actions->{$control_id}) 0 15 15
Condition33%1/3
$control_id and exists $self->_actions->{$control_id}
!ll&&!rl&&r
1500
MC/DC0%0/2
$control_id and exists $self->_actions->{$control_id}
$control_id exists $self->_actions->{$control_id}
Truth table33%1/3
A and B
A= $control_idB= exists $self->_actions->{$control_id}
ABresult
0X0
100
111
104 0 my $action = $self->_actions->{$control_id};
105 # The action decides whether to consume the event. play_and_collect's
106 # CollectAction filters calling.call.play events out entirely so they
107 # neither dispatch nor terminally resolve.
108 0 my $consumed = 1;
109 0 ▶ if ($action->can('_should_consume_event')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($action->can("_should_consume_event")) 0 0 0
110 0 $consumed = $action->_should_consume_event($event);
111 }
112 0 ▶ if ($consumed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($consumed) 0 0 0
113 0 $action->_handle_event($event);
114  
115 # Check if action reached terminal state — but only for events
116 # the action consumed, AND only if the action hasn't already
117 # decided to resolve itself in _handle_event (e.g. Detect on
118 # first detect payload).
119 0 ▶ unless ($action->completed) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($action->completed) 0 0 0
120 0 ▶ my $terminal = ACTION_TERMINAL_STATES->{$event_type} // {};
Condition0%0/2
{"calling.call.collect" => {"error" => 1,"finished" => 1,"no_input" => 1,"no_match" => 1},"calling.call.detect" => {"error" => 1,"finished" => 1},"calling.call.fax" => {"error" => 1,"finished" => 1},"calling.call.pay" => {"error" => 1,"finished" => 1},"calling.call.play" => {"error" => 1,"finished" => 1},"calling.call.record" => {"finished" => 1,"no_input" => 1},"calling.call.stream" => {"finished" => 1},"calling.call.tap" => {"finished" => 1},"calling.call.transcribe" => {"finished" => 1}}->{$event_type} // {}
l!l
00
MC/DC0%0/1
{"calling.call.collect" => {"error" => 1,"finished" => 1,"no_input" => 1,"no_match" => 1},"calling.call.detect" => {"error" => 1,"finished" => 1},"calling.call.fax" => {"error" => 1,"finished" => 1},"calling.call.pay" => {"error" => 1,"finished" => 1},"calling.call.play" => {"error" => 1,"finished" => 1},"calling.call.record" => {"finished" => 1,"no_input" => 1},"calling.call.stream" => {"finished" => 1},"calling.call.tap" => {"finished" => 1},"calling.call.transcribe" => {"finished" => 1}}->{$event_type} // {}
{"calling.call.collect" => {"error" => 1,"finished" => 1,"no_input" => 1,"no_match" => 1},"calling.call.detect" => {"error" => 1,"finished" => 1},"calling.call.fax" => {"error" => 1,"finished" => 1},"calling.call.pay" => {"error" => 1,"finished" => 1},"calling.call.play" => {"error" => 1,"finished" => 1},"calling.call.record" => {"finished" => 1,"no_input" => 1},"calling.call.stream" => {"finished" => 1},"calling.call.tap" => {"finished" => 1},"calling.call.transcribe" => {"finished" => 1}}->{$event_type}
Truth table0%0/2
A
A= {"calling.call.collect" => {"error" => 1,"finished" => 1,"no_input" => 1,"no_match" => 1},"calling.call.detect" => {"error" => 1,"finished" => 1},"calling.call.fax" => {"error" => 1,"finished" => 1},"calling.call.pay" => {"error" => 1,"finished" => 1},"calling.call.play" => {"error" => 1,"finished" => 1},"calling.call.record" => {"finished" => 1,"no_input" => 1},"calling.call.stream" => {"finished" => 1},"calling.call.tap" => {"finished" => 1},"calling.call.transcribe" => {"finished" => 1}}->{$event_type}
Aresult
11
00
121 0 ▶ my $action_state = $event->can('state') ? ($event->state // '') : '';
Branch: 1 branch
BranchTrueFalseTotal
$event->can('state') ? : 0 0 0
Condition0%0/2
$event->state // ""
l!l
00
MC/DC0%0/1
$event->state // ""
$event->state
Truth table0%0/2
A
A= $event->state
Aresult
11
00
122 0 ▶ if ($terminal->{$action_state}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($terminal->{$action_state}) 0 0 0
123 0 $action->_resolve($event);
124 }
125 }
126 0 ▶ if ($action->completed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($action->completed) 0 0 0
127 0 delete $self->_actions->{$control_id};
128 }
129 }
130 }
131  
132 # Fire registered event callbacks
133 15 for my $cb (@{$self->_on_event}) {
134 4 eval { $cb->($self, $event) };
135 4 ▶ warn "Call event callback error: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 4 4
136 }
137 }
138  
139 # Register an event listener
140 4 ▶sub on {
Subroutine on: called CC=1 SCAR=0.0
Pod undocumented
141 4 my ($self, $cb) = @_;
142 4 push @{$self->_on_event}, $cb;
143 4 return $self;
144 }
145  
146 # Resolve all pending actions (e.g., on call ended or call-gone)
147 5 ▶sub _resolve_all_actions {
Subroutine _resolve_all_actions: called CC=3 SCAR=11.1
148 5 my ($self) = @_;
149 5 for my $action (values %{$self->_actions}) {
150 2 ▶ $action->_resolve(undef) unless $action->completed;
Branch: 1 branch
BranchTrueFalseTotal
unless $action->completed 2 0 2
151 }
152 5 $self->_actions({});
153 }
154  
155 # --- Simple fire-and-response methods ---
156  
157 0 ▶sub answer {
Subroutine answer: not called CC=1 SCAR=6.9
Pod undocumented
158 0 my ($self, %opts) = @_;
159 0 return $self->_execute('calling.answer', %opts);
160 }
161  
162 0 ▶sub hangup {
Subroutine hangup: not called CC=1 SCAR=6.9
Pod undocumented
163 0 my ($self, %opts) = @_;
164 0 return $self->_execute('calling.end', %opts);
165 }
166  
167 0 ▶sub pass {
Subroutine pass: not called CC=1 SCAR=6.9
Pod undocumented
168 0 my ($self) = @_;
169 0 return $self->_execute('calling.pass');
170 }
171  
172 0 ▶sub connect {
Subroutine connect: not called CC=1 SCAR=6.9
Pod undocumented
173 0 my ($self, %opts) = @_;
174 0 return $self->_execute('calling.connect', %opts);
175 }
176  
177 0 ▶sub disconnect {
Subroutine disconnect: not called CC=1 SCAR=6.9
Pod undocumented
178 0 my ($self) = @_;
179 0 return $self->_execute('calling.disconnect');
180 }
181  
182 0 ▶sub hold {
Subroutine hold: not called CC=1 SCAR=6.9
Pod undocumented
183 0 my ($self) = @_;
184 0 return $self->_execute('calling.hold');
185 }
186  
187 0 ▶sub unhold {
Subroutine unhold: not called CC=1 SCAR=6.9
Pod undocumented
188 0 my ($self) = @_;
189 0 return $self->_execute('calling.unhold');
190 }
191  
192 0 ▶sub denoise {
Subroutine denoise: not called CC=1 SCAR=6.9
Pod undocumented
193 0 my ($self) = @_;
194 0 return $self->_execute('calling.denoise');
195 }
196  
197 0 ▶sub denoise_stop {
Subroutine denoise_stop: not called CC=1 SCAR=6.9
Pod undocumented
198 0 my ($self) = @_;
199 0 return $self->_execute('calling.denoise.stop');
200 }
201  
202 0 ▶sub transfer {
Subroutine transfer: not called CC=1 SCAR=6.9
Pod undocumented
203 0 my ($self, %opts) = @_;
204 0 return $self->_execute('calling.transfer', %opts);
205 }
206  
207 0 ▶sub join_conference {
Subroutine join_conference: not called CC=1 SCAR=6.9
Pod undocumented
208 0 my ($self, %opts) = @_;
209 0 return $self->_execute('calling.join_conference', %opts);
210 }
211  
212 0 ▶sub leave_conference {
Subroutine leave_conference: not called CC=1 SCAR=6.9
Pod undocumented
213 0 my ($self, %opts) = @_;
214 0 return $self->_execute('calling.leave_conference', %opts);
215 }
216  
217 0 ▶sub echo {
Subroutine echo: not called CC=1 SCAR=6.9
Pod undocumented
218 0 my ($self, %opts) = @_;
219 0 return $self->_execute('calling.echo', %opts);
220 }
221  
222 0 ▶sub bind_digit {
Subroutine bind_digit: not called CC=1 SCAR=6.9
Pod undocumented
223 0 my ($self, %opts) = @_;
224 0 return $self->_execute('calling.bind_digit', %opts);
225 }
226  
227 0 ▶sub clear_digit_bindings {
Subroutine clear_digit_bindings: not called CC=1 SCAR=6.9
Pod undocumented
228 0 my ($self, %opts) = @_;
229 0 return $self->_execute('calling.clear_digit_bindings', %opts);
230 }
231  
232 0 ▶sub live_transcribe {
Subroutine live_transcribe: not called CC=1 SCAR=6.9
Pod undocumented
233 0 my ($self, %opts) = @_;
234 0 return $self->_execute('calling.live_transcribe', %opts);
235 }
236  
237 0 ▶sub live_translate {
Subroutine live_translate: not called CC=1 SCAR=6.9
Pod undocumented
238 0 my ($self, %opts) = @_;
239 0 return $self->_execute('calling.live_translate', %opts);
240 }
241  
242 0 ▶sub join_room {
Subroutine join_room: not called CC=1 SCAR=6.9
Pod undocumented
243 0 my ($self, %opts) = @_;
244 0 return $self->_execute('calling.join_room', %opts);
245 }
246  
247 0 ▶sub leave_room {
Subroutine leave_room: not called CC=1 SCAR=6.9
Pod undocumented
248 0 my ($self, %opts) = @_;
249 # Python parity: Call.leave_room(**kwargs). Forwards any caller-provided
250 # kwargs to the Relay leave_room dispatch (slurpy hash on the Perl side
251 # ≡ **kwargs on the Python side).
252 0 return $self->_execute('calling.leave_room', %opts);
253 }
254  
255 0 ▶sub amazon_bedrock {
Subroutine amazon_bedrock: not called CC=1 SCAR=6.9
Pod undocumented
256 0 my ($self, %opts) = @_;
257 0 return $self->_execute('calling.amazon_bedrock', %opts);
258 }
259  
260 0 ▶sub ai_message {
Subroutine ai_message: not called CC=1 SCAR=6.9
Pod undocumented
261 0 my ($self, %opts) = @_;
262 0 return $self->_execute('calling.ai_message', %opts);
263 }
264  
265 0 ▶sub ai_hold {
Subroutine ai_hold: not called CC=1 SCAR=6.9
Pod undocumented
266 0 my ($self, %opts) = @_;
267 0 return $self->_execute('calling.ai_hold', %opts);
268 }
269  
270 0 ▶sub ai_unhold {
Subroutine ai_unhold: not called CC=1 SCAR=6.9
Pod undocumented
271 0 my ($self, %opts) = @_;
272 0 return $self->_execute('calling.ai_unhold', %opts);
273 }
274  
275 0 ▶sub user_event {
Subroutine user_event: not called CC=1 SCAR=6.9
Pod undocumented
276 0 my ($self, %opts) = @_;
277 0 return $self->_execute('calling.user_event', %opts);
278 }
279  
280 0 ▶sub queue_enter {
Subroutine queue_enter: not called CC=1 SCAR=6.9
Pod undocumented
281 0 my ($self, %opts) = @_;
282 0 return $self->_execute('calling.queue.enter', %opts);
283 }
284  
285 0 ▶sub queue_leave {
Subroutine queue_leave: not called CC=1 SCAR=6.9
Pod undocumented
286 0 my ($self, %opts) = @_;
287 0 return $self->_execute('calling.queue.leave', %opts);
288 }
289  
290 0 ▶sub refer {
Subroutine refer: not called CC=1 SCAR=6.9
Pod undocumented
291 0 my ($self, %opts) = @_;
292 0 return $self->_execute('calling.refer', %opts);
293 }
294  
295 0 ▶sub send_digits {
Subroutine send_digits: not called CC=1 SCAR=6.9
Pod undocumented
296 0 my ($self, %opts) = @_;
297 0 return $self->_execute('calling.send_digits', %opts);
298 }
299  
300 # --- Action-based methods (control_id tracking) ---
301  
302 0 ▶sub play {
Subroutine play: not called CC=1 SCAR=6.9
Pod undocumented
303 0 my ($self, %opts) = @_;
304 0 return $self->_start_action('calling.play', 'SignalWire::Relay::Action::Play', %opts);
305 }
306  
307 0 ▶sub record {
Subroutine record: not called CC=1 SCAR=6.9
Pod undocumented
308 0 my ($self, %opts) = @_;
309 0 return $self->_start_action('calling.record', 'SignalWire::Relay::Action::Record', %opts);
310 }
311  
312 0 ▶sub detect {
Subroutine detect: not called CC=1 SCAR=6.9
Pod undocumented
313 0 my ($self, %opts) = @_;
314 0 return $self->_start_action('calling.detect', 'SignalWire::Relay::Action::Detect', %opts);
315 }
316  
317 0 ▶sub collect {
Subroutine collect: not called CC=1 SCAR=6.9
Pod undocumented
318 0 my ($self, %opts) = @_;
319 0 return $self->_start_action('calling.collect', 'SignalWire::Relay::Action::StandaloneCollect', %opts);
320 }
321  
322 0 ▶sub play_and_collect {
Subroutine play_and_collect: not called CC=1 SCAR=6.9
Pod undocumented
323 0 my ($self, %opts) = @_;
324 0 return $self->_start_action('calling.play_and_collect', 'SignalWire::Relay::Action::Collect', %opts);
325 }
326  
327 0 ▶sub send_fax {
Subroutine send_fax: not called CC=1 SCAR=6.9
Pod undocumented
328 0 my ($self, %opts) = @_;
329 0 my $action = $self->_start_action('calling.send_fax', 'SignalWire::Relay::Action::Fax', %opts);
330 0 return $action;
331 }
332  
333 0 ▶sub receive_fax {
Subroutine receive_fax: not called CC=5 SCAR=34.0
Pod undocumented
334 0 my ($self, %opts) = @_;
335 0 my $control_id = _generate_uuid();
336 0 my %params = ($self->_base_params, control_id => $control_id, %opts);
337  
338 0 my $action = SignalWire::Relay::Action::Fax->new(
339 control_id => $control_id,
340 call_id => $self->call_id,
341 node_id => $self->node_id,
342 _client => $self->_client,
343 _fax_type => 'receive',
344 );
345 0 $self->_actions->{$control_id} = $action;
346  
347 0 my $client = $self->_client;
348 0 ▶ if ($client) {
Branch: 1 branch
BranchTrueFalseTotal
if ($client) 0 0 0
349 0 my $result = $client->execute('calling.receive_fax', \%params);
350 0 ▶ if (ref $result eq 'HASH' && $result->{code} && $result->{code} =~ /^(404|410)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $result eq "HASH" and $result->{"code"} and $result->{"code"} =~ /^(404|410)$/) 0 0 0
Condition0%0/6
ref $result eq "HASH" and $result->{"code"} and $result->{"code"} =~ /^(404|410)$/
!ll&&!rl&&r
000
ref $result eq "HASH" and $result->{"code"}
!ll&&!rl&&r
000
MC/DC0%0/3
ref $result eq "HASH" and $result->{"code"} and $result->{"code"} =~ /^(404|410)$/
ref $result eq "HASH" $result->{"code"} $result->{"code"} =~ /^(404|410)$/
Truth table0%0/4
A and B and C
A= ref $result eq "HASH"B= $result->{"code"}C= $result->{"code"} =~ /^(404|410)$/
ABCresult
0XX0
10X0
1100
1111
351 0 $action->_resolve(undef);
352 }
353 }
354  
355 0 return $action;
356 }
357  
358 0 ▶sub tap {
Subroutine tap: not called CC=1 SCAR=6.9
Pod undocumented
359 0 my ($self, %opts) = @_;
360 0 return $self->_start_action('calling.tap', 'SignalWire::Relay::Action::Tap', %opts);
361 }
362  
363 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
Pod undocumented
364 0 my ($self, %opts) = @_;
365 0 return $self->_start_action('calling.stream', 'SignalWire::Relay::Action::Stream', %opts);
366 }
367  
368 0 ▶sub pay {
Subroutine pay: not called CC=1 SCAR=6.9
Pod undocumented
369 0 my ($self, %opts) = @_;
370 0 return $self->_start_action('calling.pay', 'SignalWire::Relay::Action::Pay', %opts);
371 }
372  
373 0 ▶sub transcribe {
Subroutine transcribe: not called CC=1 SCAR=6.9
Pod undocumented
374 0 my ($self, %opts) = @_;
375 0 return $self->_start_action('calling.transcribe', 'SignalWire::Relay::Action::Transcribe', %opts);
376 }
377  
378 0 ▶sub ai {
Subroutine ai: not called CC=1 SCAR=6.9
Pod undocumented
379 0 my ($self, %opts) = @_;
380 0 return $self->_start_action('calling.ai', 'SignalWire::Relay::Action::AI', %opts);
381 }
382  
383 4 1;
« bin/swaig-test ↑ Summary blib/lib/SignalWire/Skills/Builtin/WikipediaSearch.pm »