1 <% objToJson(\@exchanges) %>
4 my( $exchangestring, $svcpart ) = $cgi->param('arg');
6 my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } );
7 die "unknown svcpart $svcpart" unless $part_svc;
9 my @exports = $part_svc->part_export_did;
10 if ( scalar(@exports) > 1 ) {
11 die "more than one DID-providing export attached to svcpart $svcpart";
12 } elsif ( ! @exports ) {
13 die "no DID providing export attached to svcpart $svcpart";
15 my $export = $exports[0];
18 if ( $exchangestring eq 'tollfree' ) {
19 $opts{'tollfree'} = 1;
21 elsif ( $exchangestring =~ /^([\w\s]+), ([A-Z][A-Z])$/ ) {
22 $opts{'ratecenter'} = $1;
26 $exchangestring =~ /\((\d{3})-(\d{3})-XXXX\)\s*$/i
27 or die "unparsable exchange: $exchangestring";
28 my( $areacode, $exchange ) = ( $1, $2 );
29 $opts{'areacode'} = $areacode;
30 $opts{'exchange'} = $exchange;
33 my $something = $export->get_dids(%opts);
34 my @exchanges = @{ $something };