X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fbandwidth_com.pm;h=b39bffb69747ceff33314ace1c6dc26b51879464;hb=ffa18709ee8a4d05e18d2d406cf73afe79e52524;hp=6c69fe35609f0f20e63c002652a0b8f77c3f3207;hpb=bfb8d2494cf4a9530257d5fb7615fe6edaa4ad82;p=freeside.git diff --git a/FS/FS/part_export/bandwidth_com.pm b/FS/FS/part_export/bandwidth_com.pm index 6c69fe356..b39bffb69 100644 --- a/FS/FS/part_export/bandwidth_com.pm +++ b/FS/FS/part_export/bandwidth_com.pm @@ -56,10 +56,20 @@ with this IP address exists, one will be created.

If you are operating a central SIP gateway to receive traffic for all (or a subset of) customers, you should configure a phone service with a fixed value, or a list of fixed values, for the sip_server field.

+

To find your account ID and site ID: +

+

END ); -sub export_insert { +sub _export_insert { my($self, $svc_phone) = (shift, shift); local $SIG{__DIE__}; try { @@ -90,7 +100,7 @@ sub export_insert { }; } -sub export_replace { +sub _export_replace { my ($self, $new, $old) = @_; # we only export the IP address and the phone number, # neither of which we can change in place. @@ -101,7 +111,7 @@ sub export_replace { ''; } -sub export_delete { +sub _export_delete { my ($self, $svc_phone) = (shift, shift); local $SIG{__DIE__}; try { @@ -151,43 +161,46 @@ sub can_get_dids { 1 } sub get_dids_npa_select { 1 } sub get_dids { - local $SIG{__DIE__}; my $self = shift; my %opt = @_; my ($exportnum) = $self->exportnum =~ /^(\d+)$/; - return [] if $opt{'tollfree'}; # we'll come back to this + try { + return [] if $opt{'tollfree'}; # we'll come back to this - my ($state, $npa, $nxx) = @opt{'state', 'areacode', 'exchange'}; + my ($state, $npa, $nxx) = @opt{'state', 'areacode', 'exchange'}; - if ( $nxx ) { + if ( $nxx ) { - die "areacode required\n" unless $npa; - my $limit = $self->option('num_dids') || 20; - my $result = $self->api_get('availableNumbers', [ - 'npaNxx' => $npa.$nxx, - 'quantity' => $limit, - 'LCA' => 'false', - # find only those that match the NPA-NXX, not those thought to be in - # the same local calling area. though that might be useful. - ]); - return [ $result->findnodes('//TelephoneNumber')->to_literal_list ]; + die "areacode required\n" unless $npa; + my $limit = $self->option('num_dids') || 20; + my $result = $self->api_get('availableNumbers', [ + 'npaNxx' => $npa.$nxx, + 'quantity' => $limit, + 'LCA' => 'false', + # find only those that match the NPA-NXX, not those thought to be in + # the same local calling area. though that might be useful. + ]); + return [ $result->findnodes('//TelephoneNumber')->to_literal_list ]; - } elsif ( $npa ) { + } elsif ( $npa ) { - return $self->npanxx_cache($npa); + return $self->npanxx_cache($npa); - } elsif ( $state ) { + } elsif ( $state ) { - return $self->npa_cache($state); + return $self->npa_cache($state); - } else { # something's wrong + } else { # something's wrong - warn "get_dids called with no arguments"; - return []; + warn "get_dids called with no arguments"; + return []; + } + } catch { + die "$me $_\n"; } }