[freeside-commits] freeside/FS/FS/part_export globalpops_voip.pm, 1.4, 1.5

Ivan,,, ivan at wavetail.420.am
Sun Jun 29 13:53:36 PDT 2008


Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv26978/FS/FS/part_export

Modified Files:
	globalpops_voip.pm 
Log Message:
globalPOPs provisioning

Index: globalpops_voip.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/globalpops_voip.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- globalpops_voip.pm	29 Jun 2008 00:41:05 -0000	1.4
+++ globalpops_voip.pm	29 Jun 2008 20:53:34 -0000	1.5
@@ -9,8 +9,9 @@
 @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 @@
 
   my $search = $dids->{'search'};
 
-  #warn Dumper($search);
-
   if ( $search->{'statuscode'} == 302200 ) {
     return [];
   } elsif ( $search->{'statuscode'} != 100 ) {
@@ -76,7 +75,6 @@
   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 _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



More information about the freeside-commits mailing list