diff --git a/src/zm_rtsp.cpp b/src/zm_rtsp.cpp index 0ff0e385f..9c4bee207 100644 --- a/src/zm_rtsp.cpp +++ b/src/zm_rtsp.cpp @@ -366,6 +366,22 @@ int RtspThread::run() size_t sdpStart = response.find( endOfHeaders ); if( sdpStart == std::string::npos ) return( -1 ); + + std::string DescHeader = response.substr( 0,sdpStart ); + Debug( 1, "Processing DESCRIBE response header '%s'", DescHeader.c_str() ); + + lines = split( DescHeader, "\r\n" ); + for ( size_t i = 0; i < lines.size(); i++ ) + { + // If the device sends us a url value for Content-Base in the response header, we should use that instead + if ( ( lines[i].size() > 13 ) && ( lines[i].substr( 0, 13 ) == "Content-Base:" ) ) + { + mUrl = trimSpaces( lines[i].substr( 13 ) ); + Info("Recieved new Content-Base in DESCRIBE reponse header. Updated device Url to: '%s'", mUrl.c_str() ); + break; + } + } + sdpStart += endOfHeaders.length(); std::string sdp = response.substr( sdpStart );