Closed tukey42 closed 1 year ago
We will need to see all the XML being between the camera and the ONVIF library but it would be faster if we could have remote access to the camera for a few days (a few days to cover time zone differences and when I have a spare 10 minute).
Thanks for your reply and taking care of this issue. I will try to figure out, how I can give you a secure access to the camera. In the meantime is there a debugging version of the library, which dumps the traffic?
I've had a look at motion-onvif-events. I noticed that if you use the wrong onvif username/password then motion-onvif-events does not exit. It continues on and will eventually fail with a Pull Point Subscription Error.
I've forked motion-onvif-events and fixed this so motion-onvif-events exits if the password is wrong or if it cannot connect to the camera properly (and prints the error).
Can you try my forked version please. it is here...
I already tested with a wrong password. If I do it I got the error message: (node:2825) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'events' of undefined which is different from the error when specifying a correct password. With your new version I get the same result then before with a correct password and the error message Error connecting to ONVIF Camera Error: ONVIF SOAP Fault: Sender not Authorized when specifying an incorrect password.
Am 15.03.2020 um 10:42 schrieb Roger Hardiman notifications@github.com:
I've had a look at motion-onvif-events. I noticed that if you use the wrong onvif username/password then motion-onvif-events does not exit. It continues on and will eventually fail with a Pull Point Subscription Error.
I've forked motion-onvif-events and fixed this so motion-onvif-events exits if the password is wrong or if it cannot connect to the camera properly (and prints the error).
Can you try my forked version please. it is here...
https://github.com/RogerHardiman/motion-onvif-events https://github.com/RogerHardiman/motion-onvif-events — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/agsh/onvif/issues/154#issuecomment-599187937, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGIOUPK44BDGT2W3A3JCS4DRHSPHXANCNFSM4LF7S4AA.
Anything else I can do like putting debug messages in the code or give you access to the camera?
1) ...or give you access to the camera? you can get my contact details from www.rjh.org.uk so we can swap emails on remote access
2)...debug messages the library has two emits rawRequest and rawResponse. you can listen for these events to catch the raw XML here is an example for the motion-onvif-events where I've added to the createCamera() function
static createCamera(conf) {
return new Promise(resolve => {
const cam = new Cam(conf, (err) => {
if (err) {
console.log('Error connecting to ONVIF Camera ' + err);
process.exit();
}
resolve(cam)
});
// I added the code below to catch the camera events and write to the console
const logXML = true;
if (logXML) {
cam.on('rawRequest', xml => console.log('REQUEST\n',xml,'\nREQUEST END'));
cam.on('rawResponse', xml => console.log('RESPONSE\n',xml,'\nRESPONSE END'));
}
})
}
Thank you for the remote access and testing with ODM (in private emails).
The problem is that there are two types of ONVIF Event. a) PullPoint subscription and b) Base Subscription.
This library uses PullPoint. INSTAR camera only supports Base Subscription.
So it needs someone to help write the extra Base Subscription Support. This is where you start up a HTTP Server inside this ONVIF library (eg on Port 8088) and then tell the Camera the TCP Port number. The camera then sends events to this library. I'm pretty sure the event comes in the same format as replies to Pull Requests so the changes are a) start a HTTP Server (and handle errors if it cannot start) with a user Option for the HTTP Port number. b) have an Option to allow the user to select which type of event type they want (PullPoint or Base or a failover from one type to the other) c) Wait for XML messages on the HTTP Server and call the existing code to handle XML event messages.
@RogerHardiman Hi! I don't have possibilities to check the base subscription. Can you allow acces to your cams to check base supcription?
Fixit in onvif2mqtt. Call createPullPointSubscription and if it ok, then subscribe https://github.com/dmitrif/onvif2mqtt/blob/master/src/onvif/Subscriber.js#L40
I am using motion-onvif-events to forward motion detection from my cameras to my motion installation. It works fine for a Hikvision camera but fails for my new INSTAR IN-8015HD. When starting the porgram I am getting the following error messages: `/usr/local/lib/node_modules/motion-onvif-events/node_modules/onvif/lib/events.js:188 throw new Error('You should create pull-point subscription first!'); ^
Error: You should create pull-point subscription first! at Cam.pullMessages (/usr/local/lib/node_modules/motion-onvif-events/node_modules/onvif/lib/events.js:188:10) at Cam._eventPull (/usr/local/lib/node_modules/motion-onvif-events/node_modules/onvif/lib/events.js:311:9) at Cam. (/usr/local/lib/node_modules/motion-onvif-events/node_modules/onvif/lib/events.js:100:13)
at parseSOAPString (/usr/local/lib/node_modules/motion-onvif-events/node_modules/onvif/lib/utils.js:108:3)
at IncomingMessage. (/usr/local/lib/node_modules/motion-onvif-events/node_modules/onvif/lib/cam.js:214:4)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)`
motion-onvif-events initially used nickw444/onvif, but I changed it to this version, because it has more recent changes. Unfortunately the error is the same. Any idea what happens or how to debug it?