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