#!/usr/bin/perl -w #SMDR Record Script use strict; my $datemin; my $datemax; my $timemin; my $timemax; my $choice; my $msisdn; my $range; my $rangex; my $SIG; my %TOC; my %DC; my %PAC; %TOC = ( 'DID' => "Digit Feed Recieved", 'ETE' => "No digit feed/caller enters mailbox number", 'ODL' => "Outidal Delivery", 'ODN' => "Outdial Notification", 'DEP' => "Deposit Only", 'RET' => "Retrieval Only", 'SMD' => "SMDI serially integrated trunk", 'PAG' => "Page delivery", 'ISI' => "Infoserv Recording", 'TAS' => "TAS Call", 'TTT' => "Trunk to trunk transfer", 'PBX' => "PBX type transfer", 'CMC' => "Constant Touch", 'CMO' => "Constant Touch Outdial notification" ); %DC = ( '00' => "Timeout waiting for command", '01' => "Hang up or log off", '02' => "DTMF 're-id' entered", '03' => "DTMF 'operator revert' entered", '04' => "DTMF 'call transfer' entered", '05' => "Successful Outdial", '06' => "No Answer/busy outdial", '07' => "Not Implemented", '08' => "Hardware or System problem", '09' => "Call terminated by system manager", '10' => "Too many subscriber errors", '11' => "Unidentified caller sent urgent message", '12' => "Outdial page fails", '13' => "Outdial page success", '14' => "Leave system from trunk to trunk transfer", '15' => "Not Implemented", '16' => "Fax Transmission Fails", '17' => "Subscriber sent Constant Touch caller to voice mail" ); %PAC = ( '00' => "Answer and play greeting", '01' => "Entered mailbox number and left message", '02' => "Entered user name and left message", '03' => "Entered mailbox number/password for access", '04' => "Not Implemented", '05' => "Not Implemented", '06' => "Outdial to deliver message", '07' => "Outdial for message Notification", '08' => "Invalid mailbox number or name", '09' => "Invalid Security Code", '10' => "System problem prevented access", '11' => "Outdial Page", '12' => "Called, left a message and callback page", '13' => "Called and left Page" ); print "Your Options Are:\n"; print "\n"; print "Search by Start Date = 'd'\n"; print "Search by Start Time = 't'\n"; print "Search by VM Mailbox Number = 'v'\n"; print "Search by Start Date & Time = 'b'\n"; print "Quit Search Utility? = 'q'\n"; print "\n"; do { print "Select Your Option:> (d, t, v, b, q)"; #Choose a letter chomp($choice = ); } until ($choice =~ /^[DdTtVvBbQq]/); if ($choice =~ /^[Dd]/) { print "Enter Date in Form:(01/11/19-01/11/22)\n"; $range = ; ($datemin, $datemax) = split /-/, $range; #Squeeze out leading and trailing spaces $datemin =~ s/^\s+//; $datemin =~ s/\s+$//; $datemax =~ s/^\s+//; $datemax =~ s/\s+$//; print "Begin Date: $datemin-End Date: $datemax\n"; print "Matches\n-------\n"; open(FILE, "/home/dhagens/MVP.dump.capture.file"); while () { my @matched = /(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d{2}\/\d{2}\/\d{2})\s(\d{2}\:\d{2}\:\d{2})\s(\d+)\s(\S+)\s(\d+)\s(\d+)\s(\d{2}\:\d{2}\:\d{2})\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\w+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\S+)/; if (@matched) { $matched[1] = "*System ID String($matched[1])*"; $matched[5] = "*Call Start Time:($matched[5])*"; $matched[6] = "*Primary Activity Code:($PAC{$matched[6]})*"; $matched[7] = "*Mailbox number of sender or subscriber:($matched[7])*"; $matched[9] = "*Disconnect Code:($DC{$matched[9]})*"; $matched[10] = "*Elapsed Time of Call:($matched[10])*"; $matched[11] = "*Number of Messages Received:($matched[11])*"; $matched[12] = "*Number of Messages Sent:($matched[12])*"; $matched[15] = "*Type of Call:($TOC{$matched[15]})*"; if (($matched[4] ge $datemin) && ($matched[4] le $datemax)) { $matched[4] = "*Start Date of Call:($matched[4])*"; print join( ' ', @matched ), "\n\n"; } } } } if ($choice =~ /^[Tt]/) { print "Enter Time in Form:(00:00:40-00:00:50)\n"; $rangex = ; ($timemin, $timemax) = split /-/, $rangex; # Squeeze out leading and trailing spaces $timemin =~ s/^\s+//; $timemin =~ s/\s+$//; $timemax =~ s/^\s+//; $timemax =~ s/\s+$//; print "Begin Time: $timemin-End Time: $timemax\n"; print "Matches\n-------\n"; open(FILE, "/home/dhagens/MVP.dump.capture.file"); while () { my @matched = /(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d{2}\/\d{2}\/\d{2})\s(\d{2}\:\d{2}\:\d{2})\s(\d+)\s(\S+)\s(\d+)\s(\d+)\s(\d{2}\:\d{2}\:\d{2})\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\w+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\S+)/; if (@matched) { $matched[1] = "*System ID String($matched[1])*"; $matched[4] = "*Start Date of Call:($matched[4])*"; $matched[6] = "*Primary Activity Code:($PAC{$matched[6]})*"; $matched[7] = "*Mailbox number of sender or subscriber:($matched[7])*"; $matched[9] = "*Disconnect Code:($DC{$matched[9]})*"; $matched[10] = "*Elapsed Time of Call:($matched[10])*"; $matched[11] = "*Number of Messages Received:($matched[11])*"; $matched[12] = "*Number of Messages Sent:($matched[12])*"; $matched[15] = "*Type of Call:($TOC{$matched[15]})*"; if (($matched[5] ge $timemin) && ($matched[5] le $timemax)) { $matched[5] = "*Call Start Time:($matched[5])*"; print join( ' ', @matched ), "\n\n"; } } } } elsif ($choice =~ /^[Vv]/) { print "Enter VM Number in Form:(92a7a77248)zeros will be a's\n"; chomp($msisdn = ); print "Matches\n-------\n"; open(FILE, "/home/dhagens/MVP.dump.capture.file"); while () { my @matched = /(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d{2}\/\d{2}\/\d{2})\s(\d{2}\:\d{2}\:\d{2})\s(\d+)\s(\S+)\s(\d+)\s(\d+)\s(\d{2}\:\d{2}\:\d{2})\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\w+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\S+)/; if (@matched) { $matched[1] = "*System ID String($matched[1])*"; $matched[4] = "*Start Date of Call:($matched[4])*"; $matched[5] = "*Call Start Time:($matched[5])*"; $matched[6] = "*Primary Activity Code:($PAC{$matched[6]})*"; $matched[9] = "*Disconnect Code:($DC{$matched[9]})*"; $matched[10] = "*Elapsed Time of Call:($matched[10])*"; $matched[11] = "*Number of Messages Received:($matched[11])*"; $matched[12] = "*Number of Messages Sent:($matched[12])*"; $matched[15] = "*Type of Call:($TOC{$matched[15]})*"; if ($matched[7] =~ $msisdn) { $matched[7] = "*Mailbox number of sender or subscriber:($matched[7])*"; print join( ' ', @matched ), "\n\n"; } } } } elsif ($choice =~ /^[Bb]/) { print "Enter Date in Form:(01/11/19-01/11/22)\n"; $range = ; print "Enter Time in Form:(00:00:40-00:00:50)\n"; $rangex = ; # Break up the range ($datemin, $datemax) = split /-/, $range; ($timemin, $timemax) = split /-/, $rangex; # Squeeze out leading and trailing spaces $datemin =~ s/^\s+//; $datemin =~ s/\s+$//; $timemin =~ s/^\s+//; $timemin =~ s/\s+$//; $datemax =~ s/^\s+//; $datemax =~ s/\s+$//; $timemax =~ s/^\s+//; $timemax =~ s/\s+$//; print "Begin Date: $datemin-End Date: $datemax\n"; print "Begin Time: $timemin-End Time: $timemax\n"; print "Matches\n-------\n"; open(FILE, "/home/dhagens/MVP.dump.capture.file"); while () { my @matched = /(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d{2}\/\d{2}\/\d{2})\s(\d{2}\:\d{2}\:\d{2})\s(\d+)\s(\S+)\s(\d+)\s(\d+)\s(\d{2}\:\d{2}\:\d{2})\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\w+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\d+)\s(\S+)/; if (@matched) { $matched[1] = "*System ID String($matched[1])*"; $matched[6] = "*Primary Activity Code:($PAC{$matched[6]})*"; $matched[9] = "*Disconnect Code:($DC{$matched[9]})*"; $matched[10] = "*Elapsed Time of Call:($matched[10])*"; $matched[11] = "*Number of Messages Received:($matched[11])*"; $matched[12] = "*Number of Messages Sent:($matched[12])*"; $matched[15] = "*Type of Call:($TOC{$matched[15]})*"; if (($matched[4] ge $datemin) && ($matched[4] le $datemax) && ($matched[5] ge $timemin) && ($matched[5] le $timemax)) { $matched[4] = "*Start Date of Call:($matched[4])*"; $matched[5] = "*Call Start Time:($matched[5])*"; print join( ' ', @matched ), "\n\n"; } } } } elsif ($choice =~ /^[Qq]/) { $SIG{INT}; }