summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2008-06-29 20:53:34 +0000
committerivan <ivan>2008-06-29 20:53:34 +0000
commit8a7aeda3fe2c178b0c492401adc6bf6afe47ec67 (patch)
treed434525178b00708cb519e18bc61591e9705b54d
parent2d87f8d18a809c672fbd4d05dacf04efd9bbe621 (diff)
globalPOPs provisioning
-rw-r--r--FS/FS/part_export/globalpops_voip.pm58
-rw-r--r--FS/FS/svc_phone.pm4
-rw-r--r--httemplate/elements/select-phonenum.html2
-rw-r--r--httemplate/elements/tr-select-did.html2
4 files changed, 59 insertions, 7 deletions
diff --git a/FS/FS/part_export/globalpops_voip.pm b/FS/FS/part_export/globalpops_voip.pm
index 49bc2152f..4213bd1d1 100644
--- a/FS/FS/part_export/globalpops_voip.pm
+++ b/FS/FS/part_export/globalpops_voip.pm
@@ -9,8 +9,9 @@ use FS::phone_avail;
@ISA = qw(FS::part_export);
tie my %options, 'Tie::IxHash',
- 'login' => { label=>'GlobalPOPs Media Services API login' },
- 'password' => { label=>'GlobalPOPs Media Services API password' },
+ 'login' => { label=>'GlobalPOPs Media Services API login' },
+ 'password' => { label=>'GlobalPOPs Media Services API password' },
+ 'endpointgroup' => { label=>'GlobalPOPs endpoint group number' },
;
%info = (
@@ -64,8 +65,6 @@ sub get_dids {
my $search = $dids->{'search'};
- #warn Dumper($search);
-
if ( $search->{'statuscode'} == 302200 ) {
return [];
} elsif ( $search->{'statuscode'} != 100 ) {
@@ -76,7 +75,6 @@ sub get_dids {
my @return = ();
#my $latas = $search->{state}{lata};
-
my %latas;
if ( grep $search->{state}{lata}{$_}, qw(name rate_center) ) {
%latas = map $search->{state}{lata}{$_},
@@ -256,26 +254,74 @@ sub gp_command {
sub _export_insert {
my( $self, $svc_phone ) = (shift, shift);
#we want to provision and catch errors now, not queue
+
+ my $r = $self->gp_command('reserveDID',
+ 'did' => $svc_phone->phonenum,
+ 'minutes' => 1,
+ 'endpointgroup' => $self->option('endpointgroup'),
+ );
+
+ my $rdid = $r->{did};
+
+ if ( $rdid->{'statuscode'} != 100 ) {
+ return "Error running globalpop reserveDID: ".
+ $rdid->{'statuscode'}. ': '. $rdid->{'status'};
+ }
+
+ my $a = $self->gp_command('assignDID',
+ 'did' => $svc_phone->phonenum,
+ 'endpointgroup' => $self->option('endpointgroup'),
+ #'rewrite'
+ #'cnam'
+ );
+
+ my $adid = $a->{did};
+
+ if ( $adid->{'statuscode'} != 100 ) {
+ return "Error running globalpop assignDID: ".
+ $adid->{'statuscode'}. ': '. $adid->{'status'};
+ }
+
+ '';
}
sub _export_replace {
my( $self, $new, $old ) = (shift, shift, shift);
+
#hmm, what's to change?
+ '';
}
sub _export_delete {
my( $self, $svc_phone ) = (shift, shift);
- #probably okay to queue the deletion...
+
+ #probably okay to queue the deletion...?
+ #but hell, let's do it inline anyway, who wants phone numbers hanging around
+
+ my $r = $self->gp_command('releaseDID',
+ 'did' => $svc_phone->phonenum,
+ );
+
+ my $rdid = $r->{did};
+
+ if ( $rdid->{'statuscode'} != 100 ) {
+ return "Error running globalpop releaseDID: ".
+ $rdid->{'statuscode'}. ': '. $rdid->{'status'};
+ }
+
+ '';
}
sub _export_suspend {
my( $self, $svc_phone ) = (shift, shift);
#nop for now
+ '';
}
sub _export_unsuspend {
my( $self, $svc_phone ) = (shift, shift);
#nop for now
+ '';
}
#hmm, might forgo queueing entirely for most things, data is too much of a pita
diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm
index 90ba24945..7622e9887 100644
--- a/FS/FS/svc_phone.pm
+++ b/FS/FS/svc_phone.pm
@@ -162,6 +162,10 @@ and replace methods.
sub check {
my $self = shift;
+ my $phonenum = $self->phonenum;
+ $phonenum =~ s/\D//g;
+ $self->phonenum($phonenum);
+
my $error =
$self->ut_numbern('svcnum')
|| $self->ut_numbern('countrycode')
diff --git a/httemplate/elements/select-phonenum.html b/httemplate/elements/select-phonenum.html
index 99ddafc42..b98d140e4 100644
--- a/httemplate/elements/select-phonenum.html
+++ b/httemplate/elements/select-phonenum.html
@@ -71,7 +71,7 @@
<DIV ID="phonenumerror" STYLE="display:none"><IMG SRC="<%$fsurl%>images/cross.png"> <B>Select a different city/exchange</B></DIV>
-<SELECT NAME="<% $opt{'prefix'} %>phonenum" onChange="<% $opt{'prefix'} %>phonenum_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>>
+<SELECT NAME="<% $opt{'prefix'} %>phonenum" notonChange="<% $opt{'prefix'} %>phonenum_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>>
<OPTION VALUE="">Select phone number</OPTION>
</SELECT>
diff --git a/httemplate/elements/tr-select-did.html b/httemplate/elements/tr-select-did.html
index 29c5bb7dd..c78403345 100644
--- a/httemplate/elements/tr-select-did.html
+++ b/httemplate/elements/tr-select-did.html
@@ -3,6 +3,8 @@
% if ( $opt{'curr_value'} ne '' ) {
<TD BGCOLOR="#dddddd" <% $cell_style %>><% $opt{'formatted_value'} || $opt{'curr_value'} || $opt{'value'} |h %></TD>
+
+ <% include('hidden.html', %opt ) %>
% } else {