Advertisement
Guest User

Perl_Perl

a guest
Nov 19th, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 3.43 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. no warnings qw(uninitialized);
  4.  
  5. use TAP3::Tap3edit;
  6. use Data::Dumper;
  7.  
  8.  
  9.  
  10. printDir(".");
  11. sub printDir{
  12. opendir(DIR, $_[0]);
  13. local(@files);
  14. local(@dirs);
  15.  (@files) = readdir(DIR);
  16.  foreach $file (@files) {
  17.     if (-f $file and substr($file,0,2) eq "CD" ) {
  18.      
  19.      
  20.      my $tap3 = TAP3::Tap3edit->new;
  21.  
  22.      my $tap_file = $file;
  23. $tap3->decode($tap_file)  or  die $tap3->error;
  24.  
  25. my $struct=$tap3->structure;
  26. my $Tracker = $struct->{'transferBatch'};
  27. if (defined $Tracker){
  28.  
  29.     my $rectag = $struct->{'transferBatch'}->{'networkInfo'}->{'recEntityInfo'};
  30.  
  31.     map { $_->{'recEntityType'} = 4 if ( $_->{'recEntityType'} > 6) } @$rectag;
  32.  
  33.     #my ($sec, $min, $hour, $mday, $mon, $year) = localtime;
  34.     #my $time = sprintf '%d%02d%02d%02d%02d%02d', 1900+$year, 1+$mon, $mday, "00", "11", "00";
  35.  
  36.     #$struct->{'transferBatch'}->{'batchControlInfo'}->{'fileAvailableTimeStamp'}->{'localTimeStamp'} ="$time";
  37.  
  38.     my $calleventtag = $struct->{'transferBatch'}->{'callEventDetails'};
  39.  
  40.     my @indexes = reverse (grep { exists $calleventtag->[$_]->{'supplServiceEvent'} } 0..$#$calleventtag);
  41.  
  42.     my $sup_event_cnt = $#indexes;
  43.  
  44.     foreach my $index (@indexes)
  45.     {
  46.     splice (@$calleventtag , $index,1);
  47.     }
  48.  
  49.     my $total_events_cnt = $struct->{'transferBatch'}->{'auditControlInfo'}->{'callEventDetailsCount'};
  50.     $struct->{'transferBatch'}->{'auditControlInfo'}->{'callEventDetailsCount'} = $total_events_cnt - $sup_event_cnt-1;
  51.  
  52.     if ( exists $struct->{'transferBatch'}->{'batchControlInfo'}->{'operatorSpecInformation'} )
  53.         {
  54.             delete $struct->{'transferBatch'}->{'batchControlInfo'}->{'operatorSpecInformation'};
  55.         }
  56.     if ( exists $struct->{'transferBatch'}->{'auditControlInfo'}->{'operatorSpecInformation'} )
  57.         {
  58.             delete $struct->{'transferBatch'}->{'auditControlInfo'}->{'operatorSpecInformation'};
  59.         }
  60.  
  61. my $key;
  62.  
  63. # Will scan all the calls for MOC's and GPRS.
  64. foreach $key ( @{$struct->{'transferBatch'}->{'callEventDetails'} } ) {
  65.  
  66.     foreach ( keys %{$key} ) {
  67.  
  68.         if ( $_ eq "mobileOriginatedCall" )
  69.         {
  70.        
  71.             if ( exists $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'destinationNetwork'} )
  72.             {
  73.                 delete $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'destinationNetwork'};
  74.             }
  75.      
  76.             if ( exists $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'}
  77.             && $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'} !~ m/^96279/
  78.             )
  79.             {
  80.                 delete $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'};
  81.             }
  82.        
  83.             if ( exists $calleventtag->[$_]->{'mobileOriginatedCall'}->{'camelServiceUsed'}  
  84.             && $calleventtag->[$_]->{'mobileOriginatedCall'}->{'camelServiceUsed'}->{'camelServiceKey'} != 80
  85.             )
  86.             {
  87.                 delete $calleventtag->[$_]->{'mobileOriginatedCall'}->{'camelServiceUsed'};
  88.             }
  89.        
  90.         }
  91.        
  92.         if ( $_ eq "gprsCall" )
  93.         {
  94.        
  95.             if ( exists $calleventtag->[$_]->{'gprsCall'}->{'gprsBasicCallInformation'}->{'gprsDestination'}->{'accessPointNameOI'} )
  96.             {
  97.                 delete $calleventtag->[$_]->{'gprsCall'}->{'gprsBasicCallInformation'}->{'gprsDestination'}->{'accessPointNameOI'};
  98.             }
  99.        
  100.         }
  101.      
  102.     }
  103. }
  104.  
  105.  
  106.     $tap3->encode("$tap_file")  or  die $tap3->error;
  107. }    
  108.      
  109.     }
  110.  
  111.  }
  112.  
  113.  closedir(DIR);
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement