<P>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.</P>
+<P>To find your account ID and site ID:
+ <UL>
+ <LI>Login to <a target="_blank" href="https://dashboard.bandwidth.com">the Dashboard.
+ </a></LI>
+ <LI>Under "Your subaccounts", find the subaccount (site) that you want to use
+ for exported DIDs. Click the "manage sub-account" link.</LI>
+ <LI>Look at the URL. It will end in <i>{"a":xxxxxxx,"s":yyyy}</i>.</LI>
+ <LI>Your account ID is <i>xxxxxxx</i>, and the site ID is <i>yyyy</i>.</LI>
+ </UL>
+</P>
END
);
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";
}
}
$self->{_host} ||= do {
my $host = 'dashboard.bandwidth.com';
$host = "test.$host" if $self->option('test');
+ $host;
};
}