line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Asterisk::Store::Queue::Member; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
41781
|
use 5.008008; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
39
|
|
6
|
1
|
|
|
1
|
|
1258
|
use attributes; |
|
1
|
|
|
|
|
1323
|
|
|
1
|
|
|
|
|
4
|
|
7
|
1
|
|
|
1
|
|
1293
|
use Log::Log4perl qw( get_logger :levels ); |
|
1
|
|
|
|
|
59675
|
|
|
1
|
|
|
|
|
8
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
15
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
16
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# This allows declaration use Asterisk::Store::Queue::Member ':all'; |
19
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
20
|
|
|
|
|
|
|
# will save memory. |
21
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
) ] ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our @EXPORT = qw( |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# global varibles |
34
|
1
|
|
|
1
|
|
184
|
use vars qw( @global_entries $connection ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
653
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# logger setup |
37
|
|
|
|
|
|
|
my $root_logger = get_logger("Asterisk"); |
38
|
|
|
|
|
|
|
my $base_logger = get_logger("Asterisk::Store::Queue::Member"); |
39
|
|
|
|
|
|
|
$base_logger->level($WARN); |
40
|
|
|
|
|
|
|
$root_logger->level($ERROR); |
41
|
|
|
|
|
|
|
my $layout = Log::Log4perl::Layout::PatternLayout->new( |
42
|
|
|
|
|
|
|
"%d{ISO8601} %p %c %F:%-4L -- %m%n" |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
my $file_appender = Log::Log4perl::Appender->new( |
45
|
|
|
|
|
|
|
"Log::Dispatch::File", |
46
|
|
|
|
|
|
|
filename => "log/member.log", |
47
|
|
|
|
|
|
|
mode => "append", |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
my $screen_appender = Log::Log4perl::Appender->new( |
50
|
|
|
|
|
|
|
"Log::Dispatch::Screen", |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
$screen_appender->threshold($ERROR); |
53
|
|
|
|
|
|
|
$file_appender->layout($layout); |
54
|
|
|
|
|
|
|
$screen_appender->layout($layout); |
55
|
|
|
|
|
|
|
$base_logger->add_appender($file_appender); |
56
|
|
|
|
|
|
|
$root_logger->add_appender($screen_appender); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Asterisk::Store::Queue::Member - Class for Asterisk queue member objects |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SYNOPSIS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
use Asterisk::Store::Queue::Member; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $memberobj = new Asterisk::Store::Queue::Member ( |
68
|
|
|
|
|
|
|
queue => 'mainqueue', |
69
|
|
|
|
|
|
|
location => 'Local/42342@queueagents', |
70
|
|
|
|
|
|
|
membership => 'dynamic', |
71
|
|
|
|
|
|
|
penalty => 0, |
72
|
|
|
|
|
|
|
callstaken => 0, |
73
|
|
|
|
|
|
|
paused => 0, |
74
|
|
|
|
|
|
|
status => 0, |
75
|
|
|
|
|
|
|
lastcall => 0, |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
... |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 DESCRIPTION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This module is used to store queue member objects such as those returned |
83
|
|
|
|
|
|
|
from the Asterisk Manager Interface API. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# constructor method |
88
|
|
|
|
|
|
|
sub new { |
89
|
1
|
|
|
1
|
0
|
16
|
my $invoker = shift; |
90
|
1
|
|
33
|
|
|
9
|
my $class = ref($invoker) || $invoker; |
91
|
1
|
|
|
|
|
18
|
my $self = { |
92
|
|
|
|
|
|
|
# attributes go here |
93
|
|
|
|
|
|
|
queue => 'mainqueue', |
94
|
|
|
|
|
|
|
location => 'Local/42342@queueagents', |
95
|
|
|
|
|
|
|
membership => 'dynamic', |
96
|
|
|
|
|
|
|
penalty => 0, |
97
|
|
|
|
|
|
|
callstaken => 0, |
98
|
|
|
|
|
|
|
paused => 0, |
99
|
|
|
|
|
|
|
status => 0, |
100
|
|
|
|
|
|
|
lastcall => 0, |
101
|
|
|
|
|
|
|
DEBUG => 0, |
102
|
|
|
|
|
|
|
@_, # override attributes |
103
|
|
|
|
|
|
|
}; |
104
|
1
|
|
|
|
|
3
|
bless $self, $class; |
105
|
1
|
50
|
|
|
|
12
|
if ($self->{'DEBUG'}) { |
106
|
0
|
|
|
|
|
0
|
$base_logger->level($DEBUG); |
107
|
|
|
|
|
|
|
}; |
108
|
1
|
|
|
|
|
9
|
$base_logger->debug("creating Asterisk::Store::Queue::Member object"); |
109
|
1
|
|
|
|
|
23
|
return $self; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Base attrubutes, can be extended |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 queue |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Which queue is this member a member of? |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
sub queue { |
122
|
1
|
|
|
1
|
1
|
829
|
my $self = shift; |
123
|
1
|
50
|
|
|
|
6
|
if (@_) { |
124
|
0
|
|
|
|
|
0
|
$self->{'queue'}= shift; |
125
|
|
|
|
|
|
|
} |
126
|
1
|
|
|
|
|
4
|
return $self->{'queue'}; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 location |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Where is this agent (member) located? |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
134
|
|
|
|
|
|
|
sub location { |
135
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
136
|
1
|
50
|
|
|
|
4
|
if (@_) { |
137
|
0
|
|
|
|
|
0
|
$self->{'location'}= shift; |
138
|
|
|
|
|
|
|
} |
139
|
1
|
|
|
|
|
4
|
return $self->{'location'}; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 membership |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Type of membership (dynamic, etc...) |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
147
|
|
|
|
|
|
|
sub membership { |
148
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
149
|
1
|
50
|
|
|
|
5
|
if (@_) { |
150
|
0
|
|
|
|
|
0
|
$self->{'membership'}= shift; |
151
|
|
|
|
|
|
|
} |
152
|
1
|
|
|
|
|
3
|
return $self->{'membership'}; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 penalty |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Queue penalty assigned to member |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
sub penalty { |
161
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
162
|
1
|
50
|
|
|
|
5
|
if (@_) { |
163
|
0
|
|
|
|
|
0
|
$self->{'penalty'}= shift; |
164
|
|
|
|
|
|
|
} |
165
|
1
|
|
|
|
|
4
|
return $self->{'penalty'}; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 callstaken |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Number of calls that the member has handled |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
173
|
|
|
|
|
|
|
sub callstaken { |
174
|
3
|
|
|
3
|
1
|
3854
|
my $self = shift; |
175
|
3
|
100
|
|
|
|
11
|
if (@_) { |
176
|
1
|
|
|
|
|
4
|
$self->{'callstaken'}= shift; |
177
|
|
|
|
|
|
|
} |
178
|
3
|
|
|
|
|
8
|
return $self->{'callstaken'}; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 paused |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Member pause status *bool* |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |
186
|
|
|
|
|
|
|
sub paused { |
187
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
188
|
1
|
50
|
|
|
|
5
|
if (@_) { |
189
|
0
|
|
|
|
|
0
|
$self->{'paused'}= shift; |
190
|
|
|
|
|
|
|
} |
191
|
1
|
|
|
|
|
3
|
return $self->{'paused'}; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head2 status |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Member status |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |
199
|
|
|
|
|
|
|
sub status { |
200
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
201
|
1
|
50
|
|
|
|
6
|
if (@_) { |
202
|
0
|
|
|
|
|
0
|
$self->{'status'}= shift; |
203
|
|
|
|
|
|
|
} |
204
|
1
|
|
|
|
|
3
|
return $self->{'status'}; |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head2 lastcall |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Last call information |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=cut |
212
|
|
|
|
|
|
|
sub lastcall { |
213
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
214
|
1
|
50
|
|
|
|
5
|
if (@_) { |
215
|
0
|
|
|
|
|
0
|
$self->{'lastcall'}= shift; |
216
|
|
|
|
|
|
|
} |
217
|
1
|
|
|
|
|
5
|
return $self->{'lastcall'}; |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=head2 DEBUG *bool* |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
Enable debugging by setting bool to true. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=cut |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub DEBUG { |
227
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
228
|
0
|
0
|
|
|
|
|
if (@_) { |
229
|
0
|
|
|
|
|
|
$self->{'DEBUG'}= shift; |
230
|
|
|
|
|
|
|
} |
231
|
0
|
0
|
|
|
|
|
if ($self->{'DEBUG'}) { |
232
|
0
|
|
|
|
|
|
$base_logger->level($DEBUG); |
233
|
|
|
|
|
|
|
}; |
234
|
0
|
|
|
|
|
|
return $self->{'DEBUG'}; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head1 PUBLIC METHODS |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
These are the publicly accesable methods |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=cut |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head1 PRIVATE METHODS |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
These methods should not be accessed directly. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=cut |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=head1 SEE ALSO |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
To be used with: |
253
|
|
|
|
|
|
|
L |
254
|
|
|
|
|
|
|
L |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head1 AUTHOR |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Derek Carter, Egoozbach@neverblock.com |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
Copyright (C) 2007 by Derek Carter |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
265
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
266
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=cut |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
1; |