Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with discovery probe message for tds:Device #31

Closed
klukaspl opened this issue Mar 8, 2017 · 9 comments
Closed

Problem with discovery probe message for tds:Device #31

klukaspl opened this issue Mar 8, 2017 · 9 comments

Comments

@klukaspl
Copy link

klukaspl commented Mar 8, 2017

Hi,

I am trying to change the part of discovery_service.ts to respond not as NetworkVideoTransmitter but as Device. In if statement of parseString function I changed NetworkVideoTransmitter to Device, as well as in SOAP message I replaced <d:Types>dn:NetworkVideoTransmitter</d:Types> to be <d:Types>tds:Device</d:Types>.

I am testing that with Onvif Test Tool 17 and seems this tool is sending first Device and then NetworkVideoTransmitter probe. While I can see that the message with my changes is replied - I am unable to discover the device with the tool. With NetworkVideoTransmitter it is working.

Can anyone give some hint how to fix that ?

Regards,
Krzysztof

@RogerHardiman
Copy link
Collaborator

Hi,
Thanks for the information on Test Tool 17 Probing.
It may be a surprise, but I don't have ONVIF Test Tool.
Can you send over some logs of the Discovery Messages Test Tool Emits?

Thanks

@klukaspl
Copy link
Author

Hi,
I have changed the reply to this:
let reply = <?xml version="1.0" encoding="UTF-8"?> <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:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:dn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl"> <SOAP-ENV:Header> <wsa:MessageID>uuid:${uuid.v1()}</wsa:MessageID> <wsa:RelatesTo>${probe_uuid}</wsa:RelatesTo> <wsa:To SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To> <wsa:Action SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches</wsa:Action> <d:AppSequence SOAP-ENV:mustUnderstand="true" MessageNumber="34" InstanceId="1488957280"></d:AppSequence> </SOAP-ENV:Header> <SOAP-ENV:Body> <d:ProbeMatches> <d:ProbeMatch> <wsa:EndpointReference> <wsa:Address>urn:uuid:5581ad80-95b0-11e0-b883-accc8e0c06bb</wsa:Address> </wsa:EndpointReference> <d:Types>tds:Device</d:Types> <d:Scopes> onvif://www.onvif.org/location/ </d:Scopes> <d:XAddrs>http://${utils.getIpAddress()}:${this.config.ServicePort}/onvif/device_service</d:XAddrs> <d:MetadataVersion>1</d:MetadataVersion> </d:ProbeMatch> </d:ProbeMatches> </SOAP-ENV:Body> </SOAP-ENV:Envelope>;
and now it is working and present itself as Device.

BR,

Krzysztof

@RogerHardiman
Copy link
Collaborator

Thanks for the fix.
What I'll do is return this new XML if the scope is Device, and the old XML if the scope is NetworkVideoTransmitter.
If you wanted to fork, implement and raise a PullRequest that would be great.

Thanks
Roger

@klukaspl
Copy link
Author

I am trying to implement that and as well Hello and Bye messages to have Reboot and some network related methods, working as it is specified by onvif. But I have problem probably with asynchronous calls of the udp sockets calls. While I have the Hello working correctly, the Bye message is not sent before I am closing discovery socket (or just reboot). Any idea how to cope with that?

@RogerHardiman
Copy link
Collaborator

RogerHardiman commented May 18, 2017

That would be great if you could implement Hello and Bye.
For the Bye we probably need a small delay after sending the UDP packet and calling the reboot.
You could check to see if we could use shutdown -r TIME in the reboot code
utils.execSync("sudo reboot")
becomes
utils.execSync("sudo shutdown -r now")
This may give enough delay. We may want to use it anyway as it does a graceful shutdown.
The TIME parameter is in whole minutes so we cannot to a shutdown -r 3seconds which is unfortunate.

So the best bet is probably to schedule the reboot (or shutdown -r now) in a timer
So change
utils.execSync("sudo shutdown -r now")
to something like this
setTimeout(function(){utils.execSync("sudo shutdown -r now")},3000);// schedule reboot in 3 seconds

@klukaspl
Copy link
Author

Hi
thanks - I will check that.

I have one another struggle here. The discovery we have here is listening on multicast address. So it fails when I try perform unicast (which is used after reboot for example). Any idea how to cope with that?
I was thinking to run one another socket but no result.

BR
Krzysztof

@RogerHardiman
Copy link
Collaborator

Hi @klukaspl
I would start a 2nd Discovery Service on the unicast address of th RPOS device.
I will add that I've never seen unicast discovery messages in use before. I think unicast is used with Discovery Proxies but I've only ever seen the Multicast discovery system in use.
What program was using the unicast discovery protocol? (was it from Test Tool or a VMS?)

@klukaspl
Copy link
Author

Hi @RogerHardiman
There is the test : SEARCH USING UNICAST PROBE MESSAGE. which I am currently not able to pass. It seems that there is similar step when testing reboot. But I think you are right that there could be applied only to Discovery Proxy.

@RogerHardiman
Copy link
Collaborator

Did you have any changes or improvements to add to rpos?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants