/// <summary>
		/// Simply close anything that was open if necessary.
		/// </summary>
		public void Close()
		{
			audioStream.Close();
			audioStream = null;
			if( doRecordStream )
			{
				recordStream.Flush();
				recordStream.Close();
			}
		}
		/// <summary>
		/// perform Initialization of the instance to include
		/// creation of the audio stream and opening of the stream to write
		/// packets to if doRecordStream is set.
		/// </summary>
		private void Initialize()
		{
			string fileName;
			//const string sipDir = @"c:\siplogs";
            //string sipDir = Directory.GetCurrentDirectory(); // use the current directory
            string sipDir = AppDomain.CurrentDomain.BaseDirectory + "//ToneDetectionFiles";
            if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "//ToneDetectionFiles"))
            { Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "//ToneDetectionFiles"); }
			audioStream = new AudioStream();

			if( doRecordStream )
			{
				if( !Directory.Exists( sipDir ) )
				{
					Directory.CreateDirectory( sipDir );
				}
				fileName = sipDir + @"\" + phoneNumber + "-" + DateTime.Now.Ticks.ToString() + "rtp.log";
				recordStream = File.Open( fileName, FileMode.Create );
			}
		}
Exemple #3
0
        /// <summary>
        /// perform Initialization of the instance to include
        /// creation of the audio stream and opening of the stream to write
        /// packets to if doRecordStream is set.
        /// </summary>
        private void Initialize()
        {
            string fileName;
            //const string sipDir = @"c:\siplogs";
            //string sipDir = Directory.GetCurrentDirectory(); // use the current directory
            string sipDir = AppDomain.CurrentDomain.BaseDirectory + "//ToneDetectionFiles";

            if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "//ToneDetectionFiles"))
            {
                Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "//ToneDetectionFiles");
            }
            audioStream = new AudioStream();

            if (doRecordStream)
            {
                if (!Directory.Exists(sipDir))
                {
                    Directory.CreateDirectory(sipDir);
                }
                fileName     = sipDir + @"\" + phoneNumber + "-" + DateTime.Now.Ticks.ToString() + "rtp.log";
                recordStream = File.Open(fileName, FileMode.Create);
            }
        }