$event_type = "EventEstablished"; $dir= $ARGV[0] || "."; opendir(DIR, "$dir"); while($name = readdir(DIR)) { ##Put the names in an array, latest files 1st print "puting name = $name in the array\n"; unshift(@files, $name); } closedir(DIR); my $direventestablished; my $dirivr; my $diroutbound; my $dirnonurs; my $nodata; my %fourdns; foreach (@files) { my $searchfile = $_; my ($ineventestablished, $eventestablished,$ivreventfound,$urseventfound,$connid,$dnis,$ani,$thisdn,$thiscalltype,$thisqueue,$ivrstring,$ivr,$nonivr,$urstring,$urs,$nonurs,$outbound,$fourdigit); print "searching file $searchfile\n"; open(SEARCHFILE, "<$dir/$searchfile") || print "Could not open file $matchesboth : $!"; while () { chomp; #print "chomping file $dir, line = $line"; if ($_ =~ /distribute_event: message $event_type/) { $ineventestablished =1; $eventestablished++; } if ($ineventestablished) { if ($_ =~ /IVR_CALL_REASON/) { $ivreventfound = 1; } if ($_ =~ /URS_START/) { $urseventfound = 1; } if ($_ =~ /AttributeConnID\s(.*)/) { $connid = $1; } if ($_ =~ /AttributeDNIS\s+\'(.*)\'/) { $dnis = $1; } if ($_ =~ /AttributeANI\s+\'(.*)\'/) { $ani = $1; } if ($_ =~ /AttributeThisDN\s+\'(.*)\'/) { $thisdn = $1; } if ($_ =~ /AttributeCallType\s+(\d)/) { $thiscalltype = $1; } if ($_ =~ /AttributeThisQueue\s+\'(.*)\'/) { $thisqueue = $1; } #post processing if ($_ =~ /Interaction message \"$event_type\" generated/) { $ineventestablished = 0; if ($ivreventfound) { $ivrstring = "HAS BEEN THROUGH IVR "; $ivr++; } else { $ivrstring = "HASNT BEEN THROUGH IVR "; $nonivr++; } if ($urseventfound) { $urstring = "HAS BEEN THROUGH ROUTER"; $urs++; } else { $urstring = "HASNT BEEN THROUGH ROUTER"; $nonurs++; } if (!$urseventfound && !$ivreventfound) { $nodata++; } if (length($thisdn) < 5) { $fourdigit++; $fourdns{$thisdn} = 1; } if ($thiscalltype == 3) { $outbound++; } $ivreventfound = 0; $urseventfound = 0; #print "Connid = $connid $ivrstring and $urstring ANI = $ani and DNIS = $dnis and this DN = $thisdn and thisQueue = $thisqueue and thiscalltype = $thiscalltype\n"; } # end if postprocessing } #end eventestablished } # end while print "found $eventestablished total $event_type - $ivr IVR EVENTESTABLISHED and $nonivr NON IVR EVENTESTABLISHED and $urs URS EVENTS and $nonurs NON URS EVENTS and $outbound OUTBOUND\n"; $direventestablished = $direventestablished + $eventestablished; } # end files for looop print "toatl $event_type = $direventestablished and total nodata $event_type = $nodata\n";