+sub _export_delete {
+ my($self, $svc_x) = (shift, shift);
+ #my( $self, $svc_something ) = (shift, shift);
+ #$err_or_queue = $self->thirdlane_queue( $svc_something->svcnum,
+ # 'delete', $svc_something->username );
+ #ref($err_or_queue) ? '' : $err_or_queue;
+
+ if ( $svc_x->isa('FS::svc_pbx') ) {
+
+ my $result = $self->_thirdlane_command( 'asterisk::rpc_tenant_delete',
+ $svc_x->title,
+ );
+
+ #use Data::Dumper;
+ #warn Dumper(\$result);
+ #$result eq '0' ? '' : 'Thirdlane API failure (rpc_tenant_delete)';
+ warn "Thirdlane API failure (rpc_tenant_delete); deleting anyway\n"
+ if $result ne '0';
+ '';
+
+ } elsif ( $svc_x->isa('FS::svc_phone') ) {
+
+ if ( $svc_x->pbxsvc ) {
+ my $result = $self->_thirdlane_command(
+ 'asterisk::rpc_did_unassign',
+ $self->_thirdlane_did($svc_x),
+ );
+ $result eq '0' or return 'Thirdlane API failure (rpc_did_unassign)';
+ }
+
+ my $result = $self->_thirdlane_command(
+ 'asterisk::rpc_did_delete',
+ $self->_thirdlane_did($svc_x),
+ );
+ $result eq '0' ? '' : 'Thirdlane API failure (rpc_did_delete)';
+
+ } elsif ( $svc_x->isa('FS::svc_acct') ) {
+
+ return '' unless $svc_x->pbxsvc; #error out? nah
+
+ my $result = $self->_thirdlane_command(
+ 'asterisk::rpc_admin_delete',
+ $svc_x->username,
+ $svc_x->pbx_title,
+ );
+
+ #use Data::Dumper;
+ #warn Dumper(\$result);
+ #$result eq '0' ? '' : 'Thirdlane API failure (rpc_admin_delete)';
+ warn "Thirdlane API failure (rpc_admin_delete); deleting anyway\n"
+ if $result ne '0';
+ '';
+
+ } else {
+ die "guru meditation #12: $svc_x is not FS::svc_pbx, FS::svc_phone or FS::svc_acct";
+ }
+
+}