onvif icon indicating copy to clipboard operation
onvif copied to clipboard

Non conform /onvif/media2_service response leads to Error: Unrecognized configuration

Open TA2k opened this issue 1 year ago • 2 comments

The attached /onvif/media2_service response from YMF52 NM223N AF leads to Error: Unrecognized configuration Because the VideoSource token not matching with the videoSource.$.token because the Name is used as Token.

Maybe we can relax the check https://github.com/agsh/onvif/blob/73f6e98122bea3eb454a4d24ffb23b480cb66cfe/lib/cam.js#L674

If the Name === Token it will also add to appropriateProfiles

PR for this https://github.com/agsh/onvif/pull/288

<SOAP-ENV:Envelope
	xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
	xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
	xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery"
	xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex"
	xmlns:wsa5="http://www.w3.org/2005/08/addressing"
	xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
	xmlns:xop="http://www.w3.org/2004/08/xop/include"
	xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2"
	xmlns:tt="http://www.onvif.org/ver10/schema"
	xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"
	xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2"
	xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl"
	xmlns:tdn="http://www.onvif.org/ver10/network/wsdl"
	xmlns:tds="http://www.onvif.org/ver10/device/wsdl"
	xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
	xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
	xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#"
	xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
	xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
	xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc"
	xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
	xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
	xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl"
	xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl"
	xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl"
	xmlns:trt="http://www.onvif.org/ver10/media/wsdl"
	xmlns:ter="http://www.onvif.org/ver10/error"
	xmlns:tns1="http://www.onvif.org/ver10/topics"
	xmlns:trt2="http://www.onvif.org/ver20/media/wsdl"
	xmlns:tr2="http://www.onvif.org/ver20/media/wsdl"
	xmlns:ewsd="http://www.onvifext.com/onvif/ext/ver10/wsdl"
	xmlns:exsd="http://www.onvifext.com/onvif/ext/ver10/schema"
	xmlns:tnshik="http://www.hikvision.com/2011/event/topics"
	xmlns:hikwsd="http://www.onvifext.com/onvif/ext/ver10/wsdl"
	xmlns:hikxsd="http://www.onvifext.com/onvif/ext/ver10/schema">
	<SOAP-ENV:Header>
		<wsse:Security>
			<wsse:UsernameToken>
				<wsse:Username>admin</wsse:Username>
				<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">************==</wsse:Password>
				<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">********==</wsse:Nonce>
				<wsu:Created>2023-03-09T06:53:06.046Z</wsu:Created>
			</wsse:UsernameToken>
		</wsse:Security>
	</SOAP-ENV:Header>
	<SOAP-ENV:Body>
		<trt2:GetProfilesResponse>
			<trt2:Profiles token="MainStream" fixed="true">
				<trt2:Name>MainStream</trt2:Name>
				<trt2:Configurations>
					<trt2:VideoSource token="VideoSourceMain">
						<tt:Name>VideoSourceMain</tt:Name>
						<tt:UseCount>2</tt:UseCount>
						<tt:SourceToken>VideoSourceMain</tt:SourceToken>
						<tt:Bounds x="0" y="0" width="3072" height="2048"></tt:Bounds>
					</trt2:VideoSource>
					<trt2:AudioSource token="AudioMainToken">
						<tt:Name>AudioMainName</tt:Name>
						<tt:UseCount>2</tt:UseCount>
						<tt:SourceToken>AudioMainSrcToken</tt:SourceToken>
					</trt2:AudioSource>
					<trt2:VideoEncoder token="VideoEncodeMain" GovLength="100" Profile="High">
						<tt:Name>VideoEncodeMain</tt:Name>
						<tt:UseCount>1</tt:UseCount>
						<tt:Encoding>H265</tt:Encoding>
						<tt:Resolution>
							<tt:Width>3072</tt:Width>
							<tt:Height>2048</tt:Height>
						</tt:Resolution>
						<tt:RateControl ConstantBitRate="false">
							<tt:FrameRateLimit>25</tt:FrameRateLimit>
							<tt:BitrateLimit>5000</tt:BitrateLimit>
						</tt:RateControl>
						<tt:Multicast>
							<tt:Address>
								<tt:Type>IPv4</tt:Type>
								<tt:IPv4Address>192.168.178.71</tt:IPv4Address>
							</tt:Address>
							<tt:Port>0</tt:Port>
							<tt:TTL>0</tt:TTL>
							<tt:AutoStart>false</tt:AutoStart>
						</tt:Multicast>
						<tt:Quality>50</tt:Quality>
					</trt2:VideoEncoder>
					<trt2:AudioEncoder token="G711A">
						<tt:Name>AudioMain</tt:Name>
						<tt:UseCount>2</tt:UseCount>
						<tt:Encoding>G711A</tt:Encoding>
						<tt:Multicast>
							<tt:Address>
								<tt:Type>IPv4</tt:Type>
								<tt:IPv4Address>192.168.178.71</tt:IPv4Address>
							</tt:Address>
							<tt:Port>80</tt:Port>
							<tt:TTL>1</tt:TTL>
							<tt:AutoStart>false</tt:AutoStart>
						</tt:Multicast>
						<tt:Bitrate>64000</tt:Bitrate>
						<tt:SampleRate>8000</tt:SampleRate>
					</trt2:AudioEncoder>
					<trt2:Analytics token="VideoAnalyticsToken">
						<tt:Name>VideoAnalyticsName</tt:Name>
						<tt:UseCount>3</tt:UseCount>
						<tt:AnalyticsEngineConfiguration>
							<tt:AnalyticsModule Type="tt:CellMotionEngine" Name="MyCellMotionModule">
								<tt:Parameters>
									<tt:SimpleItem Name="Sensitivity" Value="0"></tt:SimpleItem>
									<tt:ElementItem Name="Layout">
										<tt:CellLayout Rows="18" Columns="22">
											<tt:Transformation>
												<tt:Translate y="-1" x="-1" />
												<tt:Scale y="9.99999997E-07" x="9.99999997E-07" />
											</tt:Transformation>
										</tt:CellLayout>
									</tt:ElementItem>
								</tt:Parameters>
							</tt:AnalyticsModule>
						</tt:AnalyticsEngineConfiguration>
						<tt:RuleEngineConfiguration>
							<tt:Rule Type="tt:CellMotionDetector" Name="MyMotionDetectorRule">
								<tt:Parameters>
									<tt:SimpleItem Name="MinCount" Value="5"></tt:SimpleItem>
									<tt:SimpleItem Name="AlarmOnDelay" Value="100"></tt:SimpleItem>
									<tt:SimpleItem Name="AlarmOffDelay" Value="100"></tt:SimpleItem>
									<tt:SimpleItem Name="ActiveCells" Value="0P8A8A=="></tt:SimpleItem>
								</tt:Parameters>
							</tt:Rule>
						</tt:RuleEngineConfiguration>
					</trt2:Analytics>
					<trt2:PTZ token="ptz0">
						<tt:Name>ptz0</tt:Name>
						<tt:UseCount>2</tt:UseCount>
						<tt:NodeToken>ptz0</tt:NodeToken>
						<tt:DefaultAbsolutePantTiltPositionSpace>http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace</tt:DefaultAbsolutePantTiltPositionSpace>
						<tt:DefaultAbsoluteZoomPositionSpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace</tt:DefaultAbsoluteZoomPositionSpace>
						<tt:DefaultRelativePanTiltTranslationSpace>http://www.onvif.org/ver10/tptz/PanTiltSpaces/TranslationGenericSpace</tt:DefaultRelativePanTiltTranslationSpace>
						<tt:DefaultRelativeZoomTranslationSpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/TranslationGenericSpace</tt:DefaultRelativeZoomTranslationSpace>
						<tt:DefaultContinuousPanTiltVelocitySpace>http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocityGenericSpace</tt:DefaultContinuousPanTiltVelocitySpace>
						<tt:DefaultContinuousZoomVelocitySpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace</tt:DefaultContinuousZoomVelocitySpace>
						<tt:DefaultPTZSpeed>
							<tt:PanTilt x="1" y="1" space="http://www.onvif.org/ver10/tptz/PanTiltSpaces/GenericSpeedSpace"></tt:PanTilt>
							<tt:Zoom x="1" space="http://www.onvif.org/ver10/tptz/ZoomSpaces/ZoomGenericSpeedSpace"></tt:Zoom>
						</tt:DefaultPTZSpeed>
						<tt:DefaultPTZTimeout>PT00H01M00S</tt:DefaultPTZTimeout>
						<tt:PanTiltLimits>
							<tt:Range>
								<tt:URI>http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace</tt:URI>
								<tt:XRange>
									<tt:Min>-1</tt:Min>
									<tt:Max>1</tt:Max>
								</tt:XRange>
								<tt:YRange>
									<tt:Min>-1</tt:Min>
									<tt:Max>1</tt:Max>
								</tt:YRange>
							</tt:Range>
						</tt:PanTiltLimits>
						<tt:ZoomLimits>
							<tt:Range>
								<tt:URI>http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace</tt:URI>
								<tt:XRange>
									<tt:Min>-1</tt:Min>
									<tt:Max>1</tt:Max>
								</tt:XRange>
							</tt:Range>
						</tt:ZoomLimits>
					</trt2:PTZ>
				</trt2:Configurations>
			</trt2:Profiles>
			<trt2:Profiles token="SubStream" fixed="true">
				<trt2:Name>SubStream</trt2:Name>
				<trt2:Configurations>
					<trt2:VideoSource token="VideoSourceMain">
						<tt:Name>VideoSourceMain</tt:Name>
						<tt:UseCount>2</tt:UseCount>
						<tt:SourceToken>VideoSourceMain</tt:SourceToken>
						<tt:Bounds x="0" y="0" width="704" height="576"></tt:Bounds>
					</trt2:VideoSource>
					<trt2:AudioSource token="AudioMainToken">
						<tt:Name>AudioMainName</tt:Name>
						<tt:UseCount>2</tt:UseCount>
						<tt:SourceToken>AudioMainSrcToken</tt:SourceToken>
					</trt2:AudioSource>
					<trt2:VideoEncoder token="VideoEncodeSub" GovLength="100" Profile="High">
						<tt:Name>VideoEncodeSub</tt:Name>
						<tt:UseCount>1</tt:UseCount>
						<tt:Encoding>H265</tt:Encoding>
						<tt:Resolution>
							<tt:Width>704</tt:Width>
							<tt:Height>576</tt:Height>
						</tt:Resolution>
						<tt:RateControl ConstantBitRate="false">
							<tt:FrameRateLimit>25</tt:FrameRateLimit>
							<tt:BitrateLimit>700</tt:BitrateLimit>
						</tt:RateControl>
						<tt:Multicast>
							<tt:Address>
								<tt:Type>IPv4</tt:Type>
								<tt:IPv4Address>192.168.178.71</tt:IPv4Address>
							</tt:Address>
							<tt:Port>0</tt:Port>
							<tt:TTL>0</tt:TTL>
							<tt:AutoStart>false</tt:AutoStart>
						</tt:Multicast>
						<tt:Quality>50</tt:Quality>
					</trt2:VideoEncoder>
					<trt2:AudioEncoder token="G711A">
						<tt:Name>AudioMain</tt:Name>
						<tt:UseCount>2</tt:UseCount>
						<tt:Encoding>G711A</tt:Encoding>
						<tt:Multicast>
							<tt:Address>
								<tt:Type>IPv4</tt:Type>
								<tt:IPv4Address>192.168.178.71</tt:IPv4Address>
							</tt:Address>
							<tt:Port>80</tt:Port>
							<tt:TTL>1</tt:TTL>
							<tt:AutoStart>false</tt:AutoStart>
						</tt:Multicast>
						<tt:Bitrate>64000</tt:Bitrate>
						<tt:SampleRate>8000</tt:SampleRate>
					</trt2:AudioEncoder>
					<trt2:Analytics token="VideoAnalyticsToken">
						<tt:Name>VideoAnalyticsName</tt:Name>
						<tt:UseCount>3</tt:UseCount>
						<tt:AnalyticsEngineConfiguration>
							<tt:AnalyticsModule Type="tt:CellMotionEngine" Name="MyCellMotionModule">
								<tt:Parameters>
									<tt:SimpleItem Name="Sensitivity" Value="80"></tt:SimpleItem>
									<tt:ElementItem Name="Layout">
										<tt:CellLayout Rows="18" Columns="22">
											<tt:Transformation>
												<tt:Translate y="-1" x="-1" />
												<tt:Scale y="9.99999997E-07" x="9.99999997E-07" />
											</tt:Transformation>
										</tt:CellLayout>
									</tt:ElementItem>
								</tt:Parameters>
							</tt:AnalyticsModule>
						</tt:AnalyticsEngineConfiguration>
						<tt:RuleEngineConfiguration>
							<tt:Rule Type="tt:CellMotionDetector" Name="MyMotionDetectorRule">
								<tt:Parameters>
									<tt:SimpleItem Name="MinCount" Value="5"></tt:SimpleItem>
									<tt:SimpleItem Name="AlarmOnDelay" Value="100"></tt:SimpleItem>
									<tt:SimpleItem Name="AlarmOffDelay" Value="100"></tt:SimpleItem>
									<tt:SimpleItem Name="ActiveCells" Value="0P8A8A=="></tt:SimpleItem>
								</tt:Parameters>
							</tt:Rule>
						</tt:RuleEngineConfiguration>
					</trt2:Analytics>
					<trt2:PTZ token="ptz0">
						<tt:Name>ptz0</tt:Name>
						<tt:UseCount>2</tt:UseCount>
						<tt:NodeToken>ptz0</tt:NodeToken>
						<tt:DefaultAbsolutePantTiltPositionSpace>http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace</tt:DefaultAbsolutePantTiltPositionSpace>
						<tt:DefaultAbsoluteZoomPositionSpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace</tt:DefaultAbsoluteZoomPositionSpace>
						<tt:DefaultRelativePanTiltTranslationSpace>http://www.onvif.org/ver10/tptz/PanTiltSpaces/TranslationGenericSpace</tt:DefaultRelativePanTiltTranslationSpace>
						<tt:DefaultRelativeZoomTranslationSpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/TranslationGenericSpace</tt:DefaultRelativeZoomTranslationSpace>
						<tt:DefaultContinuousPanTiltVelocitySpace>http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocityGenericSpace</tt:DefaultContinuousPanTiltVelocitySpace>
						<tt:DefaultContinuousZoomVelocitySpace>http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace</tt:DefaultContinuousZoomVelocitySpace>
						<tt:DefaultPTZSpeed>
							<tt:PanTilt x="1" y="1" space="http://www.onvif.org/ver10/tptz/PanTiltSpaces/GenericSpeedSpace"></tt:PanTilt>
							<tt:Zoom x="1" space="http://www.onvif.org/ver10/tptz/ZoomSpaces/ZoomGenericSpeedSpace"></tt:Zoom>
						</tt:DefaultPTZSpeed>
						<tt:DefaultPTZTimeout>PT00H01M00S</tt:DefaultPTZTimeout>
						<tt:PanTiltLimits>
							<tt:Range>
								<tt:URI>http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace</tt:URI>
								<tt:XRange>
									<tt:Min>-1</tt:Min>
									<tt:Max>1</tt:Max>
								</tt:XRange>
								<tt:YRange>
									<tt:Min>-1</tt:Min>
									<tt:Max>1</tt:Max>
								</tt:YRange>
							</tt:Range>
						</tt:PanTiltLimits>
						<tt:ZoomLimits>
							<tt:Range>
								<tt:URI>http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace</tt:URI>
								<tt:XRange>
									<tt:Min>-1</tt:Min>
									<tt:Max>1</tt:Max>
								</tt:XRange>
							</tt:Range>
						</tt:ZoomLimits>
					</trt2:PTZ>
				</trt2:Configurations>
			</trt2:Profiles>
		</trt2:GetProfilesResponse>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

TA2k avatar Mar 09 '23 08:03 TA2k