line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Google::Voice::Call; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Mojo::Base -base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->attr([qw/ from to rnr_se ua /]); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
0
|
|
|
0
|
1
|
|
my $self = bless {}, shift; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
$self->from(shift); |
14
|
0
|
|
|
|
|
|
$self->to(shift); |
15
|
0
|
|
|
|
|
|
$self->rnr_se(shift); |
16
|
0
|
|
|
|
|
|
$self->ua(shift); |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub cancel { |
22
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
23
|
0
|
|
|
|
|
|
my ($from, $to) = @_; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $json = $self->ua->post( |
26
|
|
|
|
|
|
|
'https://www.google.com/voice/call/cancel/' => form => { |
27
|
|
|
|
|
|
|
forwardingNumber => undef, |
28
|
|
|
|
|
|
|
outgoingNumber => undef, |
29
|
|
|
|
|
|
|
cancelType => 'C2C', |
30
|
|
|
|
|
|
|
_rnr_se => $self->rnr_se |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
)->res->json; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
0
|
|
|
|
$@ = $json->{data}->{code} and return unless $json->{ok}; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return $json->{ok}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Google::Voice::Call |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 DESCRIPTION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Object representing active phone call |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 from |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Calling from phone number |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 to |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Calling to phone number |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 METHODS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 new |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 cancel |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Cancel connected phone call |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |