Closed Bec-k closed 2 years ago
When calling GetEventProperties
action, we are getting:
{
GetEventPropertiesResponse: {
TopicNamespaceLocation: 'http://www.onvif.org/ver10/topics/topicns.xml',
FixedTopicSet: 'true',
TopicSet: {
VideoSource: {
GlobalSceneChange: {
ImagingService: {
'$': { 'wstop:topic': 'true' },
MessageDescription: {
'$': { IsProperty: 'true' },
Source: {
SimpleItemDescription: [
{
'$': { Name: 'Source', Type: 'tt:ReferenceToken' }
},
{
'$': { Name: 'MaskWindow', Type: 'tt:ReferenceToken' }
}
]
},
Data: {
SimpleItemDescription: { '$': { Name: 'State', Type: 'xsd:boolean' } }
}
}
},
AnalyticsService: {
'$': { 'wstop:topic': 'true' },
MessageDescription: {
'$': { IsProperty: 'true' },
Source: {
SimpleItemDescription: { '$': { Name: 'Source', Type: 'tt:ReferenceToken' } }
},
Data: {
SimpleItemDescription: { '$': { Name: 'State', Type: 'xsd:boolean' } }
}
}
}
},
MotionAlarm: {
'$': { 'wstop:topic': 'true' },
MessageDescription: {
'$': { IsProperty: 'true' },
Source: {
SimpleItemDescription: [
{ '$': { Name: 'Source', Type: 'tt:ReferenceToken' } },
{
'$': { Name: 'DetectWindow', Type: 'tt:ReferenceToken' }
}
]
},
Data: {
SimpleItemDescription: { '$': { Name: 'State', Type: 'xsd:boolean' } }
}
}
}
},
RuleEngine: {
CellMotionDetector: {
Motion: {
'$': { 'wstop:topic': 'true' },
MessageDescription: {
'$': { IsProperty: 'true' },
Source: {
SimpleItemDescription: [
{
'$': {
Name: 'VideoSourceConfigurationToken',
Type: 'tt:ReferenceToken'
}
},
{
'$': {
Name: 'VideoAnalyticsConfigurationToken',
Type: 'tt:ReferenceToken'
}
},
{ '$': { Name: 'Rule', Type: 'xs:string' } }
]
},
Data: {
SimpleItemDescription: { '$': { Name: 'IsMotion', Type: 'xs:boolean' } }
}
}
}
}
}
},
TopicExpressionDialect: [
'http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet',
'http://docs.oasis-open.org/wsn/t-1/TopicExpression/Concrete'
],
MessageContentFilterDialect: 'http://www.onvif.org/ver10/tev/messageContentFilter/ItemFilter',
MessageContentSchemaLocation: 'http://www.onvif.org/ver10/schema/onvif.xsd'
}
}
@denissabramovs Hi! Action Not Implemented
- this is the message from the camera, not from the library. So, I think, you cam doesn't support this.
You can check if PullPoint is available from another implementation, for example, https://sourceforge.net/projects/onvifdm/
If it works, please, let me know)
what make and model of camera is it?
ONVIF Device Manager was not able to obtain events as well, but i have managed to obtain events from android app CamHipro
, so this is working, just need to investigate why it is not working in your case.
I can connect to Onvif service and do PTZ commands, but can't get events. If i'm not wrong there is 2.4 version of Onvif.
If i'll have more time, i'll report in this thread.
Hi Some questions for you @denissabramovs
1) what make and model of camera is it (I have Axis, Bosch, Canon, Sony, HikVision, Hanwha and Avigilon in my office)
2) have you written your own test code to use the ONVIF library, or were you running 'example6.js' which is an example program that subscribes to all events. I wondered what example6.js does with your camera
3) Is CamHiPro using ONVIF Events to talk to your camera, or could it be using a camera specific API?
4) Would it be possible to network monitor/wireshark etc the connection between Android CamHiPro and your camera? Eg Android->Access Point->Switch with port mirror -> Camera. Switch also connects to computer with Wireshark on mirrored port
5) I've seen some cheaper chinese cameras that don't support PullPoint even though advertised. They only support the method where the camera sends the Event out. ODM can be set to run in this mode too. But unless I'm mistaken, the agsh/onvif library does not support this yet. We'd have to make some changes as you have to tell the camera the IP address and Port for the camera to send the Event to.
I have a specific interest in all of this. I use the agsh/onvif library for events in some other projects so am keen to ensure it works on as wide a range of cameras as possible.
Roger Hardiman onvif library developer
Hi @denissabramovs Thanks for the update. Will be interesting to see what we can figure out from network logs.
Roger
Yes, you were right, it is not using Onvif. It is using some other means to deliver events and it seems that this is some RPC and not even API... I haven't seen any interaction with 8080 port at all. Neither between ip camera and router, neither between ip camera and phone directly over 8080 port. Phone app is delivering push notifications and it seems that events are being read over some firmware built-in logic...
UDP 192.168.0.12:40433 --> 192.168.0.30:56490 UDP 192.168.0.30:56490 --> 192.168.0.12:40433
.12 is phone and .30 is camera
traffic is encrypted
Just sniffed traffic between my PC and camera and i can see HTTP/XML SOAP interaction with camera. When i'm doing PTZ actions with camera.
So there is no interactions over SOAP/WSDL whatsoever between camera and app. I'm wondering, what means they are using to interact. I suspect that finding sources of camera firmware could open the truth, but whether that is possible, i'm not sure...
A lot of cameras have ONVIF interfaces and their own APIs. So looks like the ONVIF API does enough to let you get the live video stream, but events are not implemented.
You may find it works with ONVIF Device Manager if you go into the Settings page (Screw Driver and Spanner, Top Right of screen) and change events to BASE SUBSCRIPTION. This is the mode where the camera sends the event to the end user all by itself. The other method requires the end user's software to poll every 5 seconds.
I've not added that to this library yet. It requires this library to listen on a network port for incoming messages.
But if you don't get that working, then you are not along. On this Issues Page I've helped several people with low cost 'made in china' cameras that only implement the minimum of ONVIF to let you view live and do PTZ.
It wouldn't be hard to open a web server port for each new Cam instance on a random port and tell the camera to send events to that. Could be worth checking out!
Hi @chriswiggins
For a local network and a trial, a random port per Cam instance is simple and easy and a nice place to start.
But for a real project there would be a firewall between the CCTV control room and the WAN that connects the off-site CCTV Cameras and a random port would be a problem there. We'd need one port open for all Cam instances, and then pass the XML messages back to the correct Cam instance.
Over in the 'roger' branch, example6 now includes the first part of subscriptions. I open one HTTP server for all cam objects and can tell each ONVIF event apart via its POST url.
Works well and will probably roll this out onto a project next month
Will dive into it again, when i get back to Onvif and camera, currently busy with cloud video archive development. Thank you for ideas. That branch 'roger' have examples of communication you mentioned above? In which server is sending events to a specified port on a remote node server?
Hi @denissabramovs Yes, example6 includes the creation of a HTTP server and writing to the console when OVVIF Events come in. It does not feed the events into the event parser yet. But you will see from the command line if the camera is sending events back to the http server that is inside example6.js
Aha, i see, it is here https://github.com/agsh/onvif/blob/roger/example6.js#L168 Will try to find time for it today or tomorrow and test. Thank you very much. Will report back as soon as i test that out.
It's more like webhook implementation. By the first look.
WSPullPointSupport: true
But when i'm trying to create pull point by calling createPullPointSubscription, i'm getting this:
Error: ONVIF SOAP Fault: Action Not Implemented
Is that a problem of camera or a bug?