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

478 Basic ONVIF Support #479

Merged
merged 3 commits into from Feb 19, 2015
Merged

Conversation

altaroca
Copy link
Contributor

I added basic onvif support. Please find details here: https://altaroca.wordpress.com
It includes an almost complete ONVIF API. That should explain the huge number of files.

@connortechnology
Copy link
Member

Great stuff, but I think you need to update from master first.

@knight-of-ni
Copy link
Member

Nice work.

This pull request makes changes that I don't believe should change, like some of the deletions in configure.ac for example. Think @connortechnology hit the nail on the head.

Also need to modify cmake files so it builds with cmake instead of autotools.

@altaroca
Copy link
Contributor Author

I had old versions of .gitignore and configure.ac in my working copy. Should be fine now.
As for cmake ... I have to find out how that works first.

@knight-of-ni
Copy link
Member

Thank you for all the work you've done @altaroca

Maybe it's just me, but I've found cmake to be a lot more intuitive than autotools. Check out the CMakeLists.txt files that are in each folder for examples. If you have any questions, let us know.

We are usually online on the #zoneminder freenode irc channel. You are welcome to ask questions there too.

@altaroca
Copy link
Contributor Author

You are right @knnniggett . It's easier than I thought. I used snippets from existing CMakelists and got a working cmake build.

@knight-of-ni knight-of-ni added this to the ONVIF milestone Jul 15, 2014
@knight-of-ni
Copy link
Member

Created an ONVIF milestone and grouped all related issues to it.

Note that there is an open bounty for this feature:
#208

@knight-of-ni
Copy link
Member

I was able to build and test this today, and it seems the rpm package building process sniffed out a few perl module dependency issues:

--> Finished Dependency Resolution
Error: Package: zoneminder-1.27onvif-1.el6.x86_64 (/zoneminder-1.27onvif-1.el6.x86_64)
           Requires: perl(ONVIF::PTZ)
Error: Package: zoneminder-1.27onvif-1.el6.x86_64 (/zoneminder-1.27onvif-1.el6.x86_64)
           Requires: perl(ONVIF::Device)
Error: Package: zoneminder-1.27onvif-1.el6.x86_64 (/zoneminder-1.27onvif-1.el6.x86_64)
           Requires: perl(ONVIF::Media)

It seems these specific modules are not defined, but are listed as a requirement in the onvif-control.pm script.

[abauer@vmcentos ZoneMinder-1.27onvif]$ grep -r "ONVIF::PTZ;" ./
./onvif/modules/lib/ZoneMinder/Control/onvif-control.pm:require ONVIF::PTZ;

[abauer@vmcentos ZoneMinder-1.27onvif]$ grep -r "ONVIF::Device;" ./
./onvif/modules/lib/ZoneMinder/Control/onvif-control.pm:require ONVIF::Device;

[abauer@vmcentos ZoneMinder-1.27onvif]$ grep -r "ONVIF::Media;" ./
./onvif/modules/lib/ZoneMinder/Control/onvif-control.pm:require ONVIF::Media;

Should these require statements be more specific? e.g. require ONVIF::Media:Some::Module

UPDATE: upon closer inspection, perhaps these require statements are not needed at all.

@altaroca
Copy link
Contributor Author

altaroca commented Aug 3, 2014

Please disregard this script onvif-control.pm . It is mostly an empty template. I do not have access to an ONVIF PTZ cam and therefore did not implement this script.
With all the API in ONVIF::PTZ in place it should be easy to finish, though. If someone can test with their camera I am willing to try an implementation.

@knight-of-ni
Copy link
Member

OK, I understand now.

I have opened a pull request against your 478-onvif-support branch that will move the control script into the same place as the other control scripts. I've also added a database entry for it so it shows up in the UI. This will allow others to test it, and at the same time allow a packaged version of zoneminder to install w/o dependency issues.

altaroca#2

Hope that helps.

@knight-of-ni
Copy link
Member

@altaroca Thanks for merging that pull request. Any chance you can merge this one too?
altaroca#1

All it does is make the rpm packaging scripts aware of the new onvif folders added to the source tree.
Technically I could add these changes later, but merging this into your pull requests makes it easier to reference.

@altaroca
Copy link
Contributor Author

altaroca commented Aug 4, 2014

Sure. I did not see that one. This is my first experience with github.

@altaroca
Copy link
Contributor Author

altaroca commented Aug 7, 2014

I have done the changes you proposed. It builds and works on my box.
I had to include an earlier change to the same script as well.

@knight-of-ni
Copy link
Member

Think we regressed a little bit with commit 5ab6298

client.pm is looking for these packages, but they do not appear to be defined:

--> Finished Dependency Resolution
Error: Package: zoneminder-1.27onvif-6.el6.x86_64 (/zoneminder-1.27onvif-6.el6.x86_64)
           Requires: perl(ONVIF::Analytics::Interfaces::Analytics::RuleEnginePort)
Error: Package: zoneminder-1.27onvif-6.el6.x86_64 (/zoneminder-1.27onvif-6.el6.x86_64)
           Requires: perl(ONVIF::Analytics::Interfaces::Analytics::AnalyticsEnginePort)

@altaroca
Copy link
Contributor Author

altaroca commented Aug 8, 2014

Those are parts of more APIs I am working on. I removed the references to keep things simple for the time being.

@knight-of-ni
Copy link
Member

Hmmmm.... now I'm stuck. Clicking "ONVIF" from the UI produces error 255.
Executing "/usr/bin/zmonvif-probe.pl probe" from the command line returns "Error deserializing message: Bad namespace for SOAP envelope:"

Here is the full output:

<Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>SOAP-ENV:Server</faultcode><faultstring>Error deserializing message: Bad namespace for SOAP envelope: &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=&quot;http://www.w3.org/2003/05/soap-envelope&quot; xmlns:SOAP-ENC=&quot;http://www.w3.org/2003/05/soap-encoding&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:wsa=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot; xmlns:d=&quot;http://schemas.xmlsoap.org/ws/2005/04/discovery&quot; xmlns:d3=&quot;http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding&quot; xmlns:d4=&quot;http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding&quot; xmlns:dn=&quot;http://www.onvif.org/ver10/network/wsdl&quot;&gt; at /usr/share/perl5/vendor_perl/SOAP/WSDL/Expat/MessageParser.pm line 92.
at line 2 at /usr/share/perl5/vendor_perl/SOAP/WSDL/Expat/Base.pm line 82
.
Message was:
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=&quot;http://www.w3.org/2003/05/soap-envelope&quot; xmlns:SOAP-ENC=&quot;http://www.w3.org/2003/05/soap-encoding&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:wsa=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot; xmlns:d=&quot;http://schemas.xmlsoap.org/ws/2005/04/discovery&quot; xmlns:d3=&quot;http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding&quot; xmlns:d4=&quot;http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding&quot; xmlns:dn=&quot;http://www.onvif.org/ver10/network/wsdl&quot;&gt;&lt;SOAP-ENV:Body&gt;&lt;SOAP-ENV:Fault&gt;&lt;faultcode&gt;SOAP-ENV:VersionMismatch&lt;/faultcode&gt;&lt;faultstring&gt;Invalid SOAP message or SOAP version mismatch&lt;/faultstring&gt;&lt;/SOAP-ENV:Fault&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;</faultstring><faultactor>urn:localhost</faultactor></Fault>

Tracing things back, it seems the sub ProbeOp in WSDiscovery.pm is causing this, but that's as far as I'm able to get at the moment. Thoughts?

@altaroca
Copy link
Contributor Author

altaroca commented Aug 9, 2014

I don't know your setup. So I can only guess:
There seems to be some device responding to the ProbeOp-Request. This device is using ONVIF namespaces. So it is ONVIF-aware. However it does not recognize our namespace "http://schemas.xmlsoap.org/soap/envelope/" but instead wants to use "http://www.w3.org/2003/05/soap-envelope". This is basically a SOAP version mismatch. The ONVIF wsdl files I have seen all use the former namespace. That means the device is slighlty deviating from the specification.

I had hoped there would be no quirks. Sigh.

XML parsers can be really bitchy about namespaces. Although the rest of the message is perfectly in order they refuse to understand it.

I will figure out how to send and receive messages using both dialects.

@altaroca
Copy link
Contributor Author

The zmonvif-probe.pl script now scans using both SOAP versions. Please give it another try. I cannot really test it because my camera works fine with SOAP 1.1.

@Kanuk
Copy link

Kanuk commented Aug 18, 2014

altaroca, I could try, but do not know how to add Onvif in ZM. Publish the instructions please, and I can test the script on two cameras.

@altaroca
Copy link
Contributor Author

Great! Thank you for your support @Kanuk.
Just clone this branch to you local machine. I suppose this should do the trick:
$ git clone -b 478-onvif-support https://github.com/altaroca/ZoneMinder.git

Then build and install as you always do. In the monitor tab in ZoneMinder you should then have a new button "ONVIF". Please see the screenshots in http://altaroca.wordpress.com/2014/07/14/onvif-probing-for-zoneminder/ for a test walkthrough.

@dreyks
Copy link

dreyks commented Aug 18, 2014

@altaroca I've installed your zoneminder branch, but when i press the ONVIF button I get 'Unable to probe network cameras, status is '2''
this is my first try with ZM so I can possibly have misconfigured something

@altaroca
Copy link
Contributor Author

@dreyks could you try and run
$ /usr/local/bin/zmonvif-probe.pl probe
from the command line? This is the default path. Depending on your installation the script might be located somewhere else.
This should give a more verbose output.

@dreyks
Copy link

dreyks commented Aug 18, 2014

@altaroca It seems to miss the Class/Std/Fast.pm in INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl
I'm not very perl-friendly =) should I install some additional libs?

@altaroca
Copy link
Contributor Author

I will have to include this in the package dependencies. Please try to install SOAP::WSDL and have it pull all its dependencies in turn. The rpm should be named "perl-SOAP-WSDL_.rpm" or "libsoap-wsdl_.rpm".
If you do not find a rpm for your distro try this:
$ cpan App::cpanminus
$ cpanm SOAP::WSDL

@dreyks
Copy link

dreyks commented Aug 18, 2014

It's libsoap-wsdl-perl on Ubuntu.

Also it was looking for

  • Data/Dump.pm which is libdata-dump-perl on Ubuntu
  • Digest/SHA1.pm which is not in ubuntu reps anymore, tried "sudo perl -MCPAN -e'install Digest::SHA1'" (this was suggested by someone I found googling) but still no luck

tried installing sha1 from http://launchpadlibrarian.net/85191944/libdigest-sha1-perl_2.13-2build2_amd64.deb but it is incompatible "Perl API version v5.14.0 of Digest::SHA1 does not match v5.18.0 at /usr/lib/perl/5.18/DynaLoader.pm line 207."

@knight-of-ni
Copy link
Member

On my Ubuntu 14.04 workstation, I can see libdigest-sha-perl in the universe repo.
You will also need libio-socket-multicast-perl.

@dreyks
Copy link

dreyks commented Aug 18, 2014

I've tried libdigest-sha-perl already, it's not the same.

cpanm -i Digest::SHA1 did the trick. Proceeding to socket now

Ok. everything is ok now, will continue testing later. Thanks

@knight-of-ni
Copy link
Member

That's weird. The description says it has SHA-1 in it. Wonder if the hyphen is messing things up.

@knight-of-ni
Copy link
Member

Over the weekend I tested the latest change that includes SOAP 1.2 support.
I didn't receive any errors this time, but zoneminder was unable to find any camera on my network.
Exectuing "zmonvif-probe.pl probe" from the command line returned nothing at all.

A packet capture revealed three cameras responded with ws-discovery packets to zoneminder. The contents of the packets contained xml that included a SOAP 1.2 namespace. I can provide all or part of the packet capture if you think it would help.

@altaroca
Copy link
Contributor Author

@knnniggett the packets' xml content would surely help. For the next commit I will include a kind of debug mode that prints the received xml content.

@knight-of-ni
Copy link
Member

Well, it looks like I saved the packet capture in a place I can't get to from my $dayjob. I'll post the data later this evening.

In the meantime, just thought I'd point out the following in case you haven't figured it out already.
The ZoneMinder::Logger package includes functions like Debug, Info, Fatal, etc. that will create log entries in the dB for you:
https://github.com/ZoneMinder/ZoneMinder/blob/master/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm

@knight-of-ni
Copy link
Member

I'll try to make this as readalbe as I can. Here are the details from my packet capture.

IP Addresses of server & potential ONVIF devices

ZoneMinder - 192.168.1.197
Granstream GXV 3504 four channel video encoder - 192.168.1.175
Granstream GXV 3500 one channel video encoder - 192.168.1.80
Foscam FI9821w indoor ptz camera - 192.168.1.81

Relevant Packet Info

192.168.1.197:3702 -> 239.255.255.250:3702 -> initial UDP multicast to discover devices

192.168.1.175:3702 -> 192.168.1.197:3702 -> UDP response from first device containing the following data:
<?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: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:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:d3="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:d4="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:VersionMismatch</faultcode><faultstring>Invalid SOAP message or SOAP version mismatch</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

192.168.1.80:3702 -> 192.168.1.197:3702 -> UDP response from second device containing the following data:
<?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: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:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:d3="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:d4="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:VersionMismatch</faultcode><faultstring>Invalid SOAP message or SOAP version mismatch</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

192.168.1.81:3702 -> 239.255.255.250:3702 -> Notice that the response from the third device was different. Instead of a unicast response, it responded with a multicast of its own with the following data:
<?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: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: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:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl"><SOAP-ENV:Header><wsa:MessageID>uuid:16cd635-b10e-ed4c-a7f9-4e3c798d8637</wsa:MessageID><wsa:To SOAP-ENV:mustUnderstand="true">urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To><wsa:Action SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2005/04/discovery/Hello</wsa:Action></SOAP-ENV:Header><SOAP-ENV:Body><wsdd:Hello><wsa:EndpointReference><wsa:Address>88d87a05-d7f7-7e45-b1e9-00626E4CE675</wsa:Address></wsa:EndpointReference><wsdd:Types>tdn:NetworkVideoTransmitter</wsdd:Types><wsdd:Scopes>onvif://www.onvif.org/type/Network_Video_Transmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/type/audio_encoder onvif://www.onvif.org/hardware/IPC-model onvif://www.onvif.org/name/IPC-model onvif://www.onvif.org/type/ptz onvif://www.onvif.org/location/country/china</wsdd:Scopes><wsdd:XAddrs>http://192.168.1.81:888/onvif/device_service</wsdd:XAddrs><wsdd:MetadataVersion>1</wsdd:MetadataVersion></wsdd:Hello></SOAP-ENV:Body></SOAP-ENV:Envelope>

I have not had time to repeat this with verbosity turned on. Looks like I'll try that tomorrow night.

@altaroca
Copy link
Contributor Author

The script sends first a SOAP 1.1 Probe message, then collects responses for two seconds. And then does the same for SOAP 1.2.
The first two message are responses that complain about an invalid SOAP version. I'd like to know whether these are responses to the script's first (SOAP 1.1) message or to the second (SOAP 1.2) message.

I think the third XML message is not part of this conversation. It is a Hello message. Devices send this kind of message typically of their own accord when they are connected to the network or when some internal configuration has changed.

@knight-of-ni
Copy link
Member

Here is the output after performing "zmonvif-probe.pl probe -v":

Probing for SOAP 1.1
Received message:
ARRAY(0x12d8660)
Error deserializing message:
<Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>SOAP-ENV:Server</faultcode><faultstring>Error deserializing message: 
not well-formed (invalid token) at line 1, column 5, byte 5 at /usr/share/perl5/vendor_perl/SOAP/WSDL/Expat/Base.pm line 79
 at line 1 at /usr/share/perl5/vendor_perl/SOAP/WSDL/Expat/Base.pm line 82
. 
Message was: 
ARRAY(0x12d8660)</faultstring><faultactor>urn:localhost</faultactor></Fault>
Received message:
HASH(0x12d8768)
Error deserializing message:
<Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>SOAP-ENV:Server</faultcode><faultstring>Error deserializing message: 
not well-formed (invalid token) at line 1, column 4, byte 4 at /usr/share/perl5/vendor_perl/SOAP/WSDL/Expat/Base.pm line 79
 at line 1 at /usr/share/perl5/vendor_perl/SOAP/WSDL/Expat/Base.pm line 82
. 
Message was: 
HASH(0x12d8768)</faultstring><faultactor>urn:localhost</faultactor></Fault>
Probing for SOAP 1.2
Received message:
<?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: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:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:d3="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:d4="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><SOAP-ENV:Body><SOAP-ENV:Fault><SOAP-ENV:Code><SOAP-ENV:Value>SOAP-ENV:Sender</SOAP-ENV:Value><SOAP-ENV:Subcode><SOAP-ENV:Value>ter:InvalidArgVal</SOAP-ENV:Value></SOAP-ENV:Subcode></SOAP-ENV:Code><SOAP-ENV:Reason><SOAP-ENV:Text xml:lang="en">Method 'Probe' not implemented: method name or namespace not recognized</SOAP-ENV:Text></SOAP-ENV:Reason></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
Error deserializing message:
<Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>
Received message:
<?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: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:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:d3="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:d4="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><SOAP-ENV:Body><SOAP-ENV:Fault><SOAP-ENV:Code><SOAP-ENV:Value>SOAP-ENV:Sender</SOAP-ENV:Value><SOAP-ENV:Subcode><SOAP-ENV:Value>ter:InvalidArgVal</SOAP-ENV:Value></SOAP-ENV:Subcode></SOAP-ENV:Code><SOAP-ENV:Reason><SOAP-ENV:Text xml:lang="en">Method 'Probe' not implemented: method name or namespace not recognized</SOAP-ENV:Text></SOAP-ENV:Reason></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
Error deserializing message:
<Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>
Received message:
<?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: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: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-Use of uninitialized value $result in concatenation (.) or string at /usr/bin/zmonvif-probe.pl line 107.
200401-wss-wssecurity-secext-1.0.xsd" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl"><SOAP-ENV:Header><wsa:MessageID>uuid:61a334e0-4a36-174e-a7cc-ccb022e6c280</wsa:MessageID><wsa:To SOAP-ENV:mustUnderstand="true">urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To><wsa:Action SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2005/04/discovery/Hello</wsa:Action></SOAP-ENV:Header><SOAP-ENV:Body><wsdd:Hello><wsa:EndpointReference><wsa:Address>88d87a05-d7f7-7e45-b1e9-00626E4CE675</wsa:Address></wsa:EndpointReference><wsdd:Types>tdn:NetworkVideoTransmitter</wsdd:Types><wsdd:Scopes>onvif://www.onvif.org/type/Network_Video_Transmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/type/audio_encoder onvif://www.onvif.org/hardware/IPC-model onvif://www.onvif.org/name/IPC-model onvif://www.onvif.org/type/ptz onvif://www.onvif.org/location/country/china</wsdd:Scopes><wsdd:XAddrs>http://192.168.1.81:888/onvif/device_service</wsdd:XAddrs><wsdd:MetadataVersion>1</wsdd:MetadataVersion></wsdd:Hello></SOAP-ENV:Body></SOAP-ENV:Envelope>

Error deserializing message:

Received message:
HASH(0x12d8768)
Error deserializing message:
<Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>SOAP-ENV:Server</faultcode><faultstring>Error deserializing message: 
not well-formed (invalid token) at line 1, column 4, byte 4 at /usr/share/perl5/vendor_perl/SOAP/WSDL/Expat/Base.pm line 79
 at line 1 at /usr/share/perl5/vendor_perl/SOAP/WSDL/Expat/Base.pm line 82
. 
Message was: 
HASH(0x12d8768)</faultstring><faultactor>urn:localhost</faultactor></Fault>

@altaroca
Copy link
Contributor Author

@knnniggett you are right of course about ZoneMinder::Logger and GetOpt.

As for the messages: I don't think these devices are onvif compliant. Their implementation of WS-Discovery is lacking. The Granstreams say they don't support the "Probe" method and the Foscam seems to reply with a "Hello" message always. The correct answer to a "Probe" message would be a "ProbeMatches" message. I am glad however that all three devices understand our SOAP 1.2 and don't complain about SOAP version mismatches anymore.

If we go by the onvif specs then it is correct for the script not to return any matches for these devices. We could argue that the Hello message in this case contains all the necessary information to continue the automatic configuration. Let's try the next step manually for the Foscam.

$ zmonvif-probe.pl profiles -v <URI> <SOAP ver> <user> <password>
should return the camera's stream uri(s). SOAP version is "1.2" and the URI to use is "http://192.168.1.81:888/onvif/device_service" from the message above.

@knight-of-ni
Copy link
Member

Not good.

$ zmonvif-probe.pl profiles -v http://192.168.1.176:888/onvif/device_service 1.2 admin mypassword

returns:
<Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>

Experimenting a bit.
Changing the username or password to something completely incorrect or nothing at all gives the exact same output. Removing "/onvif/device_service" from the URI gives the exact same output as well.

On another note, the Granstream devices are advertised as fully ONVIF compliant, so I have opened a trouble ticket with the mfr and await a response from them.

@ibslkvic
Copy link

$ sudo /usr/bin/zmonvif-probe.pl probe
Use of uninitialized value $ARGV[0] in string eq at /usr/bin/zmonvif-probe.pl line 280.
Use of uninitialized value in concatenation (.) or string at /usr/share/perl5/SOAP/WSDL/Client.pm line 205.

This is the error i get should I wait for complete list of cpan dependencies?
Thanks,
Vic

@knight-of-ni
Copy link
Member

@ibslkvic
Known issue. I'm sure it will get fixed, but in the meantime you need to pass at least two arguments to zmonvif-probe. e.g. zmonvif-probe probe -v. See the previous posts.

@knight-of-ni
Copy link
Member

We are getting ready to release zoneminder 1.28.0, and I am still on the fence as to when we should add ONVIF support.

I purchased a new camera from Urban Security Group, and it did not respond to the onvif probes so I am 0 for 3. On the other hand I think we might get more feedback if we merge this into the next release and let others ge their hands on it. With more data I think it would help us determine if we are dealing with manufacturers who don't implement onvif correctly or if there is something in the code we can make more flexible.

What I think we ought to do is make ONVIF support optional, label it as experimental, and give a install default of "NO". What do you think?

@kylejohnson
Copy link
Member

What about releasing 1.28 and then merging it into master for testing?

@connortechnology
Copy link
Member

I think we should be in feature freeze fr 1.28, so my vote is merge after release. Sounds like it needs more work/testing anyways. Not something you want the masses complaining about because it doesn't work.

@altaroca
Copy link
Contributor Author

Merge after release. My day job has me occupied these weeks.
But you are right @knnniggett we do need more data. Something like a compatibility list for ONVIF devices would be great.

@knight-of-ni
Copy link
Member

@altaroca I created a couple pull requests against your onvif branch.
The first should get zoneminder building against autotools again.
The second makes onvif support optional.

@knight-of-ni knight-of-ni modified the milestones: 1.29.0, ONVIF Nov 1, 2014
@liucougar
Copy link
Contributor

is it easier to use https://github.com/ltoscano/ponvif as the onvif client library?

@altaroca
Copy link
Contributor Author

that library supports only a small subset of the onvif specifications.

@knight-of-ni knight-of-ni merged commit e0a43ad into ZoneMinder:master Feb 19, 2015
@knight-of-ni
Copy link
Member

Guys, this has been a long time coming, and my apologies for not merging this sooner.
ONVIF support has been merged, but it is off by default.
You have to set --enable-onvif=yes flag in autotools or ZM_ONVIF=ON flag in cmake.

@connortechnology
Copy link
Member

excellent work. I believe one of my cameras does onvif so I will test.

@knight-of-ni
Copy link
Member

TO DO:

  • Need to add the ONVIF PTZ camera control type to a zm_update-1.28.2.sql
  • Need to disable the link to the ONVIF probe when support is not compiled in
  • Need to document how to use it within zoneminder. Maybe we just link to the author's webpage.

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

Successfully merging this pull request may close these issues.

None yet

8 participants