/// <summary>
        /// Configures the way2call device.
        /// </summary>
        /// <returns></returns>
        private bool ConfigureDevice()
        {
            int iErr = 0;

            CWay2callDriver.Errors w2cErr = CWay2callDriver.Errors.SUCCESS;
            WriteLog("Initializing Way2call driver ...\n");

            w2cErr = (CWay2callDriver.Errors)w2cDrv.InitializeDriver(0);//must be called

            if (CWay2callDriver.Errors.SUCCESS != w2cErr)
            {
                WriteLog("Error opening the driver ...: " + w2cErr.ToString());
                iErr = w2cDrv.ShutdownDriver(0);
                return(false);
            }

            // no device(s)...
            if (0 == w2cDrv.NumDevices)
            {
                WriteLog("There are no Hi-Phone devices connected to this PC.");
                iErr = w2cDrv.ShutdownDriver(0);
                return(false);
            }

            WriteLog("Driver version: " + w2cDrv.Version.ToString() + "\n");

            //assume device #0 exists
            w2cErr = (CWay2callDriver.Errors)w2cDrv.Device.Open(0);//open the device

            if (CWay2callDriver.Errors.SUCCESS != w2cErr)
            {
                WriteLog("Error opening the device ...: " + w2cErr.ToString());
                iErr = w2cDrv.ShutdownDriver(0);//must be last called
                return(false);
            }


            /* Silent detection for every 3 seconds */
            CWay2callDriver.CDevice.TONE_MONITOR_IDS iToneId = CWay2callDriver.CDevice.TONE_MONITOR_IDS.TONE_ID_00;

            //w2cDrv.Device.LocalDevice = CWay2callDriver.CDevice.LOCAL_DEVICE.Phone;

            w2cDrv.Device.ToneMonitor.Tone[iToneId].Duration   = 3000;
            w2cDrv.Device.ToneMonitor.Tone[iToneId].Frequency1 = 0;
            w2cDrv.Device.ToneMonitor.Tone[iToneId].Frequency2 = 0;
            w2cDrv.Device.ToneMonitor.Tone[iToneId].Frequency3 = 0;
            w2cDrv.Device.ToneMonitor.Tone[iToneId].Enabled    = true;

            w2cDrv.Device.ToneMonitor.Start();

            return(true);
        }
        /// <summary>
        /// Dials the number.
        /// </summary>
        public void DialNumber()
        {
            LogBook.Write("Dialing the number");
            InitCall();

            LogBook.Write("InitCall() completed");
            LogBook.Write("PhoneNo. : " + phoneNumber + ", Voice Prompt: " + sensorInfo);

            /* reset previous flags */
            isCallConnected           = false;
            IsDone                    = false;
            stopVoicePrompt           = false;
            digitReceived             = false;
            Action["CallConnected"]   = 0;
            Action["SilenceDetected"] = 0;

            notifyComResponse = new NotifyComResponse();



            CWay2callDriver.Errors xError = (CWay2callDriver.Errors)w2cDrv.Device.Call("w" + phoneNumber, true, true);
            Thread.Sleep(2000);

            /* handling errors  */
            if (xError != CWay2callDriver.Errors.SUCCESS)
            {
                LogBook.Write("Call Error: " + xError.ToString());

                notifyComResponse.ResponseContent += "\r\n Call Error: " + xError.ToString();
                notifyComResponse.IsError          = true;

                w2cDrv.Device.HangUp(false);

                /* update call status as not completed. */
                Action["CallConnected"] = 0;
            }
            else
            {
                /* no errors, dialing the number.*/
                WriteLog("Starting to dial " + phoneNumber);
            }
        }