9 Net::Vitelity - Interface to Vitelity API
13 our $VERSION = '0.04';
21 my $vitelity = Net::Vitelity->new(
22 'login' => $your_login,
24 'apitype' => 'api', #api, fax or lnp
34 Create a new Net::Vitelity object. login and pass are required.
39 my ($class,%data) = @_;
40 die "missing user and/or password" unless defined $data{'login'} && defined $data{'pass'};
41 my $self = { 'login' => $data{'login'}, 'pass' => $data{'pass'} };
42 $self->{apitype} = $data{'apitype'} ? $data{'apitype'} : 'api';
43 $self->{debug} = $data{'debug'} ? 1 : 0;
51 $AUTOLOAD =~ /(^|::)(\w+)$/ or die "unparsable AUTOLOAD: $AUTOLOAD";
53 return if $cmd eq 'DESTROY';
55 my $ua = LWP::UserAgent->new;
59 my $URL_API = 'http://api.vitelity.net/api.php';
60 my $URL_FAX = 'http://api.vitelity.net/fax.php';
61 my $URL_LNP = 'http://api.vitelity.net/lnp.php';
64 $url = $URL_FAX if $self->{apitype} eq 'fax';
65 $url = $URL_LNP if $self->{apitype} eq 'lnp';
67 if ( $self->{debug} ) {
68 warn "Vitelity $cmd ($url)\n";
70 warn " $_: $hash{$_}\n" foreach keys %hash;
73 my $response = $ua->post($url, {
74 login => $self->{login},
75 pass => $self->{pass},
81 die $response->status_line unless $response->is_success;
83 my $content = $response->decoded_content;
85 $content =~ /x\[\[(.*)\[\[x/s;
88 wantarray ? split("\n", $content) : $content;
94 List ALL available toll free numbers
96 Possible Results: none OR [list of tf numbers]
100 Sends someone a phone call that then connects them to customer service/another number.
102 Options: number=number AND servicenumber=number
104 Possible Results:OK or INVALID
108 Lists ALL available local numbers in a specific state and ratecenter
110 Requires: state=STATE
112 Options: type=unlimited OR type=pri OR withrates=yes
113 ratecenter=RATECENTER
115 Possible Results: unavailable or missing or [list of dids]
119 Orders a specific toll free number in our available list (SLOW)
120 Requires: did=TOLL-FREE-NUMBER
121 Options: routesip=route_to_this_subaccount
122 Possible Results: success or unavailable or missingdid
126 Orders a specific local number from our available list
128 Requires: did=AVAILABLE-LOCAL-NUMBER
130 Options: type=perminute OR type=unlimited OR type=your-pri OR
131 routesip=route_to_this_subaccount
133 Possible Results: invalid or success or missingdid
137 Remove Local or Toll Free DID from account
139 Requires: did=AVAILABLE-LOCAL-NUMBER
141 Possible Results: success OR unavailable OR missingdid
143 =head2 listratecenters
145 Lists all of the available rate centers for a specific state line by line
147 Requires: state=STATE (ie, state=CO)
149 Options: type=perminute OR type=unlimited OR type=pri
151 Possible Results: unavailable OR missingdata OR [list of ratecenters]
153 =head2 listavailratecenters
155 Lists all available rate centers DIDs are currently in stock for a specific state line by line
157 Requires: state=STATE (ie, state=CO)
159 Options: type=unlimited OR type=pri
161 Possible Results: missingdata OR unavailable or [list of ratecenters]
165 Orders a specific available toll free number from the SMS database.
167 Requires: did=8009879891 (number can be any available number)
169 Possible Results: missingdata OR exists OR success
173 Searches the SMS/800 database for an available number matching the specific data you provide
175 Requires: did=8**333****
177 Possible Results: none OR missingdata OR [list of avail numbers]
179 =head2 listavailstates
181 Lists all states that have DIDs which are currently in stock
183 Options: type=perminute OR type=unlimited OR type=pri
185 Possible Results: unavailable OR [list of states]
189 Lists all available DID states line by line
191 Options: type=perminute OR type=unlimited OR type=pri
193 Possible Results: unavailable OR [list of states]
197 Lookup a specific caller id number for the name
199 Requires: did=3037855015 (number)
201 Possible Results: missingdata OR [cnam value]
205 Searches the SMS/800 database for an available number matching the specific data you provide
207 Requires: did=8**333****
209 Possible Results: none OR missingdata OR [list of avail numbers]
211 =head2 localbackorder
213 Orders a specific local number from our available list
215 Requires: ratecenter=RATECENTER and state=STATE
217 Options: type=perminute OR type=unlimited
219 Possible Results: invalid OR ok OR missing
223 Changes the sub account a DID rings to.
225 Requires: did=DID_NUMBER & routesip=SIP_SUB_ACCOUNT
227 Possible Results: missingdata OR ok OR invalid
231 Reports back your current account balance
235 Lists all current Local and Toll free DIDs
239 Results: number,ratecenter,price_per_minute,subaccount
241 extra=yes adds STATE,MONTHLY_DID_RATE
245 Changes the routing on all dids to a specific sip account
247 Requires: routesip=sub_account OR routesip=login (routes to main)
249 Possible Results: ok OR invalid
253 Gets a rate on a specific domestic or International call
255 Requires: number=[countrycode_thenumber] ex: 01144.. or 1303..
257 Results: invalid OR the_rate_per_minute
265 Possible Results: subaccount list separated by return OR invalid
267 =head1 All Possible Result Return Codes
273 The request you made was successful
277 You are missing login= or pass= or cmd= or other in your URL string
281 You have submitted an invalid login or password
285 You are missing the ratecenter or state for a specific local did order
289 The number you requested is not available
293 There are no numbers available
297 you are missing &did=number
301 If you asked for a list of numbers and we had some available, they will be listed.
303 In a list contect, all entries will be returned in a list. In a scalar
304 scalar context, entries will be separated by newlines.
310 Ivan Kohler, C<< <ivan-vitelity at freeside.biz> >>
314 Please report any bugs or feature requests to C<bug-net-vitelity at rt.cpan.org>, or through
315 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Vitelity>. I will be notified, and then you'll
316 automatically be notified of progress on your bug as I make changes.
320 You can find documentation for this module with the perldoc command.
322 perldoc Net::Vitelity
324 You can also look for information at:
328 =item * RT: CPAN's request tracker
330 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Vitelity>
332 =item * AnnoCPAN: Annotated CPAN documentation
334 L<http://annocpan.org/dist/Net-Vitelity>
338 L<http://cpanratings.perl.org/d/Net-Vitelity>
342 L<http://search.cpan.org/dist/Net-Vitelity>
346 =head1 ADVERTISEMENTS
348 This module was developed by Freeside Internet Services, Inc.
349 Need a complete, open-source back-office and customer self-service solution?
350 The Freeside software includes Vitelity integration, CDR rating,
351 invoicing, credit card and electronic check processing, integrated trouble
352 ticketing and customer signup and self-service web interfaces.
356 =head1 COPYRIGHT & LICENSE
358 Copyright 2009-2017 Freeside Internet Services, Inc.
361 This program is free software; you can redistribute it and/or modify it
362 under the same terms as Perl itself.