Advertisement
Guest User

PerlPerl

a guest
Nov 19th, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 3.09 KB | None | 0 0
  1. #!/usr/bin/perl -w
  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 $calleventtag = $struct->{'transferBatch'}->{'callEventDetails'};
  34.  
  35.     my @indexes = reverse (grep { exists $calleventtag->[$_]->{'supplServiceEvent'} } 0..$#$calleventtag);
  36.  
  37.     my $sup_event_cnt = $#indexes;
  38.  
  39.     foreach my $index (@indexes)
  40.     {
  41.     splice (@$calleventtag , $index,1);
  42.     }
  43.  
  44.     my $total_events_cnt = $struct->{'transferBatch'}->{'auditControlInfo'}->{'callEventDetailsCount'};
  45.     $struct->{'transferBatch'}->{'auditControlInfo'}->{'callEventDetailsCount'} = $total_events_cnt - $sup_event_cnt-1;
  46.  
  47.     if ( exists $struct->{'transferBatch'}->{'batchControlInfo'}->{'operatorSpecInformation'} )
  48.         {
  49.             delete $struct->{'transferBatch'}->{'batchControlInfo'}->{'operatorSpecInformation'};
  50.         }
  51.     if ( exists $struct->{'transferBatch'}->{'auditControlInfo'}->{'operatorSpecInformation'} )
  52.         {
  53.             delete $struct->{'transferBatch'}->{'auditControlInfo'}->{'operatorSpecInformation'};
  54.         }
  55.  
  56.     foreach (0..$#$calleventtag)
  57.     {
  58.     # 1st next if
  59.    next if ( ! exists $calleventtag->[$_]->{'mobileOriginatedCall'});
  60.    
  61.         if ( exists $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'destinationNetwork'} )
  62.         {
  63.             delete $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'destinationNetwork'};
  64.         }
  65.      
  66.         if ( exists $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'}
  67.         && $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'} !~ m/^5519/
  68.         )
  69.         {
  70.             delete $calleventtag->[$_]->{'mobileOriginatedCall'}->{'basicCallInformation'}->{'chargeableSubscriber'}->{'simChargeableSubscriber'}->{'msisdn'};
  71.         }
  72.        
  73.         if ( exists $calleventtag->[$_]->{'mobileOriginatedCall'}->{'camelServiceUsed'}  
  74.         && $calleventtag->[$_]->{'mobileOriginatedCall'}->{'camelServiceUsed'}->{'camelServiceKey'} != 80
  75.         )
  76.         {
  77.             delete $calleventtag->[$_]->{'mobileOriginatedCall'}->{'camelServiceUsed'};
  78.         }
  79.     ## 2th next if 
  80.     next if ( ! exists $calleventtag->[$_]->{'gprsCall'});
  81.    
  82.         if ( exists $calleventtag->[$_]->{'gprsCall'}->{'gprsBasicCallInformation'}->{'gprsDestination'}->{'accessPointNameOI'} )
  83.         {
  84.             delete $calleventtag->[$_]->{'gprsCall'}->{'gprsBasicCallInformation'}->{'gprsDestination'}->{'accessPointNameOI'};
  85.         }
  86.      
  87.      
  88.     }
  89.    
  90.  
  91.     $tap3->encode("$tap_file")  or  die $tap3->error;
  92. }    
  93.      
  94.     }
  95.  
  96.  }
  97.  
  98.  closedir(DIR);
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement