##################################################################################################################################### # Script to remove DM-related tokens that cause log not to load into OSI due to max nested levels. # The SWIdmst and SWIphnd tokens will be replaced with SWIprst to print the relevant information ##################################################################################################################################### #!/usr/bin/perl -w use strict; use Getopt::Long; my ($help, $inputfile, $outputfile); GetOptions ('-help' => \$help, '-h' => \$help, '-input=s' => \$inputfile, '-output=s' => \$outputfile ); if ($help) { die("\nUsage: perl $0 [-help] -input -output \n"); } if ($inputfile eq "" || $outputfile eq "" ) { die("\nUsage: perl $0 [-help] -input -output \n"); } open( INPUT_FILE, "< $inputfile" ) #open input file for reading; or die( "Cannot open input file \"$inputfile\" : $!" ); open( OUTPUT_FILE, ">$outputfile" ) #open output file for writing; or die( "Cannot open output file \"$outputfile\" : $!"); #my $type = "APNM"; #my $channum = ""; #my $orgchantext = "phone.-1.mps.-1.chan"; while ( my $string = ) { chomp($string); # my $outputstring = $string; # Replace the Problematic SWIdmst and SWIdmnd with SWIprst to print the relevant information if ( $string =~ m/SWIdmst/ || $string =~ m/SWIdmnd/ || $string =~ m/SWIphst/ || $string =~ m/SWIphnd/ || $string =~ m/SWIstst/ || $string =~ m/SWIstnd/) { # print ("$string\n" ); # SWIdmst if ( $string =~ m/SWIdmst/ ) { $string =~ s/SWIdmst/SWIprst/; $string =~ s/DMTP=/PRNM=/; $string =~ s/DMNM=/PRTX=/; print (OUTPUT_FILE "$string\n" ); } # SWIphnd - use this instead of SWIdmnd since it has HYPO of DTMF if ( $string =~ m/SWIphnd/ ) { $string =~ s/SWIphnd/SWIprst/; $string =~ s/TSTT=/PRNM=/; $string =~ s/MODE=/PRTX=|UCPU".$mid; # my $newstring = $pre.">|UCPU".$mid; print (OUTPUT_FILE "$newstring\n" ); } # SWIdmnd # if ( $string =~ m/SWIdmnd/ ) { # $string =~ s/SWIdmnd/SWIprst/; # $string =~ s/TSTT=/PRNM=/; # $string =~ s/TRTT=/PRTX=/; # print (OUTPUT_FILE "$string\n" ); # } } else { print (OUTPUT_FILE "$string\n" ); } #endif } #end of WHILE; #close the Input and Output files; close( INPUT_FILE ) or die( "Cannot close \"$inputfile\" : $!" ); close( OUTPUT_FILE ) or die( "Cannot close \"$outputfile\" : $!" ); print "COMPLETE\n\n\n\n"; #####################################################################################################################################