SIPSorcery.Net.RTSPURL.ParseRTSPURL C# (CSharp) Method

ParseRTSPURL() public static method

public static ParseRTSPURL ( string url ) : RTSPURL
url string
return RTSPURL
        public static RTSPURL ParseRTSPURL(string url)
        {
            RTSPHeaderParserError notConcerned;
            return ParseRTSPURL(url, out notConcerned);
        }

Same methods

RTSPURL::ParseRTSPURL ( string url, RTSPHeaderParserError &parserError ) : RTSPURL

Usage Example

        public static RTSPRequest ParseRTSPRequest(RTSPMessage rtspMessage,
                                                   out RTSPRequestParserError requestParserError)
        {
            requestParserError = RTSPRequestParserError.None;
            string urlStr = null;

            try
            {
                RTSPRequest rtspRequest = new RTSPRequest();

                string statusLine = rtspMessage.FirstLine;

                int firstSpacePosn = statusLine.IndexOf(" ");

                string method = statusLine.Substring(0, firstSpacePosn).Trim();
                rtspRequest.Method = RTSPMethods.GetMethod(method);
                if (rtspRequest.Method == RTSPMethodsEnum.UNKNOWN)
                {
                    rtspRequest.UnknownMethod = method;
                    Logger.Logger.Warn("Unknown RTSP method received " + rtspRequest.Method + ".");
                }

                statusLine = statusLine.Substring(firstSpacePosn).Trim();
                int secondSpacePosn = statusLine.IndexOf(" ");

                if (secondSpacePosn != -1)
                {
                    urlStr = statusLine.Substring(0, secondSpacePosn);

                    rtspRequest.URL         = RTSPURL.ParseRTSPURL(urlStr);
                    rtspRequest.RTSPVersion = statusLine.Substring(secondSpacePosn, statusLine.Length - secondSpacePosn)
                                              .Trim();
                    rtspRequest.Header = (rtspMessage.RTSPHeaders != null)
                        ? RTSPHeader.ParseRTSPHeaders(rtspMessage.RTSPHeaders)
                        : new RTSPHeader(0, null);
                    rtspRequest.Body = rtspMessage.Body;

                    return(rtspRequest);
                }
                else
                {
                    throw new ApplicationException("URI was missing on RTSP request.");
                }
            }
            catch (Exception excp)
            {
                Logger.Logger.Error("Exception parsing RTSP request. URI, " + urlStr + ".");
                throw new ApplicationException("There was an exception parsing an RTSP request. " + excp.Message);
            }
        }
All Usage Examples Of SIPSorcery.Net.RTSPURL::ParseRTSPURL