summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-01-25 17:24:11 -0800
committerIvan Kohler <ivan@freeside.biz>2014-01-25 17:24:11 -0800
commit4a7d77be7b7ddf76dd9cdd674d04104ee990b0e4 (patch)
tree1a1bf95930054be5f4d0dc680c75bd8209806aaa /FS
parent761449917d3d1d7b3a2206785e702246b8b5625e (diff)
voip innovations v3.0 api, RT#25641
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_export.pm1
-rw-r--r--FS/FS/part_export/fibernetics_did.pm1
-rw-r--r--FS/FS/part_export/globalpops_voip.pm2
-rw-r--r--FS/FS/part_export/internal_diddb.pm2
-rw-r--r--FS/FS/part_export/vitelity.pm1
-rw-r--r--FS/FS/part_export/voip_innovations2.pm2
-rw-r--r--FS/FS/part_export/voip_innovations3.pm106
-rw-r--r--FS/FS/part_export/voipnow_did.pm2
-rw-r--r--FS/FS/part_svc.pm2
9 files changed, 76 insertions, 43 deletions
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