9 Net::Vitelity - Interface to Vitelity API
13 our $VERSION = '0.03';
21 my $vitelity = Net::Vitelity->new(
22 'login' => $your_login,
32 Create a new Net::Vitelity object. login and pass are required.
37 my ($class,%data) = @_;
38 die "missing user and/or password" unless defined $data{'login'} && defined $data{'pass'};
39 my $self = { 'login' => $data{'login'}, 'pass' => $data{'pass'} };
40 $self->{apitype} = $data{'apitype'} ? $data{'apitype'} : 'api';
48 $AUTOLOAD =~ /(^|::)(\w+)$/ or die "unparsable AUTOLOAD: $AUTOLOAD";
50 return if $cmd eq 'DESTROY';
52 my $ua = LWP::UserAgent->new;
56 my $URL_API = 'http://64.74.178.105/api.php';
57 my $URL_FAX = 'http://64.74.178.105/fax.php';
60 $url = $URL_FAX if $self->{apitype} eq 'fax';
62 my $response = $ua->post($url, {
63 login => $self->{login},
64 pass => $self->{pass},
70 die $response->status_line unless $response->is_success;
72 my $content = $response->decoded_content;
74 $content =~ /x\[\[(.*)\[\[x/s;
77 wantarray ? split("\n", $content) : $content;
83 List ALL available toll free numbers
85 Possible Results: none OR [list of tf numbers]
89 Sends someone a phone call that then connects them to customer service/another number.
91 Options: number=number AND servicenumber=number
93 Possible Results:OK or INVALID
97 Lists ALL available local numbers in a specific state and ratecenter
101 Options: type=unlimited OR type=pri OR withrates=yes
102 ratecenter=RATECENTER
104 Possible Results: unavailable or missing or [list of dids]
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
115 Orders a specific local number from our available list
117 Requires: did=AVAILABLE-LOCAL-NUMBER
119 Options: type=perminute OR type=unlimited OR type=your-pri OR
120 routesip=route_to_this_subaccount
122 Possible Results: invalid or success or missingdid
126 Remove Local or Toll Free DID from account
128 Requires: did=AVAILABLE-LOCAL-NUMBER
130 Possible Results: success OR unavailable OR missingdid
132 =head2 listratecenters
134 Lists all of the available rate centers for a specific state line by line
136 Requires: state=STATE (ie, state=CO)
138 Options: type=perminute OR type=unlimited OR type=pri
140 Possible Results: unavailable OR missingdata OR [list of ratecenters]
142 =head2 listavailratecenters
144 Lists all available rate centers DIDs are currently in stock for a specific state line by line
146 Requires: state=STATE (ie, state=CO)
148 Options: type=unlimited OR type=pri
150 Possible Results: missingdata OR unavailable or [list of ratecenters]
154 Orders a specific available toll free number from the SMS database.
156 Requires: did=8009879891 (number can be any available number)
158 Possible Results: missingdata OR exists OR success
162 Searches the SMS/800 database for an available number matching the specific data you provide
164 Requires: did=8**333****
166 Possible Results: none OR missingdata OR [list of avail numbers]
168 =head2 listavailstates
170 Lists all states that have DIDs which are currently in stock
172 Options: type=perminute OR type=unlimited OR type=pri
174 Possible Results: unavailable OR [list of states]
178 Lists all available DID states line by line
180 Options: type=perminute OR type=unlimited OR type=pri
182 Possible Results: unavailable OR [list of states]
186 Lookup a specific caller id number for the name
188 Requires: did=3037855015 (number)
190 Possible Results: missingdata OR [cnam value]
194 Searches the SMS/800 database for an available number matching the specific data you provide
196 Requires: did=8**333****
198 Possible Results: none OR missingdata OR [list of avail numbers]
200 =head2 localbackorder
202 Orders a specific local number from our available list
204 Requires: ratecenter=RATECENTER and state=STATE
206 Options: type=perminute OR type=unlimited
208 Possible Results: invalid OR ok OR missing
212 Changes the sub account a DID rings to.
214 Requires: did=DID_NUMBER & routesip=SIP_SUB_ACCOUNT
216 Possible Results: missingdata OR ok OR invalid
220 Reports back your current account balance
224 Lists all current Local and Toll free DIDs
228 Results: number,ratecenter,price_per_minute,subaccount
230 extra=yes adds STATE,MONTHLY_DID_RATE
234 Changes the routing on all dids to a specific sip account
236 Requires: routesip=sub_account OR routesip=login (routes to main)
238 Possible Results: ok OR invalid
242 Gets a rate on a specific domestic or International call
244 Requires: number=[countrycode_thenumber] ex: 01144.. or 1303..
246 Results: invalid OR the_rate_per_minute
254 Possible Results: subaccount list separated by return OR invalid
256 =head1 All Possible Result Return Codes
262 The request you made was successful
266 You are missing login= or pass= or cmd= or other in your URL string
270 You have submitted an invalid login or password
274 You are missing the ratecenter or state for a specific local did order
278 The number you requested is not available
282 There are no numbers available
286 you are missing &did=number
290 If you asked for a list of numbers and we had some available, they will be listed.
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.
299 Ivan Kohler, C<< <ivan-vitelity at freeside.biz> >>
303 Please report any bugs or feature requests to C<bug-net-vitelity at rt.cpan.org>, or through
304 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Vitelity>. I will be notified, and then you'll
305 automatically be notified of progress on your bug as I make changes.
309 You can find documentation for this module with the perldoc command.
311 perldoc Net::Vitelity
313 You can also look for information at:
317 =item * RT: CPAN's request tracker
319 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Vitelity>
321 =item * AnnoCPAN: Annotated CPAN documentation
323 L<http://annocpan.org/dist/Net-Vitelity>
327 L<http://cpanratings.perl.org/d/Net-Vitelity>
331 L<http://search.cpan.org/dist/Net-Vitelity>
335 =head1 ADVERTISEMENTS
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.
345 Development sponsored by Voice Carrier LLC. If you need a hosted or on-site
346 PBX, please visit http://www.voicecarrier.com/
348 =head1 COPYRIGHT & LICENSE
350 Copyright 2009-2012 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.