agsh / onvif

ONVIF node.js implementation
http://agsh.github.io/onvif/
MIT License
692 stars 234 forks source link

Error: ONVIF SOAP Fault: Action Not Implemented #200

Closed Bec-k closed 2 years ago

Bec-k commented 3 years ago
capabilities: {
  WSPausableSubscriptionManagerInterfaceSupport: true,
  WSPullPointSupport: true,
  WSSubscriptionPolicySupport: true,
  MaxNotificationProducers: 10,
  MaxPullPoints: 5,
  PersistenNotificationStorage: false
}

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?

Bec-k commented 3 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'
  }
}
agsh commented 3 years ago

@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)

RogerHardiman commented 3 years ago

what make and model of camera is it?

Bec-k commented 2 years ago

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.

Bec-k commented 2 years ago

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.

Bec-k commented 2 years ago

If i'll have more time, i'll report in this thread.

RogerHardiman commented 2 years ago

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

Bec-k commented 2 years ago
  1. Camera is Boavision, this one https://www.boavision.com/outdoor-ip-camera-5mp-4g-sim-card-wifi-ai-auto-tracking-30x-zoom-wireless-ptz-speed-dome-cctv-camera-two-way-audio-ir-80m-camhi_p34295.html
  2. I was using your library and another js library, will link later, both failed. Tried some python lib as well.
  3. Nope only Onvif, that app is not designed specifically for my camera, it is using Onvif discovery feature to detect any Onvif camera available in local network.
  4. Good question, i got your point. I'll try to sniff for raw traffic coming between them. It shouldn't be encrypted. I'll see whether this is possible in my current, local network.
  5. Interesting! Good point as well, i suspect that this is my case :( The problem is that most those chinese cameras as using mostly one or two firmware and share it between most of cameras available on the market... I suspect that this is the case, can you give more details about it? Maybe this check can be built in the library, to detect that scenario of camera interaction, because CamHiPro is working some way. I'll post here some sniffer details when i get them and possibly raw XML of SOAP interaction between them.
RogerHardiman commented 2 years ago

Hi @denissabramovs Thanks for the update. Will be interesting to see what we can figure out from network logs.

Roger

Bec-k commented 2 years ago

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...

Bec-k commented 2 years ago

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

Bec-k commented 2 years ago

traffic is encrypted

Bec-k commented 2 years ago

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.

Bec-k commented 2 years ago

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...

RogerHardiman commented 2 years ago

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.

chriswiggins commented 2 years ago

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!

RogerHardiman commented 2 years ago

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.

RogerHardiman commented 2 years ago

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

Bec-k commented 2 years ago

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?

RogerHardiman commented 2 years ago

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

Bec-k commented 2 years ago

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.

Bec-k commented 2 years ago

It's more like webhook implementation. By the first look.