1 <% encode_json(\@phonenums) %>\
4 my( $exchangestring, $svcpart ) = $cgi->param('arg');
6 my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
7 die "unknown svcpart $svcpart" unless $part_svc;
11 if ( $exchangestring ) {
13 my @exports = $part_svc->part_export_did;
14 if ( scalar(@exports) > 1 ) {
15 die "more than one DID-providing export attached to svcpart $svcpart";
16 } elsif ( ! @exports ) {
17 die "no DID providing export attached to svcpart $svcpart";
19 my $export = $exports[0];
22 if ( $exchangestring eq 'tollfree' ) {
23 $opts{'tollfree'} = 1;
24 } elsif ( $exchangestring =~ /^_REGION (.*)$/ ) {
26 #} elsif ( $exchangestring =~ /^([\w\s\:\,\(\)\-]+), ([A-Z][A-Z])$/ ) {
27 } elsif ( $exchangestring =~ /^(.+), ([A-Z][A-Z])$/ ) {
28 $opts{'ratecenter'} = $1;
31 $exchangestring =~ /\((\d{3})-(\d{3})-XXXX\)\s*$/i
32 or die "unparsable exchange: $exchangestring";
33 my( $areacode, $exchange ) = ( $1, $2 );
34 $opts{'areacode'} = $areacode;
35 $opts{'exchange'} = $exchange;
38 my $something = $export->get_dids(%opts);
39 @phonenums = @{ $something };