8 Net::Vitelity - Interface to Vitelity API
16 our $VERSION = '0.01';
18 our $URL = 'http://70.84.157.157/api.php';
26 my $vitelity = Net::Vitelity->new(
27 'login' => $your_login,
36 #XXX need a generic new
42 $AUTOLOAD =~ /(^|::)(\w+)$/ or die "unparsable AUTOLOAD: $AUTOLOAD";
44 return if $cmd eq 'DESTROY';
46 my $ua = LWP::UserAgent->new;
50 my $response = $ua->post($URL, {
51 login => $self->{login},
52 pass => $self->{pass},
58 die $response->status_line unless $response->is_success;
61 #my $content = $response->content;
62 my $content = $response->decoded_content;
64 #dear vitelity api: why does this make it easier to parse?
65 $content =~ s/^x\[\[//;
66 #$content =~ s/\[\[x$//;
67 $content =~ s/\]\]x$//;
69 wantarray ? split("\n", $content) : $content;
75 List ALL available toll free numbers
77 Possible Results: none OR [list of tf numbers]
81 Sends someone a phone call that then connects them to customer service/another number.
83 Options: number=number AND servicenumber=number
85 Possible Results:OK or INVALID
89 Lists ALL available local numbers in a specific state and ratecenter
93 Options: type=unlimited OR type=pri OR withrates=yes
96 Possible Results: unavailable or missing or [list of dids]
100 Orders a specific toll free number in our available list (SLOW)
101 Requires: did=TOLL-FREE-NUMBER
102 Options: routesip=route_to_this_subaccount
103 Possible Results: success or unavailable or missingdid
107 Orders a specific local number from our available list
109 Requires: did=AVAILABLE-LOCAL-NUMBER
111 Options: type=perminute OR type=unlimited OR type=your-pri OR
112 routesip=route_to_this_subaccount
114 Possible Results: invalid or success or missingdid
118 Remove Local or Toll Free DID from account
120 Requires: did=AVAILABLE-LOCAL-NUMBER
122 Possible Results: success OR unavailable OR missingdid
124 =head2 listratecenters
126 Lists all of the available rate centers for a specific state line by line
128 Requires: state=STATE (ie, state=CO)
130 Options: type=perminute OR type=unlimited OR type=pri
132 Possible Results: unavailable OR missingdata OR [list of ratecenters]
134 =head2 listavailratecenters
136 Lists all available rate centers DIDs are currently in stock for a specific state line by line
138 Requires: state=STATE (ie, state=CO)
140 Options: type=unlimited OR type=pri
142 Possible Results: missingdata OR unavailable or [list of ratecenters]
146 Orders a specific available toll free number from the SMS database.
148 Requires: did=8009879891 (number can be any available number)
150 Possible Results: missingdata OR exists OR success
154 Searches the SMS/800 database for an available number matching the specific data you provide
156 Requires: did=8**333****
158 Possible Results: none OR missingdata OR [list of avail numbers]
160 =head2 listavailstates
162 Lists all states that have DIDs which are currently in stock
164 Options: type=perminute OR type=unlimited OR type=pri
166 Possible Results: unavailable OR [list of states]
170 Lists all available DID states line by line
172 Options: type=perminute OR type=unlimited OR type=pri
174 Possible Results: unavailable OR [list of states]
178 Lookup a specific caller id number for the name
180 Requires: did=3037855015 (number)
182 Possible Results: missingdata OR [cnam value]
186 Searches the SMS/800 database for an available number matching the specific data you provide
188 Requires: did=8**333****
190 Possible Results: none OR missingdata OR [list of avail numbers]
192 =head2 localbackorder
194 Orders a specific local number from our available list
196 Requires: ratecenter=RATECENTER and state=STATE
198 Options: type=perminute OR type=unlimited
200 Possible Results: invalid OR ok OR missing
204 Changes the sub account a DID rings to.
206 Requires: did=DID_NUMBER & routesip=SIP_SUB_ACCOUNT
208 Possible Results: missingdata OR ok OR invalid
212 Reports back your current account balance
216 Lists all current Local and Toll free DIDs
220 Results: number,ratecenter,price_per_minute,subaccount
222 extra=yes adds STATE,MONTHLY_DID_RATE
226 Changes the routing on all dids to a specific sip account
228 Requires: routesip=sub_account OR routesip=login (routes to main)
230 Possible Results: ok OR invalid
234 Gets a rate on a specific domestic or International call
236 Requires: number=[countrycode_thenumber] ex: 01144.. or 1303..
238 Results: invalid OR the_rate_per_minute
246 Possible Results: subaccount list separated by return OR invalid
248 =head1 All Possible Result Return Codes
254 The request you made was successful
258 You are missing login= or pass= or cmd= or other in your URL string
262 You have submitted an invalid login or password
266 You are missing the ratecenter or state for a specific local did order
270 The number you requested is not available
274 There are no numbers available
278 you are missing &did=number
282 If you asked for a list of numbers and we had some available, they will be listed.
284 In a list contect, all entries will be returned in a list. In a scalar
285 scalar context, entries will be separated by newlines.
289 Ivan Kohler, C<< <ivan-vitelity at freeside.biz> >>
293 Please report any bugs or feature requests to C<bug-net-vitelity at rt.cpan.org>, or through
294 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Vitelity>. I will be notified, and then you'll
295 automatically be notified of progress on your bug as I make changes.
299 You can find documentation for this module with the perldoc command.
301 perldoc Net::Vitelity
303 You can also look for information at:
307 =item * RT: CPAN's request tracker
309 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Vitelity>
311 =item * AnnoCPAN: Annotated CPAN documentation
313 L<http://annocpan.org/dist/Net-Vitelity>
317 L<http://cpanratings.perl.org/d/Net-Vitelity>
321 L<http://search.cpan.org/dist/Net-Vitelity>
325 =head1 ACKNOWLEDGEMENTS
327 This module was developed by Freeside Internet Services, Inc.
328 If you need a complete, open-source web-based application to manage your
329 customers, billing and trouble ticketing, please visit http://freeside.biz/
331 Development sponsored by Ring Carrier LLC. If you need a hosted or on-site
332 PBX, please visit http://www.ringcarrier.com/
334 =head1 COPYRIGHT & LICENSE
336 Copyright 2009 Freeside Internet Services, Inc.
339 This program is free software; you can redistribute it and/or modify it
340 under the same terms as Perl itself.