Branch Coverage

blib/lib/SignalWire/Agents/Relay/Client.pm
Criterion Covered Total %
branch 42 122 34.4


line true false branch
103 0 0 unless ($socket)
140 0 0 if $ws->{'hs'}->is_done
162 0 0 if (@{$self->contexts;})
167 0 0 if ($self->protocol)
172 0 0 if ($self->authorization_state)
178 0 0 if (ref $result eq "HASH")
179 0 0 if $result->{'protocol'}
180 0 0 if $result->{'session_id'}
195 0 0 if ($method ne "signalwire.connect" and $self->protocol)
226 0 0 if ($error)
240 0 0 if exists $opts{$key}
245 0 0 if (ref $result eq "HASH" and $result->{'message_id'})
259 0 0 if ($opts{'on_completed'})
290 0 0 if $opts{'devices'}
291 0 0 if $opts{'region'}
292 0 0 if exists $opts{'max_price_per_minute'}
305 0 0 if ($@)
318 0 0 if ($dial_error)
322 0 0 if ($call and $on_completed)
325 0 0 if ($event->event_type eq "calling.call.state" and $event->call_state eq "ended")
327 0 0 if $@
342 0 0 if ($ws)
352 0 0 unless $socket
357 0 0 if (select $ready, undef, undef, "0.1")
359 0 0 if ($bytes and $bytes > 0) { }
0 0 elsif (not defined $bytes or $bytes == 0) { }
376 0 4 if ($@)
382 2 2 if (exists $msg->{'result'} or exists $msg->{'error'})
384 2 0 if (my $pending = delete $self->_pending->{$id})
385 1 1 if (exists $msg->{'error'}) { }
397 1 1 if ($method eq 'signalwire.event') { }
1 0 elsif ($method eq 'signalwire.ping') { }
0 0 elsif ($method eq 'signalwire.disconnect') { }
433 0 18 if (my $cb = $self->_on_event)
435 0 0 if $@
439 1 17 if ($event_type eq "signalwire.authorization.state")
445 1 16 if ($event_type eq "calling.call.receive")
451 2 14 if ($event_type eq "messaging.receive")
457 4 10 if ($event_type eq "messaging.state")
459 4 0 if (my $msg = $self->_messages->{$message_id})
461 2 2 if ($msg->completed)
469 5 5 if ($event_type eq "calling.call.dial")
478 2 0 if ($event_type eq "calling.call.state" and $tag and exists $self->_pending_dials->{$tag})
479 2 0 if (not exists $self->_calls->{$call_id} and $call_id)
493 4 1 if ($call_id and my $call = $self->_calls->{$call_id})
497 1 3 if ($call->state eq "ended")
508 0 1 unless $call_id
521 1 0 if (my $cb = $self->_on_call)
523 0 1 if $@
532 2 0 if (my $cb = $self->_on_message)
534 0 2 if $@
547 1 4 unless $pending
549 2 2 if ($dial_state eq 'answered') { }
2 0 elsif ($dial_state eq 'failed') { }
552 0 2 unless ($call)
579 1 1 if ($restart)
597 0 0 if $p
603 0 0 if $p
609 0 0 if $delay > $self->_max_backoff
616 0 0 if ($self->connect_ws)
628 0 0 if ($self->_socket)