Camera control script (token)

Forum for questions and support relating to the 1.30.x releases only.
Locked
jaywest
Posts: 6
Joined: Tue Nov 22, 2016 7:54 pm

Camera control script (token)

Post by jaywest »

I've seen cameras that let you just add the username and password on the cgi POST etc... but I've come across something different...

The camera I'm working with, you send a PUT request with a login command and receive back a token (application octetstream or JSON). You then supply this token on all future commands, and it expires, etc..

Is there any native support for this type of camera control (specifically PTZ controls)? Do any of the supplied scripts allow this "authenticate once and keep the token to use on each command"? I can see scope issues depending on how zoneminder implements this type of thing....

A "well known camera mfg" was kind enough to let me see the not-publicly-available API, so I'd really like to implement it unless this two-step authentication isn't really possible...
billchurch
Posts: 3
Joined: Fri Dec 16, 2016 1:29 pm

Re: Camera control script (token)

Post by billchurch »

Yuk... :P

Well, I can help out with this... Why do they have to make stuff so difficult. Is this how their ONVIF support works? It didn't seem like to me this was the standard but honestly I just skimmed a lot of the docs.

I didn't love that the port wasn't over SSL, maybe this is the reasoning behind it.
User avatar
iconnor
Posts: 3272
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Camera control script (token)

Post by iconnor »

This should be fairly trivial. The way that our PTZ scripts work is that zmcontrol fires up a copy of itself that lingers... so the returned token will stay around in the running process.
jaywest
Posts: 6
Joined: Tue Nov 22, 2016 7:54 pm

Re: Camera control script (token)

Post by jaywest »

Well, per my boss/client, this is now a high priority of mine ;)

So the basic gist is, a PUT returns a JSON or octetstream that contains a token which is ascii text, letters and numbers, perhaps around 15 characters or so. All future commands for pan/tilt/zoom (actually any and all settings/commands) just include a "&token=aj3j23kl2jaxxxxxx" type thing at the end. The token expires every 3600, but can be re-activated (think like an http 'keep-alive' but after the fact).

Can anyone suggest which supplied camera control script would be a fair starting point for this type of architecture? Or any of them? Particularly the scope of the token and such.... Or contact me via PM for details.
Locked