/// <summary>
        /// Create the good type of Rtsp Message from the header.
        /// </summary>
        /// <param name="aRequestLine">A request line.</param>
        /// <returns>An Rtsp message</returns>
        public static RtspMessage GetRtspMessage(string aRequestLine)
        {
            // We can't determine the message
            if (string.IsNullOrEmpty(aRequestLine))
            {
                return(new RtspMessage());
            }
            string[]    requestParts = aRequestLine.Split(new char[] { ' ' }, 3);
            RtspMessage returnValue;

            if (requestParts.Length == 3)
            {
                // A request is : Method SP Request-URI SP RTSP-Version
                // A response is : RTSP-Version SP Status-Code SP Reason-Phrase
                // RTSP-Version = "RTSP" "/" 1*DIGIT "." 1*DIGIT
                if (_rtspVersionTest.IsMatch(requestParts[2]))
                {
                    returnValue = RtspRequest.GetRtspRequest(requestParts);
                }
                else if (_rtspVersionTest.IsMatch(requestParts[0]))
                {
                    returnValue = new RtspResponse();
                }
                else
                {
                    _logger.LogFormat(LogType.Warning, "Got a strange message {0}", aRequestLine);
                    returnValue = new RtspMessage();
                }
            }
            else
            {
                _logger.LogFormat(LogType.Warning, "Got a strange message {0}", aRequestLine);
                returnValue = new RtspMessage();
            }
            returnValue.Command = aRequestLine;
            return(returnValue);
        }
        /// <summary>
        /// Gets the Rtsp request.
        /// </summary>
        /// <param name="aRequestParts">A request parts.</param>
        /// <returns>the parsed request</returns>
        internal static RtspMessage GetRtspRequest(string[] aRequestParts)
        {
            // <pex>
            Debug.Assert(aRequestParts != (string[])null, "aRequestParts");
            Debug.Assert(aRequestParts.Length != 0, "aRequestParts.Length == 0");
            // </pex>
            // we already know this is a Request
            RtspRequest returnValue;

            switch (ParseRequest(aRequestParts[0]))
            {
            case RequestType.OPTIONS:
                returnValue = new RtspRequestOptions();
                break;

            case RequestType.DESCRIBE:
                returnValue = new RtspRequestDescribe();
                break;

            case RequestType.SETUP:
                returnValue = new RtspRequestSetup();
                break;

            case RequestType.PLAY:
                returnValue = new RtspRequestPlay();
                break;

            case RequestType.PAUSE:
                returnValue = new RtspRequestPause();
                break;

            case RequestType.TEARDOWN:
                returnValue = new RtspRequestTeardown();
                break;

            case RequestType.GET_PARAMETER:
                returnValue = new RtspRequestGetParameter();
                break;

            case RequestType.ANNOUNCE:
                returnValue = new RtspRequestAnnounce();
                break;

            case RequestType.RECORD:
                returnValue = new RtspRequestRecord();
                break;

            /*
             * case RequestType.REDIRECT:
             * break;
             *
             * case RequestType.SET_PARAMETER:
             * break;
             */
            case RequestType.UNKNOWN:
            default:
                returnValue = new RtspRequest();
                break;
            }



            return(returnValue);
        }