diff options
author | ivan <ivan> | 2008-06-27 00:27:08 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-06-27 00:27:08 +0000 |
commit | c0fc4ff514307f032b16b827b6f4b2ae95ca18f9 (patch) | |
tree | 14ae4a17894ea2732861771dfa7d5a0a55c7aee1 /FS | |
parent | a2da8f67ee40abf7e755dcc80c5a4f9cd234ab6c (diff) |
commiting globalpops export start. stupid power failure.
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/part_export/globalpops_voip.pm | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/FS/FS/part_export/globalpops_voip.pm b/FS/FS/part_export/globalpops_voip.pm new file mode 100644 index 000000000..c64e49a50 --- /dev/null +++ b/FS/FS/part_export/globalpops_voip.pm @@ -0,0 +1,90 @@ +package FS::part_export::globalpops_voip; + +use vars qw(@ISA %info); +use Tie::IxHash; +use FS::part_export; + +@ISA = qw(FS::part_export); + +tie my %options, 'Tie::IxHash', + 'login' => { label=>'GlobalPOPs Media Services API login', + 'password' => { label=>'GlobalPOPs Media Services API password', +; + +%info = ( + 'svc' => 'svc_phone', + 'desc' => 'Provision phone numbers to GlobalPOPs VoIP', + 'options' => \%options, + 'notes' => <<'END' +Requires installation of +<a href="http://search.cpan.org/dist/Net-GlobalPOPs-MediaServicesAPI">Net::GlobalPOPs::MediaServicesAPI</a> +from CPAN. +END +); + +sub rebless { shift; } + +sub _export_insert { + my( $self, $svc_phone ) = (shift, shift); + #we want to provision and catch errors now, not queue +} + +sub _export_replace { + my( $self, $new, $old ) = (shift, shift, shift); + #hmm, what's to change? +} + +sub _export_delete { + my( $self, $svc_phone ) = (shift, shift); + #probably okay to queue the deletion... +} + +sub _export_suspend { + my( $self, $svc_phone ) = (shift, shift); + #nop for now +} + +sub _export_unsuspend { + my( $self, $svc_phone ) = (shift, shift); + #nop for now +} + +#hmm, might forgo queueing entirely for most things, data is too much of a pita + +sub globalpops_voip_queue { + my( $self, $svcnum, $method ) = (shift, shift, shift); + my $queue = new FS::queue { + 'svcnum' => $svcnum, + 'job' => 'FS::part_export::globalpops_voip::globalpops_voip_command', + }; + $queue->insert( + $self->option('login'), + $self->option('password'), + $method, + @_, + ); +} + +sub globalpops_voip_command { + my($login, $password, $method, @args) = @_; + + eval "use Net::GlobalPOPs::MediaServicesAPI;"; + die $@ if $@: + + my $gp = new Net::GlobalPOPs + 'login' => $login, + 'password' => $password, + #'debug' => 1, + ; + + my $return = $gp->$method( @args ); + + #$return->{'status'} + #$return->{'statuscode'} + + die $return->{'status'} if $return->{'statuscode'}; + +} + +1; + |