Beispiel #1
0
 /// <summary>
 /// Method to return an instance of Analyzer
 /// </summary>
 /// <param name="_callerLog"></param>
 /// <param name="_calleeLog"></param>
 /// <param name="_wavValidator"></param>
 /// <returns></returns>
 public static Analyzer getInstance(string _callerLog, string _calleeLog, WavFileInfo _wavInfo, string _resultDir)
 {
     Analyzer a = null;
     try
     {
         a = new Analyzer(_callerLog, _calleeLog, _wavInfo, _resultDir);
     }
     catch (Exception e)
     {
         Console.WriteLine("Error in creating analyzer instance. Message:\n" + e.Message);
         a = null;
     }
     return a;
 }
Beispiel #2
0
        private int totalIterations; // Total iterations executed

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Class constructor
        /// </summary>
        public AggregateResult(Analyzer _analyzer)
        {
            iterationList = new List<IterationResult>();
            callerIDColl = new Dictionary<string,int>();
            this.analyzer = _analyzer;

            cntPassedIterations = 0;
            cntFailedIterations = 0;
            cntInvalidIterations = 0;
            cntCallFailed = 0;
            cntMissingHangup = 0;
            totalIterations = 0;
            cntEchoDetected = 0;
            cntNoiseDetected = 0;

            avgConfidenceCaller = 0;
            sumConfidenceCaller = 0;
            avgConfidenceCallee = 0;
            sumConfidenceCallee = 0;
            cntBadResultLine = 0;

            cntCallerSpeechDetFailure = 0;
            cntCalleeSpeechDetFailure = 0;

            connectLatency = 0;
            releaseLatency = 0;
            maxConnectLatency = 0;
            maxReleaseLatency = 0;

            cntMisrecognizedCaller = 0;
            cntRecognizedCaller = 0;
            cntUnrecognizedCaller = 0;
            cntMisrecognizedCallee = 0;
            cntRecognizedCallee = 0;
            cntUnrecognizedCallee = 0;
            cntEchoCaller = 0;
            cntEchoCallee = 0;
        }
        private WavFileInfo wInfo; // Instance containing information about files that callee can recognize

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Class constructor
        /// </summary>
        public GatewayTestDriver(string callerExeName, string calleeExeName, string sipServer, string callerExtension, string calleeExtension, string extnToDial, string callerGrammarFile, string calleeGrammarFile, string callerResultFile, string calleeResultFile, string[] callerWavFile, string calleeWavFile, WavFileInfo _wInfo, string _dirName, string _configFileName)
        {
            this.calleeExtension = calleeExtension;
            this.callerExtension = callerExtension;
            this.configFileName = _configFileName;

            this.dirName = _dirName;
            string calleeArguments;
            StringBuilder callerArguments = new StringBuilder();

            #region Code segment to initialize caller process
            callerProcess = new Process();
            callerProcess.StartInfo.FileName = callerExeName;
            callerProcess.StartInfo.UseShellExecute = true;
            callerProcess.StartInfo.RedirectStandardError = false;
            callerProcess.StartInfo.RedirectStandardOutput = false;

            callerArguments.Append(sipServer + " " + callerExtension + " " + extnToDial + " " + callerGrammarFile + " " + callerResultFile + " " + dirName + " " + configFileName);

              //      callerArguments.Append(numIterations);

            for (int i = 0; i < callerWavFile.Length; i++)
            {
                callerArguments.Append(" ");
                callerArguments.Append(callerWavFile[i]);
            }

            callerProcess.StartInfo.Arguments = callerArguments.ToString();

            callerProcess.Exited += new EventHandler(callerProcess_Exited);
            #endregion

            #region Code segment to initialize callee process
            calleeProcess = new Process();
            calleeProcess.StartInfo.FileName = calleeExeName;
            calleeProcess.StartInfo.UseShellExecute = true;
            calleeProcess.StartInfo.RedirectStandardError = false;
            calleeProcess.StartInfo.RedirectStandardOutput = false;

            calleeArguments = sipServer + " " + calleeExtension + " " + callerExtension + " " + calleeGrammarFile + " " + calleeResultFile + " " + dirName + " " + configFileName + " " + calleeWavFile;
            calleeProcess.StartInfo.Arguments = calleeArguments;
            calleeProcess.Exited += new EventHandler(calleeProcess_Exited);
            #endregion

            calleeTerminationTimer = new System.Timers.Timer();
            calleeTerminationTimer.Enabled = false;
            calleeTerminationTimer.Elapsed +=new ElapsedEventHandler(calleeTerminationTimer_Elapsed);
            calleeTerminationTimer.Interval = 30000;    // Set it to fire after 30 seconds once enabled

            callerTerminationTimer = new System.Timers.Timer();
            callerTerminationTimer.Enabled = false;
            callerTerminationTimer.Elapsed += new ElapsedEventHandler(callerTerminationTimer_Elapsed);
            callerTerminationTimer.Interval = 20000;    // Set it to fire after 20 seconds once enabled

            this.calleeResultFile = calleeResultFile;
            this.callerResultFile = callerResultFile;
            this.calleeGrammarFile = calleeGrammarFile;

            wInfo = _wInfo;
            analyzer = null;
        }
        /// <summary>
        /// Method that instantiates the analyzer.
        /// </summary>
        private void analyzeResult()
        {
            analyzer = null;
            int numTries = 10;

            /**
             * In order to account for the delay in closing the result files, this method attempts to instantiate the object
             * 10 times, waiting 10 seconds between each iteration. If the object gets instantiated, the results are generated,
             * else a suitable error message is shown.
             */

            for (int i = 0; i < numTries && analyzer == null; i++)
            {
                Console.WriteLine("Instantiating Analyzer...");
                Thread.Sleep(10000);
                analyzer = Analyzer.getInstance(callerResultFile, calleeResultFile, wInfo, dirName);
            }

            if (analyzer != null)
                analyzer.generateResults();
            else
            {
                Console.WriteLine("Error in creating analyzer. Test results cannot be analyzed");
                Trace.TraceError("Error in creating analyzer. Test results cannot be analyzed");
            }
        }