V3/Session/Telephony.pm

filter: Statementstmt 45.7% 32 / 70 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 6 / 8 Podpod 100% 1 / 1 totaltotal 39.0% 39 / 100 CC 11 SCAR 44.0
CC
11
Cov
36%
_get_results
132.0
update
2.0
BEGIN
1.0
CRAP 81.1
↑ Summary V3/Session.pm »
1 package Bb::Collaborate::V3::Session::Telephony;
2 6 ▶use warnings; use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 6 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 extends 'Bb::Collaborate::V3';
7  
8 6 ▶use Scalar::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 6 ▶use Elive::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 =head1 NAME
14  
15 Bb::Collaborate::V3::Session::Telephony - Session Telephony instance class
16  
17 =head1 DESCRIPTION
18  
19 This class is used to setup telephony information for an existing session
20  
21 =cut
22  
23 6 __PACKAGE__->entity_name('Telephony');
24  
25 =head1 PROPERTIES
26  
27 =head2 sessionId (Int)
28  
29 The identifier of the session.
30  
31 =cut
32  
33 6 has 'sessionId' => (is => 'rw', isa => 'Int', required => 1);
34 6 __PACKAGE__->_isa('Session');
35 6 __PACKAGE__->primary_key('sessionId');
36  
37 =head2 telephonyType (Str)
38  
39 The type of telephony to configure.
40  
41 =over 4
42  
43 =item thirdParty - You are using your own teleconference provider. You
44 must manually configure the teleconference connection information.
45  
46 =item integrated - The teleconference service is provided by
47 Blackboard Collaborate. Teleconference phone numbers and PINs are
48 automatically generated during session creation and anyone in the
49 session can initiate the connection between the session and the
50 teleconference by simply dialing in to the teleconference.
51  
52 =item none - Telephony is disabled for this session.
53  
54 =back
55  
56 =cut
57  
58 6 has 'telephonyType' => (is => 'rw', isa => 'Str',
59 documentation => 'The type of telephony to configure.',
60 );
61  
62 =head2 chairPhone (Str)
63  
64 The phone number for the session chair (also known as a session moderator) when the session is running.
65  
66 =cut
67  
68 6 has 'chairPhone' => (is => 'rw', isa => 'Str',
69 documentation => 'The phone number for the session chair'
70 );
71  
72 =head2 chairPIN (Str)
73  
74 The PIN for the chairPhone.
75  
76 =cut
77  
78 6 has 'chairPIN' => (is => 'rw', isa => 'Str',
79 documentation => 'The PIN for the chairPhone'
80 );
81  
82 =head2 nonChairPhone (Str)
83  
84 The phone number used by the session non-chair users (also known as a session participants). The information is for display purposes only in the session (so participants know what telephone number and PIN to use to connect to the teleconference).
85  
86 =cut
87  
88 6 has 'nonChairPhone' => (is => 'rw', isa => 'Str',
89 documentation => 'The phone number for the non-chair participants'
90 );
91  
92 =head2 nonChairPIN (Str)
93  
94 The PIN for the nonChairPhone.
95  
96 =cut
97  
98 6 has 'nonChairPIN' => (is => 'rw', isa => 'Str',
99 documentation => 'The PIN for the nonChairPhone participants'
100 );
101  
102 =head2 isPhone (Bool)
103  
104 Used to indicate if the C<sessionSIPPhone> field should be validated as a Session Initiation Protocol (SIP) or phone number.
105  
106 =cut
107  
108 6 has 'isPhone' => (is => 'rw', isa => 'Bool',
109 documentation => 'true if a simple phone, false if also using Session Initiation Protocol (SIP)?',
110 );
111  
112  
113 =head2 sessionSIPPhone (Str)
114  
115 The Session Initiation Protocol (SIP) or phone number used by the session. Sometimes referred to as the session bridge or teleconference bridge.
116 For accepted phone number and SIP formats, see Notes About Session Telephony Validation on page 67.
117  
118 =cut
119  
120 6 has 'sessionSIPPhone' => (is => 'rw', isa => 'Str',
121 documentation => 'The phone number used by SIP participants'
122 );
123  
124 =head2 sessionPIN (Str)
125  
126 The PIN for the C<sessionSIPPhone>.
127  
128 =cut
129  
130 6 has 'sessionPIN' => (is => 'rw', isa => 'Str',
131 documentation => 'The PIN number for SIP participants',
132 );
133  
134  
135 =head1 METHODS
136  
137 =cut
138  
139 =head2 update
140  
141 my $session_telephony = $session->telephony;
142  
143 my %telephony_data = (
144 chairPhone => '(03) 5999 1234',
145 chairPIN => '6342',
146 nonChairPhone => '(03) 5999 2234',
147 nonChairPIN => '7722',
148 isPhone => '1',
149 sessionSIPPhone => '(03) 6999 2222',
150 sessionPIN => '1234',
151 );
152  
153 $session_telephony->update(\%telephony_data);
154  
155 Updates a session's telephony characteristics.
156  
157 =cut
158  
159 # custom unpacker for GetTelephonyResponse
160  
161 0 ▶sub _get_results {
Subroutine _get_results: not called CC=11 SCAR=48.8
162 0 my $class = shift;
163 0 my $som = shift;
164 0 my $connection = shift;
165  
166 0 $connection->_check_for_errors($som);
167  
168 0 ▶ my $resp = $som->body->{GetTelephonyResponse} || $som->body->{SetTelephonyResponse};
Condition0%0/3
$som->body->{'GetTelephonyResponse'} || $som->body->{'SetTelephonyResponse'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$som->body->{'GetTelephonyResponse'} || $som->body->{'SetTelephonyResponse'}
$som->body->{'GetTelephonyResponse'} $som->body->{'SetTelephonyResponse'}
Truth table0%0/3
A || B
A= $som->body->{'GetTelephonyResponse'}B= $som->body->{'SetTelephonyResponse'}
ABresult
1X1
011
000
169  
170 0 ▶ if ($resp) {
Branch: 1 branch
BranchTrueFalseTotal
if ($resp) 0 0 0
171  
172 0 my %rec = %{ $resp };
173 0 my $items = delete $rec{TelephonyResponseItem};
174 0 my $is_phone = 0;
175  
176 0 ▶ if ($items) {
Branch: 1 branch
BranchTrueFalseTotal
if ($items) 0 0 0
177 0 my $types = {moderator => 'chair', participant => 'nonChair', serverSIP => 'session', serverPhone => 'session'};
178  
179 0 for (@$items) {
180 0 my %item = %$_;
181 0 ▶ $is_phone = 1 if $item{itemType} eq 'serverPhone';
Branch: 1 branch
BranchTrueFalseTotal
if $item{"itemType"} eq "serverPhone" 0 0 0
182  
183 0 my $type = $types->{ delete $item{itemType} };
184 0 ▶ unless ($type) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($type) 0 0 0
185 0 require YAML::Syck; my $item_yaml = YAML::Syck::Dump($_);
186 0 warn "skipping telephony item: $item_yaml";
187 0 next;
188 }
189  
190 0 ▶ $rec{$type . 'PIN'} = delete $item{pin} if $item{pin};
Branch: 1 branch
BranchTrueFalseTotal
if $item{"pin"} 0 0 0
191 0 ▶ $type .= 'SIP' if $type eq 'session';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "session" 0 0 0
192 0 ▶ $rec{$type . 'Phone'} = delete $item{uri} if $item{uri};
Branch: 1 branch
BranchTrueFalseTotal
if $item{"uri"} 0 0 0
193  
194 0 ▶ if (%item) {
Branch: 1 branch
BranchTrueFalseTotal
if (%item) 0 0 0
195 0 require YAML::Syck; my $item_yaml = YAML::Syck::Dump(\%item);
196 0 warn "unprocessed telephony item data: $item_yaml";
197 }
198 }
199 }
200  
201 0 $rec{isPhone} = $is_phone;
202  
203 0 return [ \%rec ]
204 }
205  
206 0 warn "problems unpacking Telephony response";
207 0 return $class->SUPER::_get_results( $som, $connection );
208 }
209  
210 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
Pod documented
211 0 my $self = shift;
212 0 my $updates = shift;
213 0 my %opt = @_;
214  
215 # include the entire record
216 0 my @properties = grep { defined $self->$_ } ($self->properties);
217  
218 0 return $self->SUPER::update($updates, %opt, changed => \@properties);
219 }
220  
221 6 1;
↑ Summary V3/Session.pm »