[freeside-commits] branch master updated. d7b759d8d95114f5bc9acc3cf9666eaccbd4bfd8

Ivan ivan at 420.am
Sat Jan 25 17:25:40 PST 2014


The branch, master has been updated
       via  d7b759d8d95114f5bc9acc3cf9666eaccbd4bfd8 (commit)
       via  4a7d77be7b7ddf76dd9cdd674d04104ee990b0e4 (commit)
      from  6a8d32d234af6e667ca58c2a625741c2385d6f0b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d7b759d8d95114f5bc9acc3cf9666eaccbd4bfd8
Merge: 4a7d77b 6a8d32d
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Jan 25 17:25:36 2014 -0800

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit 4a7d77be7b7ddf76dd9cdd674d04104ee990b0e4
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Jan 25 17:24:11 2014 -0800

    voip innovations v3.0 api, RT#25641

diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm
index 8b16248..8e10ea7 100644
--- a/FS/FS/part_export.pm
+++ b/FS/FS/part_export.pm
@@ -680,6 +680,7 @@ sub info {
 }
 
 #default fallbacks... FS::part_export::DID_Common ?
+sub can_get_dids { 0; }
 sub get_dids_can_tollfree { 0; }
 sub get_dids_can_manual   { 0; }
 sub get_dids_can_edit     { 0; } #don't use without can_manual, otherwise the
diff --git a/FS/FS/part_export/fibernetics_did.pm b/FS/FS/part_export/fibernetics_did.pm
index a51457a..9fd9968 100644
--- a/FS/FS/part_export/fibernetics_did.pm
+++ b/FS/FS/part_export/fibernetics_did.pm
@@ -27,6 +27,7 @@ tie my %options, 'Tie::IxHash',
 
 sub rebless { shift; }
 
+sub can_get_dids { 1; }
 sub get_dids_can_tollfree { 0; };
 sub get_dids_can_manual   { 1; };
 sub get_dids_can_edit     { 1; };
diff --git a/FS/FS/part_export/globalpops_voip.pm b/FS/FS/part_export/globalpops_voip.pm
index 59e0bc4..5eee13f 100644
--- a/FS/FS/part_export/globalpops_voip.pm
+++ b/FS/FS/part_export/globalpops_voip.pm
@@ -30,6 +30,8 @@ END
 
 sub rebless { shift; }
 
+sub can_get_dids { 1; }
+
 sub get_dids {
   my $self = shift;
   my %opt = ref($_[0]) ? %{$_[0]} : @_;
diff --git a/FS/FS/part_export/internal_diddb.pm b/FS/FS/part_export/internal_diddb.pm
index b51f631..bb97433 100644
--- a/FS/FS/part_export/internal_diddb.pm
+++ b/FS/FS/part_export/internal_diddb.pm
@@ -22,6 +22,8 @@ tie my %options, 'Tie::IxHash',
 
 sub rebless { shift; }
 
+sub can_get_dids { 1; }
+
 sub get_dids {
   my $self = shift;
   my %opt = ref($_[0]) ? %{$_[0]} : @_;
diff --git a/FS/FS/part_export/vitelity.pm b/FS/FS/part_export/vitelity.pm
index 3c0534f..4f73d62 100644
--- a/FS/FS/part_export/vitelity.pm
+++ b/FS/FS/part_export/vitelity.pm
@@ -39,6 +39,7 @@ END
 
 sub rebless { shift; }
 
+sub can_get_dids { 1; }
 sub get_dids_can_tollfree { 1; };
 
 sub get_dids {
diff --git a/FS/FS/part_export/voip_innovations2.pm b/FS/FS/part_export/voip_innovations2.pm
index 87a77c2..af6825c 100644
--- a/FS/FS/part_export/voip_innovations2.pm
+++ b/FS/FS/part_export/voip_innovations2.pm
@@ -35,6 +35,8 @@ END
 
 sub rebless { shift; }
 
+sub can_get_dids { 1; }
+
 sub get_dids {
   my $self = shift;
   my %opt = ref($_[0]) ? %{$_[0]} : @_;
diff --git a/FS/FS/part_export/voip_innovations3.pm b/FS/FS/part_export/voip_innovations3.pm
index 630d0c4..3e4a1fe 100644
--- a/FS/FS/part_export/voip_innovations3.pm
+++ b/FS/FS/part_export/voip_innovations3.pm
@@ -49,13 +49,13 @@ sub vi_command {
     die $@;
   }
 
-  my $gp = Net::VoIP_Innovations->new(
+  my $vi = Net::VoIP_Innovations->new(
     'login'    => $self->option('login'),
     'password' => $self->option('password'),
     #'debug'    => $debug,
   );
 
-  $gp->$command(@args);
+  $vi->$command(@args);
 }
 
 
@@ -68,6 +68,8 @@ sub _export_insert {
 
   unless ( $self->option('no_provision_did') ) {
 
+    return "can't yet provision to VoIP Innovations v3 API"; #XXX
+
     ###
     # reserveDID
     ###
@@ -106,31 +108,29 @@ sub _export_insert {
   }
 
   ###
-  # 911Insert
+  # insert911
   ###
 
   if ( $self->option('e911') ) {
 
     my %location_hash = $svc_phone->location_hash;
     my( $zip, $plus4 ) = split('-', $location_hash->{zip});
-    my $e = $self->vi_command('911Insert',
+    my $resp = $self->vi_command('insert911',
       'did'        => $svc_phone->phonenum,
-      'Address1'   => $location_hash{address1},
-      'Address2'   => $location_hash{address2},
-      'City'       => $location_hash{city},
-      'State'      => $location_hash{state},
-      'ZipCode'    => $zip,
-      'PlusFour'   => $plus4,
-      'CallerName' =>
+      'address1'   => $location_hash{address1},
+      'address2'   => $location_hash{address2},
+      'city'       => $location_hash{city},
+      'state'      => $location_hash{state},
+      'zip'        => $zip,
+      'plusFour'   => $plus4,
+      'callerName' =>
         $svc_phone->phone_name
           || $svc_phone->cust_svc->cust_pkg->cust_main->contact_firstlast,
     );
 
-    my $edid = $e->{did};
-
-    if ( $edid->{'statuscode'} != 100 ) {
-      return "Error running VoIP Innovations 911Insert: ".
-             $edid->{'statuscode'}. ': '. $edid->{'status'};
+    if ( $resp->{'responseCode'} != 100 ) {
+      return "Error running VoIP Innovations insert911: ".
+             $resp->{'responseCode'}. ': '. $resp->{'responseMessage'};
     }
 
   }
@@ -149,26 +149,24 @@ sub _export_replace {
 
   if ( $self->option('e911') ) {
 
-    my %location_hash = $svc_phone->location_hash;
+    my %location_hash = $new->location_hash;
     my( $zip, $plus4 ) = split('-', $location_hash->{zip});
-    my $e = $self->vi_command('911Update',
+    my $resp = $self->vi_command('update911',
       'did'        => $svc_phone->phonenum,
-      'Address1'   => $location_hash{address1},
-      'Address2'   => $location_hash{address2},
-      'City'       => $location_hash{city},
-      'State'      => $location_hash{state},
-      'ZipCode'    => $zip,
-      'PlusFour'   => $plus4,
-      'CallerName' =>
+      'address1'   => $location_hash{address1},
+      'address2'   => $location_hash{address2},
+      'city'       => $location_hash{city},
+      'state'      => $location_hash{state},
+      'zip'        => $zip,
+      'plusFour'   => $plus4,
+      'callerName' =>
         $svc_phone->phone_name
           || $svc_phone->cust_svc->cust_pkg->cust_main->contact_firstlast,
     );
 
-    my $edid = $e->{did};
-
-    if ( $edid->{'statuscode'} != 100 ) {
-      return "Error running VoIP Innovations 911Update: ".
-             $edid->{'statuscode'}. ': '. $edid->{'status'};
+    if ( $resp->{'responseCode'} != 100 ) {
+      return "Error running VoIP Innovations update911: ".
+             $resp->{'responseCode'}. ': '. $resp->{'responseMessage'};
     }
 
   }
@@ -179,24 +177,48 @@ sub _export_replace {
 sub _export_delete {
   my( $self, $svc_phone ) = (shift, shift);
 
-  return '' if $self->option('dry_run')
-            || $self->option('no_provision_did');
+  return '' if $self->option('dry_run');
 
-  #probably okay to queue the deletion...?
-  #but hell, let's do it inline anyway, who wants phone numbers hanging around
+  ###
+  # releaseDID
+  ###
 
-  my $r = $self->vi_command('releaseDID',
-    'did'           => $svc_phone->phonenum,
-  );
+  unless ( $self->option('no_provision_did') ) {
+
+    return "can't yet provision to VoIP Innovations v3 API"; #XXX
+
+    #probably okay to queue the deletion...?
+    #but hell, let's do it inline anyway, who wants phone numbers hanging around
+
+    my $r = $self->vi_command('releaseDID',
+      'did'           => $svc_phone->phonenum,
+    );
+
+    my $rdid = $r->{did};
 
-  my $rdid = $r->{did};
+    if ( $rdid->{'statuscode'} != 100 ) {
+      return "Error running VoIP Innovations releaseDID: ".
+             $rdid->{'statuscode'}. ': '. $rdid->{'status'};
+    }
 
-  if ( $rdid->{'statuscode'} != 100 ) {
-    return "Error running VoIP Innovations releaseDID: ".
-           $rdid->{'statuscode'}. ': '. $rdid->{'status'};
   }
 
-  #delete e911 information?  assuming release clears all that
+  ###
+  # remove911
+  ###
+
+  if ( $self->option('e911') ) {
+
+    my $resp = $self->vi_command('remove911',
+      'did'        => $svc_phone->phonenum,
+    );
+
+    if ( $resp->{'responseCode'} != 100 ) {
+      return "Error running VoIP Innovations remove911: ".
+             $resp->{'responseCode'}. ': '. $resp->{'responseMessage'};
+    }
+
+  }
 
   '';
 }
diff --git a/FS/FS/part_export/voipnow_did.pm b/FS/FS/part_export/voipnow_did.pm
index 514db8d..1e15369 100644
--- a/FS/FS/part_export/voipnow_did.pm
+++ b/FS/FS/part_export/voipnow_did.pm
@@ -44,6 +44,8 @@ sub did_cache {
   return $CACHE->get($self->exportnum) || $self->reload_cache;
 }
  
+sub can_get_dids { 1; }
+
 sub get_dids {
   my $self = shift;
   my %opt = @_;
diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm
index 27f0063..01f3034 100644
--- a/FS/FS/part_svc.pm
+++ b/FS/FS/part_svc.pm
@@ -480,7 +480,7 @@ are capable of returing available DID (phone number) information.
 
 sub part_export_did {
   my $self = shift;
-  grep $_->can('get_dids'), $self->part_export;
+  grep $_->can_get_dids, $self->part_export;
 }
 
 =item part_export_dsl_pull

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_export.pm                   |    1 +
 FS/FS/part_export/fibernetics_did.pm   |    1 +
 FS/FS/part_export/globalpops_voip.pm   |    2 +
 FS/FS/part_export/internal_diddb.pm    |    2 +
 FS/FS/part_export/vitelity.pm          |    1 +
 FS/FS/part_export/voip_innovations2.pm |    2 +
 FS/FS/part_export/voip_innovations3.pm |  106 +++++++++++++++++++-------------
 FS/FS/part_export/voipnow_did.pm       |    2 +
 FS/FS/part_svc.pm                      |    2 +-
 9 files changed, 76 insertions(+), 43 deletions(-)




More information about the freeside-commits mailing list