X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fglobalpops_voip.pm;h=5eee13f340d44f29b6842a0e2fcb3ec98995257d;hb=674cb2d9d7105f4cc2871539b2e9f7088cdaa750;hp=b6e713ac92fca599da95cfe122edfde6852dec5c;hpb=3acaea77e979e4739ede4a93f09d6fbf50f78d7b;p=freeside.git diff --git a/FS/FS/part_export/globalpops_voip.pm b/FS/FS/part_export/globalpops_voip.pm index b6e713ac9..5eee13f34 100644 --- a/FS/FS/part_export/globalpops_voip.pm +++ b/FS/FS/part_export/globalpops_voip.pm @@ -5,6 +5,7 @@ use Tie::IxHash; use FS::Record qw(qsearch dbh); use FS::part_export; use FS::phone_avail; +use Data::Dumper; @ISA = qw(FS::part_export); @@ -19,6 +20,7 @@ tie my %options, 'Tie::IxHash', 'svc' => 'svc_phone', 'desc' => 'Provision phone numbers to VoIP Innovations (formerly GlobalPOPs VoIP)', 'options' => \%options, + 'no_machine' => 1, 'notes' => <<'END' Requires installation of Net::GlobalPOPs::MediaServicesAPI @@ -28,6 +30,8 @@ END sub rebless { shift; } +sub can_get_dids { 1; } + sub get_dids { my $self = shift; my %opt = ref($_[0]) ? %{$_[0]} : @_; @@ -60,21 +64,28 @@ sub get_dids { } my $dids = $self->gp_command('getDIDs', %getdids); + if ( $dids->{'type'} eq 'Error' ) { - die "Error running VoIP Innovations getDIDs: ". - $search->{'statuscode'}. ': '. $search->{'status'}; #die?? + my $error = "Error running VoIP Innovations getDIDs: ". + $dids->{'statuscode'}. ': '. $dids->{'status'}. "\n"; + warn $error; + die $error; } - #use Data::Dumper; - #warn Dumper($dids); - my $search = $dids->{'search'}; if ( $search->{'statuscode'} == 302200 ) { return []; } elsif ( $search->{'statuscode'} != 100 ) { - die "Error running VoIP Innovations getDIDs: ". - $search->{'statuscode'}. ': '. $search->{'status'}; #die?? + + my $error = "Error running VoIP Innovations getDIDs: "; + if ( $search->{'statuscode'} || $search->{'status'} ) { + $error .= $search->{'statuscode'}. ': '. $search->{'status'}. "\n"; + } else { + $error .= Dumper($search); + } + warn $error; + die $error; } my @return = (); @@ -245,8 +256,11 @@ sub get_dids { sub gp_command { my( $self, $command, @args ) = @_; - eval "use Net::GlobalPOPs::MediaServicesAPI;"; - die $@ if $@; + eval "use Net::GlobalPOPs::MediaServicesAPI 0.03;"; + if ( $@ ) { + warn $@; + die $@; + } my $gp = Net::GlobalPOPs::MediaServicesAPI->new( 'login' => $self->option('login'), @@ -354,7 +368,7 @@ sub _export_unsuspend { sub globalpops_voip_command { my($login, $password, $method, @args) = @_; - eval "use Net::GlobalPOPs::MediaServicesAPI;"; + eval "use Net::GlobalPOPs::MediaServicesAPI 0.03;"; die $@ if $@; my $gp = new Net::GlobalPOPs