diff options
Diffstat (limited to 'httemplate/REST/1.0/phone_avail')
-rw-r--r-- | httemplate/REST/1.0/phone_avail | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/httemplate/REST/1.0/phone_avail b/httemplate/REST/1.0/phone_avail new file mode 100644 index 000000000..ef9d3e7f0 --- /dev/null +++ b/httemplate/REST/1.0/phone_avail @@ -0,0 +1,25 @@ +<% encode_rest($phonenums) %>\ +<%init> + +rest_auth($cgi); + +#i'm basically a simpler misc/phonenums.cgi + +my $svcpart = $cgi->param('svcpart'); + +my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } ); +die "unknown svcpart $svcpart" unless $part_svc; + +my @exports = $part_svc->part_export_did; +if ( scalar(@exports) > 1 ) { + die "more than one DID-providing export attached to svcpart $svcpart"; +} elsif ( ! @exports ) { + die "no DID providing export attached to svcpart $svcpart"; +} +my $export = $exports[0]; + +my $phonenums = $export->get_dids( map { $_ => scalar($cgi->param($_)) } + qw( ratecenter state areacode exchange ) + ); + +</%init> |