9 Net::Vitelity - Interface to Vitelity API
17 our $VERSION = '0.02';
25 my $vitelity = Net::Vitelity->new(
26 'login' => $your_login,
35 my ($class,%data) = @_;
36 die "missing user and/or password" unless defined $data{'login'} && defined $data{'pass'};
37 my $self = { 'login' => $data{'login'}, 'pass' => $data{'pass'} };
38 $self->{apitype} = $data{'apitype'} ? $data{'apitype'} : 'api';
46 $AUTOLOAD =~ /(^|::)(\w+)$/ or die "unparsable AUTOLOAD: $AUTOLOAD";
48 return if $cmd eq 'DESTROY';
50 my $ua = LWP::UserAgent->new;
54 my $URL_API = 'http://64.74.178.105/api.php';
55 my $URL_FAX = 'http://64.74.178.105/fax.php';
58 $url = $URL_FAX if $self->{apitype} eq 'fax';
60 my $response = $ua->post($url, {
61 login => $self->{login},
62 pass => $self->{pass},
68 die $response->status_line unless $response->is_success;
70 my $content = $response->decoded_content;
72 $content =~ /x\[\[(.*)\[\[x/s;
75 wantarray ? split("\n", $content) : $content;
81 List ALL available toll free numbers
83 Possible Results: none OR [list of tf numbers]
87 Sends someone a phone call that then connects them to customer service/another number.
89 Options: number=number AND servicenumber=number
91 Possible Results:OK or INVALID
95 Lists ALL available local numbers in a specific state and ratecenter
99 Options: type=unlimited OR type=pri OR withrates=yes
100 ratecenter=RATECENTER
102 Possible Results: unavailable or missing or [list of dids]
106 Orders a specific toll free number in our available list (SLOW)
107 Requires: did=TOLL-FREE-NUMBER
108 Options: routesip=route_to_this_subaccount
109 Possible Results: success or unavailable or missingdid
113 Orders a specific local number from our available list
115 Requires: did=AVAILABLE-LOCAL-NUMBER
117 Options: type=perminute OR type=unlimited OR type=your-pri OR
118 routesip=route_to_this_subaccount
120 Possible Results: invalid or success or missingdid
124 Remove Local or Toll Free DID from account
126 Requires: did=AVAILABLE-LOCAL-NUMBER
128 Possible Results: success OR unavailable OR missingdid
130 =head2 listratecenters
132 Lists all of the available rate centers for a specific state line by line
134 Requires: state=STATE (ie, state=CO)
136 Options: type=perminute OR type=unlimited OR type=pri
138 Possible Results: unavailable OR missingdata OR [list of ratecenters]
140 =head2 listavailratecenters
142 Lists all available rate centers DIDs are currently in stock for a specific state line by line
144 Requires: state=STATE (ie, state=CO)
146 Options: type=unlimited OR type=pri
148 Possible Results: missingdata OR unavailable or [list of ratecenters]
152 Orders a specific available toll free number from the SMS database.
154 Requires: did=8009879891 (number can be any available number)
156 Possible Results: missingdata OR exists OR success
160 Searches the SMS/800 database for an available number matching the specific data you provide
162 Requires: did=8**333****
164 Possible Results: none OR missingdata OR [list of avail numbers]
166 =head2 listavailstates
168 Lists all states that have DIDs which are currently in stock
170 Options: type=perminute OR type=unlimited OR type=pri
172 Possible Results: unavailable OR [list of states]
176 Lists all available DID states line by line
178 Options: type=perminute OR type=unlimited OR type=pri
180 Possible Results: unavailable OR [list of states]
184 Lookup a specific caller id number for the name
186 Requires: did=3037855015 (number)
188 Possible Results: missingdata OR [cnam value]
192 Searches the SMS/800 database for an available number matching the specific data you provide
194 Requires: did=8**333****
196 Possible Results: none OR missingdata OR [list of avail numbers]
198 =head2 localbackorder
200 Orders a specific local number from our available list
202 Requires: ratecenter=RATECENTER and state=STATE
204 Options: type=perminute OR type=unlimited
206 Possible Results: invalid OR ok OR missing
210 Changes the sub account a DID rings to.
212 Requires: did=DID_NUMBER & routesip=SIP_SUB_ACCOUNT
214 Possible Results: missingdata OR ok OR invalid
218 Reports back your current account balance
222 Lists all current Local and Toll free DIDs
226 Results: number,ratecenter,price_per_minute,subaccount
228 extra=yes adds STATE,MONTHLY_DID_RATE
232 Changes the routing on all dids to a specific sip account
234 Requires: routesip=sub_account OR routesip=login (routes to main)
236 Possible Results: ok OR invalid
240 Gets a rate on a specific domestic or International call
242 Requires: number=[countrycode_thenumber] ex: 01144.. or 1303..
244 Results: invalid OR the_rate_per_minute
252 Possible Results: subaccount list separated by return OR invalid
254 =head1 All Possible Result Return Codes
260 The request you made was successful
264 You are missing login= or pass= or cmd= or other in your URL string
268 You have submitted an invalid login or password
272 You are missing the ratecenter or state for a specific local did order
276 The number you requested is not available
280 There are no numbers available
284 you are missing &did=number
288 If you asked for a list of numbers and we had some available, they will be listed.
290 In a list contect, all entries will be returned in a list. In a scalar
291 scalar context, entries will be separated by newlines.
297 Ivan Kohler, C<< <ivan-vitelity at freeside.biz> >>
301 Please report any bugs or feature requests to C<bug-net-vitelity at rt.cpan.org>, or through
302 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Vitelity>. I will be notified, and then you'll
303 automatically be notified of progress on your bug as I make changes.
307 You can find documentation for this module with the perldoc command.
309 perldoc Net::Vitelity
311 You can also look for information at:
315 =item * RT: CPAN's request tracker
317 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Vitelity>
319 =item * AnnoCPAN: Annotated CPAN documentation
321 L<http://annocpan.org/dist/Net-Vitelity>
325 L<http://cpanratings.perl.org/d/Net-Vitelity>
329 L<http://search.cpan.org/dist/Net-Vitelity>
333 =head1 ACKNOWLEDGEMENTS
335 This module was developed by Freeside Internet Services, Inc.
336 If you need a complete, open-source, web-based application to manage your
337 customers, billing and trouble ticketing, please visit http://freeside.biz/
339 Development sponsored by Ring Carrier LLC. If you need a hosted or on-site
340 PBX, please visit http://www.ringcarrier.com/
342 =head1 COPYRIGHT & LICENSE
344 Copyright 2009 Freeside Internet Services, Inc.
347 This program is free software; you can redistribute it and/or modify it
348 under the same terms as Perl itself.