line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package UTM5::URFAClient; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
26677
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
UTM5::URFAClient - Perl wrapper for Netup URFA Client |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Using with L<UTM5::URFAClient::Daemon> |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Version 0.54 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.54'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use UTM5::URFAClient; |
25
|
|
|
|
|
|
|
my $client = new UTM5::URFAClient({ |
26
|
|
|
|
|
|
|
url => 'http://example.com/', |
27
|
|
|
|
|
|
|
}); |
28
|
|
|
|
|
|
|
print $client->whoami->{login}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
|
435
|
use Frontier::Client; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
use XML::Twig; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use Carp; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
our $SERVICE_TYPES = { |
42
|
|
|
|
|
|
|
1 => 'Once service', |
43
|
|
|
|
|
|
|
2 => 'Periodic service', |
44
|
|
|
|
|
|
|
3 => 'IP-traffic service', |
45
|
|
|
|
|
|
|
4 => 'Hotspot service', |
46
|
|
|
|
|
|
|
5 => 'Dial-up service', |
47
|
|
|
|
|
|
|
6 => 'Telephony service' |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 new |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Creates connection |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
UTM5::URFAClient->new({<options>}) |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item * url |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Remote host and port with UTM5::URFAClient::Daemon daemon |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=back |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub new { |
69
|
|
|
|
|
|
|
my ($class, $self) = @_; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
bless $self, $class; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
if(not $self->{url}) { |
75
|
|
|
|
|
|
|
croak "Daemon URL not specified"; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$self->{_server} = Frontier::Client->new(url => $self->{url}); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
return $self; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub _parse_array { |
85
|
|
|
|
|
|
|
my ($data, $t, $array) = @_; |
86
|
|
|
|
|
|
|
my $name = $array->prev_sibling('integer')->att('name'); |
87
|
|
|
|
|
|
|
$data->{$name} = []; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
foreach my $item ($array->children('item')) { |
90
|
|
|
|
|
|
|
my $item_data = {}; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
foreach my $child ($item->children) { |
93
|
|
|
|
|
|
|
if($child->tag eq 'array') { |
94
|
|
|
|
|
|
|
_parse_array($item_data, $child, $child); |
95
|
|
|
|
|
|
|
} else { |
96
|
|
|
|
|
|
|
_parse_field($item_data, $child, 1); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
push @{$data->{$name}}, $item_data; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub _parse_field { |
106
|
|
|
|
|
|
|
my ($data, $element, $isArray) = @_; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
if($element->parent->tag ne 'item' || $isArray) { |
109
|
|
|
|
|
|
|
$data->{$element->att('name')} = $element->att('value'); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub _parse { |
115
|
|
|
|
|
|
|
my ($self, $data2, $data) = @_; |
116
|
|
|
|
|
|
|
my $result = {}; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
if(not $data =~ /^\<\?xml/) { |
119
|
|
|
|
|
|
|
$data = '<?xml version="1.0" encoding="utf-8"?>' . $data; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
my $t = XML::Twig->new(twig_handlers => { |
123
|
|
|
|
|
|
|
'integer' => sub { _parse_field($result, $_) }, |
124
|
|
|
|
|
|
|
'long' => sub { _parse_field($result, $_) }, |
125
|
|
|
|
|
|
|
'double' => sub { _parse_field($result, $_) }, |
126
|
|
|
|
|
|
|
'string' => sub { _parse_field($result, $_) }, |
127
|
|
|
|
|
|
|
'ip_address' => sub { _parse_field($result, $_) }, |
128
|
|
|
|
|
|
|
'array' => sub { _parse_array($result, @_) }, |
129
|
|
|
|
|
|
|
})->parse($data); |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
return $result; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub _exec { |
135
|
|
|
|
|
|
|
my ($self, $cmd, $params, $data) = @_; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
my $call = $self->{_server}->call('query', $cmd, $params, $data); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
my $result = $call; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
if($result =~ /\<urfa\>/) { |
146
|
|
|
|
|
|
|
$result = $self->_parse($self, $call); |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
return $result; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 whoami |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Returns current user info |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub whoami { |
161
|
|
|
|
|
|
|
my ($self, $params) = @_; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
return $self->_exec('rpcf_whoami'); |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 user_list |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Returns user list |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub users_list { |
175
|
|
|
|
|
|
|
my ($self, $params) = @_; |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
$params->{from} ||= 0; |
178
|
|
|
|
|
|
|
$params->{to} ||= 999999999; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
return $self->_exec('rpcf_get_users_list', $params); |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 user_search |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Returns user list by criteria |
187
|
|
|
|
|
|
|
Not implemented in this version |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub user_search { |
192
|
|
|
|
|
|
|
my ($self, $params) = @_; |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
my $criteria_id = { |
195
|
|
|
|
|
|
|
'LIKE' => 1, |
196
|
|
|
|
|
|
|
'=' => 3, |
197
|
|
|
|
|
|
|
'<>' => 4, |
198
|
|
|
|
|
|
|
'>' => 7, |
199
|
|
|
|
|
|
|
'<' => 8, |
200
|
|
|
|
|
|
|
'>=' => 9, |
201
|
|
|
|
|
|
|
'<=' => 10, |
202
|
|
|
|
|
|
|
'NOT LIKE' => 11 |
203
|
|
|
|
|
|
|
}; |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
my $what_id = { |
206
|
|
|
|
|
|
|
'User ID' => 1, |
207
|
|
|
|
|
|
|
'User login' => 2, |
208
|
|
|
|
|
|
|
'Basic account' => 3, |
209
|
|
|
|
|
|
|
'Accounting perion id' => 4, |
210
|
|
|
|
|
|
|
'Full name' => 5, |
211
|
|
|
|
|
|
|
'Create date' => 6, |
212
|
|
|
|
|
|
|
'Last change date' => 7, |
213
|
|
|
|
|
|
|
'Who create' => 8, |
214
|
|
|
|
|
|
|
'who change' => 9, |
215
|
|
|
|
|
|
|
'Is legal' => 10, |
216
|
|
|
|
|
|
|
'Juridical address' => 11, |
217
|
|
|
|
|
|
|
'Actual address' => 12, |
218
|
|
|
|
|
|
|
'Work phone' => 13, |
219
|
|
|
|
|
|
|
'Home phone' => 14, |
220
|
|
|
|
|
|
|
'Mobile phone' => 15, |
221
|
|
|
|
|
|
|
'Web page' => 16, |
222
|
|
|
|
|
|
|
'ICQ number' => 17, |
223
|
|
|
|
|
|
|
'Tax number' => 18, |
224
|
|
|
|
|
|
|
'KPP number' => 19, |
225
|
|
|
|
|
|
|
'House id' => 21, |
226
|
|
|
|
|
|
|
'Flat number' => 22, |
227
|
|
|
|
|
|
|
'Entrance' => 23, |
228
|
|
|
|
|
|
|
'Floor' => 24, |
229
|
|
|
|
|
|
|
'Email' => 25, |
230
|
|
|
|
|
|
|
'Passport' => 26, |
231
|
|
|
|
|
|
|
'IP' => 28, |
232
|
|
|
|
|
|
|
'Group ID' => 30, |
233
|
|
|
|
|
|
|
'Balance' => 31, |
234
|
|
|
|
|
|
|
'Personal manager' => 32, |
235
|
|
|
|
|
|
|
'Connect date' => 33, |
236
|
|
|
|
|
|
|
'Comments' => 34, |
237
|
|
|
|
|
|
|
'Internet status' => 35, |
238
|
|
|
|
|
|
|
'Tariff ID' => 36, |
239
|
|
|
|
|
|
|
'Service ID' => 37, |
240
|
|
|
|
|
|
|
'Slink ID' => 38, |
241
|
|
|
|
|
|
|
'TPLink ID' => 39, |
242
|
|
|
|
|
|
|
'District' => 40, |
243
|
|
|
|
|
|
|
'Building' => 41, |
244
|
|
|
|
|
|
|
'MAC' => 42, |
245
|
|
|
|
|
|
|
'Login in service link' => 43, |
246
|
|
|
|
|
|
|
'External ID' => 44 |
247
|
|
|
|
|
|
|
}; |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head2 get_user_groups |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
Return users groups array |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=cut |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub get_user_groups { |
259
|
|
|
|
|
|
|
my ($self, $params) = @_; |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
return $self->_exec('rpcf_get_groups_list', { user_id => $params->{user_id} }); |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=head2 get_houses_list |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
Return houses list |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=cut |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub get_houses_list { |
275
|
|
|
|
|
|
|
my ($self, $params) = @_; |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
return $self->_exec('rpcf_get_houses_list'); |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=head2 get_house |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
Return house data |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=cut |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
sub get_house { |
288
|
|
|
|
|
|
|
my ($self, $params) = @_; |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
return {} if not int($params->{house_id}); |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
return $self->_exec('rpcf_get_house', { house_id => $params->{house_id} }); |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
=head2 add_house |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
Add new house |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=cut |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
sub add_house { |
303
|
|
|
|
|
|
|
my ($self, $params) = @_; |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
return {} if not ($params->{country} && |
306
|
|
|
|
|
|
|
$params->{city} && |
307
|
|
|
|
|
|
|
$params->{street} && |
308
|
|
|
|
|
|
|
$params->{number} |
309
|
|
|
|
|
|
|
); |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
return $self->_exec('rpcf_add_house', { |
312
|
|
|
|
|
|
|
house_id => 0, |
313
|
|
|
|
|
|
|
connect_date => time, |
314
|
|
|
|
|
|
|
post_code => ($params->{post_code} ? $params->{post_code} : ''), |
315
|
|
|
|
|
|
|
country => $params->{country}, |
316
|
|
|
|
|
|
|
region => ($params->{region} ? $params->{region} : ''), |
317
|
|
|
|
|
|
|
city => $params->{city}, |
318
|
|
|
|
|
|
|
street => $params->{street}, |
319
|
|
|
|
|
|
|
number => $params->{number}, |
320
|
|
|
|
|
|
|
building => ($params->{building} ? $params->{building} : '') |
321
|
|
|
|
|
|
|
}); |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
=head2 edit_house |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
Edit house |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=cut |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
sub edit_house { |
332
|
|
|
|
|
|
|
my ($self, $params) = @_; |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
return {} if not (defined($params->{house_id}) && |
335
|
|
|
|
|
|
|
defined($params->{country}) && |
336
|
|
|
|
|
|
|
defined($params->{city}) && |
337
|
|
|
|
|
|
|
defined($params->{street}) && |
338
|
|
|
|
|
|
|
defined($params->{number}) |
339
|
|
|
|
|
|
|
); |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
return $self->_exec('rpcf_add_house', { |
342
|
|
|
|
|
|
|
house_id => $params->{house_id}, |
343
|
|
|
|
|
|
|
connect_date => ($params->{connect_date} ? $params->{connect_date} : time), |
344
|
|
|
|
|
|
|
post_code => ($params->{post_code} ? $params->{post_code} : ''), |
345
|
|
|
|
|
|
|
country => $params->{country}, |
346
|
|
|
|
|
|
|
region => ($params->{region} ? $params->{region} : ''), |
347
|
|
|
|
|
|
|
city => $params->{city}, |
348
|
|
|
|
|
|
|
street => $params->{street}, |
349
|
|
|
|
|
|
|
number => $params->{number}, |
350
|
|
|
|
|
|
|
building => (defined($params->{building}) ? $params->{building} : '') |
351
|
|
|
|
|
|
|
}); |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=head2 get_ipzones_list |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
Return ip-zones list |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
=cut |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
sub get_ipzones_list { |
365
|
|
|
|
|
|
|
my ($self, $params) = @_; |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
return $self->_exec('rpcf_get_ipzones_list'); |
368
|
|
|
|
|
|
|
} |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=head2 get_services_templates |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
Returns services templates |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=cut |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
sub get_services_templates { |
394
|
|
|
|
|
|
|
my ($self, $params) = @_; |
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
my $services = $self->_exec('rpcf_get_services_list')->{services_count}; |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
my $result; |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
for my $s (@$services) { |
401
|
|
|
|
|
|
|
push @$result, $s if $s->{service_status_array} eq 1; |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
return $result; |
405
|
|
|
|
|
|
|
} |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
=head2 get_services_list |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
Returns services list |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=cut |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
sub get_services_list { |
415
|
|
|
|
|
|
|
my ($self, $params) = @_; |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
return $self->_exec('rpcf_get_services_list', $params)->{services_count}; |
418
|
|
|
|
|
|
|
} |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=head2 get_telephony_service |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
Returns telephony service info |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
=cut |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
sub get_telephony_service { |
428
|
|
|
|
|
|
|
my ($self, $params) = @_; |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
return {} if not defined $params->{service_id}; |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
return $self->_exec('rpcf_get_telephony_service_ex', $params); |
433
|
|
|
|
|
|
|
} |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=head2 edit_telephony_service |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
Updating telephony service |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=cut |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
sub edit_telephony_service { |
442
|
|
|
|
|
|
|
my ($self, $params, $data) = @_; |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
return {} if not (defined $params->{service_id} && |
445
|
|
|
|
|
|
|
defined $params->{service_name}); |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
return $self->_exec('rpcf_edit_telephony_service_ex', $params, $data); |
448
|
|
|
|
|
|
|
} |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
=head2 get_tariffs_list |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
Returns tariffs list |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=cut |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
sub get_tariffs_list { |
460
|
|
|
|
|
|
|
my ($self, $params) = @_; |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
return $self->_exec('rpcf_get_tariffs_list')->{tariffs_count}; |
463
|
|
|
|
|
|
|
} |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=head2 get_tariff |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
Returns tariff |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
=cut |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
sub get_tariff { |
473
|
|
|
|
|
|
|
my ($self, $params) = @_; |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
return {} if not $params->{tariff_id}; |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
return $self->_exec('rpcf_get_tariff', $params); |
478
|
|
|
|
|
|
|
} |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
=head2 get_directions_list |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
Returns direction list |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
=cut |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
sub get_directions_list { |
492
|
|
|
|
|
|
|
my ($self, $params) = @_; |
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
return $self->_exec('rpcf_get_directions')->{count}; |
495
|
|
|
|
|
|
|
} |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
=head2 add_direction |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
Add new direction |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
=cut |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
sub add_direction { |
505
|
|
|
|
|
|
|
my ($self, $params) = @_; |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
$params->{id} = 0; |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
return {} if not (defined($params->{prefix}) && |
510
|
|
|
|
|
|
|
defined($params->{name})); |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
return $self->_exec('rpcf_add_direction_new', $params)->{id}; |
513
|
|
|
|
|
|
|
} |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
=head2 del_direction |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
Delete direction |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
=cut |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
sub del_direction { |
523
|
|
|
|
|
|
|
my ($self, $params) = @_; |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
return {} if not $params->{direction_id}; |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
return $self->_exec('rpcf_del_dir', { dir_id => int($params->{direction_id}) }); |
528
|
|
|
|
|
|
|
} |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=head1 AUTHOR |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
Nikita Melikhov, C<< <ver at 0xff.su> >> |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
=head1 BUGS |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
Please report any bugs or feature requests to C<bug-utm5-urfaclient at rt.cpan.org>, or through |
539
|
|
|
|
|
|
|
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=UTM5-URFAClient>. |
540
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. |
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
=head1 SUPPORT |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
perldoc UTM5::URFAClient |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
You can also look for information at: |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
=over 4 |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
=item * Netup official site |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
L<http://www.netup.ru/> |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=UTM5-URFAClient> |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=back |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
567
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
Copyright 2011 Nikita Melikhov. |
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
571
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
572
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
=cut |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
1; |
580
|
|
|
|
|
|
|
|