Пример #1
0
		/// <summary>
		/// Simply close anything that was open if necessary.
		/// </summary>
		public void Close()
		{
			audioStream.Close();
			audioStream = null;
			if( doRecordStream )
			{
				recordStream.Flush();
				recordStream.Close();
			}
		}
Пример #2
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 );
			}
		}
Пример #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);
            }
        }