-
Notifications
You must be signed in to change notification settings - Fork 11
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
Onvif Device URLs #52
Comments
I am reviewing this and will get back to you thanks. |
@patrickmichalina Did you have a chance to review this further? If it helps, I'm currently using a snippet like this to 'override' certain URLs so that they work. const debug = require('debug')('onvif-rx');
const _ = require('lodash');
const services = [
'Event',
'Media',
'Analytics',
'Display',
'Imaging',
'Provisioning',
'PTZ',
'Receiver',
'Recording',
'Replay',
'Search',
'AdvancedSecurity'
];
const OnvifRxCamera = {
create({ ip, port, username, password }) {
const rxcam = onvifrx.createManagedDeviceInNode({
username,
password,
deviceUrl: `http://${ip}:${port || 80}/onvif/device_service`
});
rxcam.connect = async function () {
const { Capabilities } = await this.api.Device.GetCapabilities();
debug(ip, port, Capabilities);
services.forEach((service) => {
const { XAddr } = Capabilities[service] || Capabilities[`${service}s`] || {};
if (!XAddr) return;
const conf = _.omit(rxcam.api.Device.config, ['deviceUrl']);
const url = new URL(XAddr);
conf.deviceUrl = `http://${ip}:${port || 80}${url.pathname}`;
debug(ip, port, service, conf.deviceUrl);
rxcam.api[service].config = conf;
});
};
return rxcam;
}
};
module.exports = OnvifRxCamera; |
@Mudrekh Kinda. I was actually just rewriting the library, but it hasn't been a priority at the moment. |
@Mudrekh I remember I needed to do this from the start but was being a little lazy and didn't get around to it because the Amcrest cameras I was testing against were happy using the default. |
@patrickmichalina OK, no problem. For now the snippet I have works, but would would love to have a built-in solution. |
Hi @patrickmichalina
We came accross an issue with certain devices relating to the URLs used to interface with the device. The default url to interface with the device is at
http://<IP>/onvif/device_service
. While some manufacturers seem to publish the entire ONVIF API on the device_service route, some do not. For example, we were using an ADVIDIA camera that actually only published services on their specific routes. For reference, I believe the actual ONVIF interface guide recommends that you actually call Device.GetCapabilities first to determine what services the device supports as well as get the URLs for different services.Have you come upon this issue and thought about how you would solve it using the 'Managed' api? Based on the 'Ad Hoc' usage you could probably get around it, but having to supply the configs everytime seems tedius and more error prone.
The ADVIDIA camera we were testing with returns this data for Capabilities. Using the XAddr's supplied for each service returns correctly, where as calls made to services not on the default URL result in 'Optional Operation Not Supported'
The text was updated successfully, but these errors were encountered: