diff options
author | levinse <levinse> | 2011-01-10 19:46:13 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-01-10 19:46:13 +0000 |
commit | 3aae44e96b429d182a7e36cf0ebb0d4bfef842d9 (patch) | |
tree | de0cc61e48ff0973c13c8e4dbe2380994d4a4135 /httemplate/misc | |
parent | 9a46dd94e70887c5365c4b10d9db0d1b7f1b71ab (diff) |
vitelity API improvements for toll-free and fax, RT11009
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/phonenums.cgi | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/httemplate/misc/phonenums.cgi b/httemplate/misc/phonenums.cgi index 2ed0f617d..b86d03f5d 100644 --- a/httemplate/misc/phonenums.cgi +++ b/httemplate/misc/phonenums.cgi @@ -1,12 +1,8 @@ -%# [ <% join(', ', map { qq("$_") } @exchanges) %> ] <% objToJson(\@exchanges) %> <%init> my( $exchangestring, $svcpart ) = $cgi->param('arg'); -$exchangestring =~ /\((\d{3})-(\d{3})-XXXX\)\s*$/i - or die "unparsable exchange: $exchangestring"; -my( $areacode, $exchange ) = ( $1, $2 ); my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } ); die "unknown svcpart $svcpart" unless $part_svc; @@ -18,12 +14,19 @@ if ( scalar(@exports) > 1 ) { } my $export = $exports[0]; -my $something = $export->get_dids('areacode'=>$areacode, - 'exchange'=>$exchange, - ); - -#warn Dumper($something); +my %opts = (); +if ( $exchangestring eq 'tollfree' ) { + $opts{'tollfree'} = 1; +} +else { + $exchangestring =~ /\((\d{3})-(\d{3})-XXXX\)\s*$/i + or die "unparsable exchange: $exchangestring"; + my( $areacode, $exchange ) = ( $1, $2 ); + $opts{'areacode'} = $areacode; + $opts{'exchange'} = $exchange; +} +my $something = $export->get_dids(%opts); my @exchanges = @{ $something }; </%init> |