X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2Fpart_export%2Fglobalpops_voip.pm;h=fd2e93c0f0ed460f1090f87b48c4a18704ed7e8c;hb=refs%2Fheads%2FFREESIDE_2_3_BRANCH;hp=e256d6a40904d51ebbf37d2cec0b5f6e7d4dc98d;hpb=b5c4237a34aef94976bc343c8d9e138664fc3984;p=freeside.git diff --git a/FS/FS/part_export/globalpops_voip.pm b/FS/FS/part_export/globalpops_voip.pm index e256d6a40..fd2e93c0f 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); @@ -61,16 +62,27 @@ sub get_dids { my $dids = $self->gp_command('getDIDs', %getdids); - #use Data::Dumper; - #warn Dumper($dids); + if ( $dids->{'type'} eq 'Error' ) { + my $error = "Error running VoIP Innovations getDIDs: ". + $dids->{'statuscode'}. ': '. $dids->{'status'}. "\n"; + warn $error; + die $error; + } 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 = (); @@ -241,8 +253,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'), @@ -350,7 +365,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