コード例 #1
0
        /// <summary>
        /// The purpose of this method is to add a packet to the audio stream.
        /// The packet has not yet been decoded.
        /// </summary>
        /// <param name="rawRtpBytes">raw bytes from the packet</param>
        /// <returns>ToneDetected enum indicating if any tones were detected</returns>
        public ToneDetected AddPacket(byte [] rawRtpBytes)
        {
            ToneDetected retval;

            byte []    bytes;
            RTPDecoder rtpDecoder;

            retval = ToneDetected.NONE;

            if (doRecordStream)
            {
                bytes = BitConverter.GetBytes(rawRtpBytes.Length);
                recordStream.Write(bytes, 0, bytes.Length);
                recordStream.Write(rawRtpBytes, 0, rawRtpBytes.Length);
            }

            try
            {
                rtpDecoder = new RTPDecoder(rawRtpBytes);
                if ((rtpDecoder.DecodedPayload != null) && (rtpDecoder.DecodedPayload.Length > 0))
                {
                    retval = audioStream.Add(rtpDecoder.DecodedPayload);
                }
            }
            catch (InvalidRTPPacketException invalidRTPPacketException)
            {
                invalidRTPPacketException.Data.Add("My Key", "VMukti--:--VmuktiModules--:--VmuktiModules--:--Call Center--:--ToneDetect--:--ToneDetect.Business--:--AudioStreamState.cs--:--InvalidRTPPacketException()--");
                ClsException.LogError(invalidRTPPacketException);
                ClsException.WriteToErrorLogFile(invalidRTPPacketException);
            }

            return(retval);
        }
コード例 #2
0
		/// <summary>
		/// The purpose of this method is to add a packet to the audio stream.
		/// The packet has not yet been decoded.
		/// </summary>
		/// <param name="rawRtpBytes">raw bytes from the packet</param>
		/// <returns>ToneDetected enum indicating if any tones were detected</returns>
		public ToneDetected AddPacket( byte [] rawRtpBytes )
		{
			ToneDetected retval;
			byte [] bytes;
			RTPDecoder rtpDecoder;

			retval = ToneDetected.NONE;

			if( doRecordStream )
			{
				bytes = BitConverter.GetBytes( rawRtpBytes.Length );
				recordStream.Write( bytes, 0, bytes.Length );
				recordStream.Write( rawRtpBytes, 0, rawRtpBytes.Length );
			}
			
			try
			{
				rtpDecoder = new RTPDecoder( rawRtpBytes );
				if( ( rtpDecoder.DecodedPayload != null ) && ( rtpDecoder.DecodedPayload.Length > 0 ) )
				{
					retval = audioStream.Add( rtpDecoder.DecodedPayload );
				}
			}
			catch( InvalidRTPPacketException invalidRTPPacketException )
			{
				invalidRTPPacketException.Data.Add( "My Key", "VMukti--:--VmuktiModules--:--VmuktiModules--:--Call Center--:--ToneDetect--:--ToneDetect.Business--:--AudioStreamState.cs--:--InvalidRTPPacketException()--" );
				ClsException.LogError( invalidRTPPacketException );
				ClsException.WriteToErrorLogFile( invalidRTPPacketException );
			}

			return retval;
		}