Example #1
0
        /// <summary>
        /// Method to obtain an instance of driver. Driver and BargedCallee are only created if 
        /// result file can be created
        /// </summary>
        /// <param name="cp"></param>
        /// <returns></returns>
        public static Driver getInstance(ConfigParameters cp, out int retCode)
        {
            retCode = 0;

            try
            {
                if (drv == null)
                    drv = new Driver(cp);
            }
            catch (COMException ce)
            {
                Console.WriteLine("COMException in Driver.getInstance : " + ce.Message);
                Trace.WriteLine("COMException in Creating Callee. Message " + ce.Message, "Error");
                retCode = ReturnCode.COM_EXCEPTION_CREATION;
                return null;
            }
            catch (IOException ie)
            {
                Console.WriteLine("IOException in Driver.getInstance : " + ie.Message);
                Trace.WriteLine("IOException in Creating Callee. Message " + ie.Message, "Error");
                retCode = ReturnCode.IO_EXCEPTION;
                return null;
            }

            catch (Exception e)
            {
                Console.WriteLine("Exception in Driver.getInstance : " + e.Message);
                Trace.WriteLine("Exception in creating Callee. Message " + e.Message, "Error");
                Trace.WriteLine("Stack Trace : " + e.StackTrace);
                retCode = ReturnCode.EXCEPTION_CREATION;
                return null;
            }
            return drv;
        }
Example #2
0
        private Logger resultLogger; // Instance of logger

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="cp"></param>
        private Driver(ConfigParameters cp)
        {
            resultLogger = Logger.getInstance(cp.logFileName);

            if (resultLogger == null)
            {
                throw new System.IO.IOException("Could not open the result file for writing");
            }

            caller = new Caller(cp);
              //      caller.OnStateChanged += new Caller.StateChangedEventHandler(caller_OnStateChanged);
            caller.OnIterationCompleted += new Caller.IterationCompletedEventHandler(caller_OnIterationCompleted);
            currIter = 0;
        }
Example #3
0
        /// <summary>
        /// Member method to validate input
        /// </summary>
        /// <param name="_inp"></param>
        /// <returns></returns>
        public static bool validate(string[] args, out ConfigParameters _inp)
        {
            bool error = false;
            int numIter = 0;
            string[] wavFileList = null;

            if (args.Length < 8)
            {
                Console.WriteLine("Usage:");
                Console.WriteLine("GatewayTestCaller.exe SipServerIP CallerExtension GrammarFileName OutputFileName ResultDirectory ConfigurationFileName WavFileList");
                Console.WriteLine("\tSipServerIP - IP address of the SIP server");
                Console.WriteLine("\tCallerExtension - Extension number for the caller");
                Console.WriteLine("\tDialedExtension - Extension to dial to reach callee");
                Console.WriteLine("\tGrammarFileName - Name for the grammar file for caller");
                Console.WriteLine("\tOutputFileName - Name of the output file");
                Console.WriteLine("\tResultDirectory - Directory name to store result, trace and recorded files");
                Console.WriteLine("\tConfigurationFileName - Name of file to read configuration parameters from");

              //      Console.WriteLine("\tNumIterations - Number of calls to place");
                Console.WriteLine("\tWavFileList - List of wave file to play to barge");
                error = true;
            }
            else
            {
                if (validateIP(args[0]) == false)
                {
                    Console.WriteLine(args[0] + " is not a valid IP address");
                    error = true;
                }
                if (!error && checkGrammarFile(args[3]) == false)
                {
                    Console.WriteLine("Specified Grammar file " + args[3] + " does not exist");
                    error = true;
                }
                if (Directory.Exists(args[5]) == false)
                {
                    error = true;
                    Console.WriteLine("Specified directory to store results \"{0}\" does not exist", args[5]);
                }
                if (File.Exists(args[6]) == false)
                {
                    error = true;
                    Console.WriteLine("Specified configuration file \"{0}\" does not exist", args[6]);
                }

                //if (false == validateNumIterations(args[6], out numIter))
                //{
                //    error = true;
                //    Console.WriteLine("Number of iterations = " + args[6] + " is invalid.");
                //}

                /**
                 * Build a wav file list
                 */
                wavFileList = new string[args.Length - 7];

                for (int i = 7; i < args.Length && !error; i++)
                {
                    if (checkWavFile(args[i]) == false)
                    {
                        error = true;
                        Console.WriteLine("Specified Wav file " + args[i] + " does not exist");
                    }
                    else
                    {
                        wavFileList[i - 7] = args[i];
                    }
                }
            }
            if (error == true)
            {
                _inp = null;
                wavFileList = null;
            }
            else
            {
                _inp = new ConfigParameters(args[0], args[1], args[2], args[3], args[4], args[5], args[6], wavFileList);
            }
            return !error;
        }
Example #4
0
        private int waitTimeBetweenCalls = 20; // Wait time between calls in seconds

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Class constructor
        /// </summary>
        public Callee(ConfigParameters _inputParam)
        {
            this.inputParam = _inputParam;
            initializeCallee();
        }