line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Vitelity; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
31758
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
1
|
|
|
1
|
|
8337
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
95004
|
|
|
1
|
|
|
|
|
453
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Net::Vitelity - Interface to Vitelity API |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $AUTOLOAD; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use Net::Vitelity; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $vitelity = Net::Vitelity->new( |
22
|
|
|
|
|
|
|
'login' => $your_login, |
23
|
|
|
|
|
|
|
'pass' => $your_pass, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 METHODS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 new |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Create a new Net::Vitelity object. login and pass are required. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new { |
37
|
0
|
|
|
0
|
1
|
|
my ($class,%data) = @_; |
38
|
0
|
0
|
0
|
|
|
|
die "missing user and/or password" unless defined $data{'login'} && defined $data{'pass'}; |
39
|
0
|
|
|
|
|
|
my $self = { 'login' => $data{'login'}, 'pass' => $data{'pass'} }; |
40
|
0
|
0
|
|
|
|
|
$self->{apitype} = $data{'apitype'} ? $data{'apitype'} : 'api'; |
41
|
0
|
|
|
|
|
|
bless $self, $class; |
42
|
0
|
|
|
|
|
|
return $self; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub AUTOLOAD { |
46
|
0
|
|
|
0
|
|
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
$AUTOLOAD =~ /(^|::)(\w+)$/ or die "unparsable AUTOLOAD: $AUTOLOAD"; |
49
|
0
|
|
|
|
|
|
my $cmd = $2; |
50
|
0
|
0
|
|
|
|
|
return if $cmd eq 'DESTROY'; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#XXX md5 encrypt pass |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $URL_API = 'http://64.74.178.105/api.php'; |
57
|
0
|
|
|
|
|
|
my $URL_FAX = 'http://64.74.178.105/fax.php'; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $url = $URL_API; |
60
|
0
|
0
|
|
|
|
|
$url = $URL_FAX if $self->{apitype} eq 'fax'; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $response = $ua->post($url, { |
63
|
|
|
|
|
|
|
login => $self->{login}, |
64
|
|
|
|
|
|
|
pass => $self->{pass}, |
65
|
|
|
|
|
|
|
cmd => $cmd, |
66
|
|
|
|
|
|
|
@_, |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
die $response->status_line unless $response->is_success; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $content = $response->decoded_content; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$content =~ /x\[\[(.*)\[\[x/s; |
75
|
0
|
|
|
|
|
|
$content = $1; |
76
|
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
|
wantarray ? split("\n", $content) : $content; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 listtollfree |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
List ALL available toll free numbers |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Possible Results: none OR [list of tf numbers] |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 callfromclick |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Sends someone a phone call that then connects them to customer service/another number. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Options: number=number AND servicenumber=number |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Possible Results:OK or INVALID |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 listlocal |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Lists ALL available local numbers in a specific state and ratecenter |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Requires: state=STATE |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Options: type=unlimited OR type=pri OR withrates=yes |
102
|
|
|
|
|
|
|
ratecenter=RATECENTER |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Possible Results: unavailable or missing or [list of dids] |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 gettollfree |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Orders a specific toll free number in our available list (SLOW) |
109
|
|
|
|
|
|
|
Requires: did=TOLL-FREE-NUMBER |
110
|
|
|
|
|
|
|
Options: routesip=route_to_this_subaccount |
111
|
|
|
|
|
|
|
Possible Results: success or unavailable or missingdid |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 getlocaldid |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Orders a specific local number from our available list |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Requires: did=AVAILABLE-LOCAL-NUMBER |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Options: type=perminute OR type=unlimited OR type=your-pri OR |
120
|
|
|
|
|
|
|
routesip=route_to_this_subaccount |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Possible Results: invalid or success or missingdid |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 removedid |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Remove Local or Toll Free DID from account |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Requires: did=AVAILABLE-LOCAL-NUMBER |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Possible Results: success OR unavailable OR missingdid |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 listratecenters |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Lists all of the available rate centers for a specific state line by line |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Requires: state=STATE (ie, state=CO) |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Options: type=perminute OR type=unlimited OR type=pri |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Possible Results: unavailable OR missingdata OR [list of ratecenters] |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 listavailratecenters |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Lists all available rate centers DIDs are currently in stock for a specific state line by line |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Requires: state=STATE (ie, state=CO) |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Options: type=unlimited OR type=pri |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Possible Results: missingdata OR unavailable or [list of ratecenters] |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 requestvanity |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Orders a specific available toll free number from the SMS database. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Requires: did=8009879891 (number can be any available number) |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Possible Results: missingdata OR exists OR success |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 searchtoll |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Searches the SMS/800 database for an available number matching the specific data you provide |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Requires: did=8**333**** |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Possible Results: none OR missingdata OR [list of avail numbers] |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 listavailstates |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Lists all states that have DIDs which are currently in stock |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Options: type=perminute OR type=unlimited OR type=pri |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Possible Results: unavailable OR [list of states] |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 liststates |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Lists all available DID states line by line |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Options: type=perminute OR type=unlimited OR type=pri |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Possible Results: unavailable OR [list of states] |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 cnam |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Lookup a specific caller id number for the name |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Requires: did=3037855015 (number) |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Possible Results: missingdata OR [cnam value] |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 searchtoll |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Searches the SMS/800 database for an available number matching the specific data you provide |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Requires: did=8**333**** |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Possible Results: none OR missingdata OR [list of avail numbers] |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head2 localbackorder |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Orders a specific local number from our available list |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Requires: ratecenter=RATECENTER and state=STATE |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Options: type=perminute OR type=unlimited |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
Possible Results: invalid OR ok OR missing |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head2 reroute |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Changes the sub account a DID rings to. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Requires: did=DID_NUMBER & routesip=SIP_SUB_ACCOUNT |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Possible Results: missingdata OR ok OR invalid |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head2 balance |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Reports back your current account balance |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 listdids |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Lists all current Local and Toll free DIDs |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Options: extra=yes |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Results: number,ratecenter,price_per_minute,subaccount |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
extra=yes adds STATE,MONTHLY_DID_RATE |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head2 routeall |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
Changes the routing on all dids to a specific sip account |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Requires: routesip=sub_account OR routesip=login (routes to main) |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Possible Results: ok OR invalid |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head2 getrate |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
Gets a rate on a specific domestic or International call |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
Requires: number=[countrycode_thenumber] ex: 01144.. or 1303.. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Results: invalid OR the_rate_per_minute |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=head2 subaccounts |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
Lists sub accounts |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
Requires: do=list |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
Possible Results: subaccount list separated by return OR invalid |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head1 All Possible Result Return Codes |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=over 4 |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=item success |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
The request you made was successful |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=item missingdata |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
You are missing login= or pass= or cmd= or other in your URL string |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=item invalidauth |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
You have submitted an invalid login or password |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=item missingrc |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
You are missing the ratecenter or state for a specific local did order |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=item unavailable |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
The number you requested is not available |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=item none |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
There are no numbers available |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=item missingdid |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
you are missing &did=number |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=item list of data |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
If you asked for a list of numbers and we had some available, they will be listed. |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
In a list contect, all entries will be returned in a list. In a scalar |
293
|
|
|
|
|
|
|
scalar context, entries will be separated by newlines. |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=back |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=head1 AUTHOR |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
Ivan Kohler, C<< >> |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=head1 BUGS |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
304
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
305
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=head1 SUPPORT |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
perldoc Net::Vitelity |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
You can also look for information at: |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=over 4 |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
L |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
L |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
=item * CPAN Ratings |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
L |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=item * Search CPAN |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
L |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=back |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=head1 ADVERTISEMENTS |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
This module was developed by Freeside Internet Services, Inc. |
338
|
|
|
|
|
|
|
Need a complete, open-source back-office and customer self-service solution? |
339
|
|
|
|
|
|
|
The Freeside software includes Vitelity integration, CDR rating, |
340
|
|
|
|
|
|
|
invoicing, credit card and electronic check processing, integrated trouble |
341
|
|
|
|
|
|
|
ticketing and customer signup and self-service web interfaces. |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
http://freeside.biz/ |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
Development sponsored by Voice Carrier LLC. If you need a hosted or on-site |
346
|
|
|
|
|
|
|
PBX, please visit http://www.voicecarrier.com/ |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
Copyright 2009-2012 Freeside Internet Services, Inc. |
351
|
|
|
|
|
|
|
All rights reserved. |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
354
|
|
|
|
|
|
|
under the same terms as Perl itself. |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=cut |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
1; |
359
|
|
|
|
|
|
|
|