Exemple #1
0
        public static RTSPResponse ParseRTSPResponse(RTSPMessage rtspMessage,
                                                     out RTSPResponseParserError responseParserError)
        {
            responseParserError = RTSPResponseParserError.None;

            try
            {
                RTSPResponse rtspResponse = new RTSPResponse();

                string statusLine = rtspMessage.FirstLine;

                int firstSpacePosn = statusLine.IndexOf(" ");

                rtspResponse.RTSPVersion = statusLine.Substring(0, firstSpacePosn).Trim();
                statusLine = statusLine.Substring(firstSpacePosn).Trim();
                rtspResponse.StatusCode   = Convert.ToInt32(statusLine.Substring(0, 3));
                rtspResponse.Status       = RTSPResponseStatusCodes.GetStatusTypeForCode(rtspResponse.StatusCode);
                rtspResponse.ReasonPhrase = statusLine.Substring(3).Trim();

                rtspResponse.Header = RTSPHeader.ParseRTSPHeaders(rtspMessage.RTSPHeaders);
                rtspResponse.Body   = rtspMessage.Body;

                return(rtspResponse);
            }
            catch (Exception excp)
            {
                logger.LogError("Exception parsing RTSP response. " + excp.Message);
                throw new ApplicationException("There was an exception parsing an RTSP response. " + excp.Message);
            }
        }
        public static RTSPResponse ParseRTSPResponse(RTSPMessage rtspMessage)
        {
            RTSPResponseParserError dontCare = RTSPResponseParserError.None;

            return(ParseRTSPResponse(rtspMessage, out dontCare));
        }
		public static RTSPResponse ParseRTSPResponse(RTSPMessage rtspMessage, out RTSPResponseParserError responseParserError)
		{
            responseParserError = RTSPResponseParserError.None;
			
			try
			{
                RTSPResponse rtspResponse = new RTSPResponse();

                string statusLine = rtspMessage.FirstLine;

                int firstSpacePosn = statusLine.IndexOf(" ");

                rtspResponse.RTSPVersion = statusLine.Substring(0, firstSpacePosn).Trim();
                statusLine = statusLine.Substring(firstSpacePosn).Trim();
                rtspResponse.StatusCode = Convert.ToInt32(statusLine.Substring(0, 3));
                rtspResponse.Status = RTSPResponseStatusCodes.GetStatusTypeForCode(rtspResponse.StatusCode);
                rtspResponse.ReasonPhrase = statusLine.Substring(3).Trim();

                rtspResponse.Header = RTSPHeader.ParseRTSPHeaders(rtspMessage.RTSPHeaders);
                rtspResponse.Body = rtspMessage.Body;

                //rtspResponse.Valid = rtspResponse.Validate(out sipResponse.ValidationError);

                return rtspResponse;
    		}
			catch(Exception excp)
			{
				logger.Error("Exception parsing RTSP reqsponse. "  + excp.Message);
				throw new ApplicationException("There was an exception parsing an RTSP response. " + excp.Message);
			}
		}