Commit Graph
40 Commits
Author SHA1 Message Date
singhharsh1708 396aef9639 fix: stop remounting the janus restream every poll when the auth hash ttl is 1 hour 2026-11-16 04:29:32 +05:30
Jash f9a322c917 fix: JSON-escape the monitor name and camera URLs sent to RTSP2Web and Janus refs #5820 2026-11-14 18:49:31 +05:30
Jash 09a9acb151 fix: tolerate a missing RTSP user when building the Go2RTC and Janus restream URL refs #5820 2026-11-14 18:49:31 +05:30
Jash 996fb98a1f fix: stop adding a Janus restream mountpoint twice when its auth is refreshed refs #5820 2026-11-14 18:49:31 +05:30
Jash 4a5419cfc2 fix: read the whole Janus session and handle id instead of a fixed 16 characters refs #5820 2026-11-14 18:49:31 +05:30
Jash 0e7bc439a2 fix: give the Janus, go2rtc and RTSP2Web curl requests connect and total timeouts fixes #5570 2026-11-12 02:18:22 +05:30
Nic BoetandClaude Opus 5.5 c64612e884 fix: stop logging stream credentials in go2rtc, janus and rtsp2web
The go2rtc, Janus and RTSP2Web managers logged the stream URLs and the
request bodies they send: camera user:password@, the RTSP restream's
?auth= hash, ZM_JANUS_SECRET and the Janus stream pin. The Janus line
with ZM_JANUS_SECRET is a Warning, so it reaches the Logs table at the
default database log level whenever Janus is unreachable.

Log URLs through a new url_for_log() (no credentials, no query string),
the pin as a fingerprint, and the request bodies not at all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 10:27:22 -05:00
Isaac ConnorandClaude Opus 5.5 c3ff83fa56 fix: do not use the RTSP restream when ZM_MIN_RTSP_PORT is not set
ZoneMinder's RTSP server only starts when ZM_MIN_RTSP_PORT is set, and it
defaults to empty. The go2rtc and Janus managers decided to use the
restream from the monitor's RTSP Server flag (Janus: its restream flag)
alone, so with the port unset they built rtsp://127.0.0.1:0/<name>.
go2rtc was given that as the monitor's primary stream and as
<id>_ZoneMinderPrimary, neither of which can play; Janus pointed its
mountpoint at it.

Use the restream only when the port is set as well, and warn when a
monitor asks for it without one, so the camera's own stream is used.
MonitorStream applies the same test before choosing the
_ZoneMinderPrimary stream, which is no longer registered in that case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 18:34:04 -04:00
Isaac Connor 5f4304c772 refactor: redesign C++ config to use name-based lookup with compiled-in defaults
Replace numeric ID-based config system with name-based lookup using
std::unordered_map. Config entries now have compiled-in default values,
and only rows where Value != DefaultValue are loaded from the database.
This eliminates the fragile dependency on sequential ID numbers that
required DB regeneration whenever a config entry was added.

The config generator (zmconfgen.pl) now produces three macros:
- ZM_CFG_DECLARE_LIST: declares Config struct members
- ZM_CFG_DEFAULTS_INIT: initializes members to compiled-in defaults
- ZM_CFG_MAP_INIT: registers name-to-member bindings for DB loading

Only daemon-relevant config entries (137 of 245) are included in the
C++ header; web-only settings (WEB_H_*, WEB_M_*, WEB_L_*, skin
defaults, etc.) are excluded.

Also fixes two pre-existing bugs exposed by removing numeric #defines:
- ZM_WATCH_MAX_DELAY was used as Seconds(139) instead of the actual
  config value (the 139 was the config table row ID, not seconds)
- ZM_OPT_USE_AUTH evaluated as if(8) (always true) instead of
  checking the actual auth setting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit 86d4a8e5f0)
2026-08-29 14:01:25 -04:00
copilot-swe-agent[bot]andconnortechnology d9c9b4087e fix: add HAVE_LIBCURL preprocessor guards to fix ZM_NO_CURL=ON build
Wraps all libcurl usage in #if HAVE_LIBCURL / #endif guards, matching
the existing pattern used for HAVE_LIBVLC and HAVE_LIBVNC.

Files changed:
- src/zm_monitor.h: guard curl include, 4 inner class declarations,
  4 manager member pointers, check_janus() decl, EventPollerHealthy()
- src/zmc.cpp: guard curl_global_init/cleanup calls
- src/zm_monitor.cpp: guard initializer list, instantiation, destructor,
  Poll(), Analyse(), Poller thread condition, and Close() teardown
- src/zm_monitor_amcrest.cpp: wrap implementation in HAVE_LIBCURL guard
- src/zm_monitor_janus.cpp: wrap implementation in HAVE_LIBCURL guard
- src/zm_monitor_rtsp2web.cpp: wrap implementation in HAVE_LIBCURL guard
- src/zm_monitor_go2rtc.cpp: wrap implementation in HAVE_LIBCURL guard

Verified: builds succeed with both ZM_NO_CURL=ON and ZM_NO_CURL=OFF

refs #4967

Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
2026-03-05 02:13:59 +00:00
Isaac ConnorandClaude Opus 4.6 5518f41b05 fix: cache SSL verification failure to avoid repeated warning logs
When SSL certificate verification fails for Go2RTC, RTSP2Web, or Janus
curl requests, the warning was logged on every single call. Since these
methods are called periodically, this flooded the logs. Now a
ssl_verification_failed flag is set on first failure so subsequent calls
skip verification silently. Also adds SSL verification to Janus which
previously had none.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 10:05:02 -05:00
Isaac ConnorandClaude Opus 4.5 d89f2e59db refactor: rename Janus_Use_RTSP_Restream to Restream
Rename Janus-specific restream fields to be more generic since they are
now used by Go2RTC and RTSP2Web as well:
- Janus_Use_RTSP_Restream → Restream
- Janus_RTSP_User → RTSP_User

Update visibility logic so the Restream checkbox appears when RTSPServer
is enabled AND any streaming service (Janus, Go2RTC, or RTSP2Web) is
selected, rather than only when Janus is enabled.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:47:37 -05:00
Isaac Connor 094b2bd639 Rough in restream code, use new refactored user methods 2025-08-05 14:14:40 -04:00
Isaac Connor 548991ea3c Move escape_json_string and remove_newlines to zm_utils 2025-06-26 14:53:38 -04:00
Aaron Kling c4683d90a9 Format code using astyle google format
Commands used:
astyle --style=google --indent=spaces=2 --keep-one-line-blocks src/*.cpp
astyle --style=google --indent=spaces=2 --keep-one-line-blocks src/*.h
2024-03-26 13:43:58 -05:00
Isaac Connor 5a497a7d25 Add JANUS to logs relating to JANUS to ease debugging 2023-07-24 17:45:36 -04:00
Isaac Connor f2009e4f38 Remove deprecated reference to MonitorIds from janus 2023-05-31 16:35:57 -04:00
baudneo 8750e0e333 Add Janus RTSP session timeout to C ⚗️
Signed-off-by: baudneo <86508179+baudneo@users.noreply.github.com>
2023-01-09 17:57:26 -07:00
Jonathan Bennett 9cb21dce22 Uses the master Janus secret as the mountpoint secret, detects and restarts mounts if PIN is stale 2022-09-24 16:05:52 -05:00
Isaac Connor abc5ea26d8 Merge branch 'master' into add_janus_rtsp_user 2022-09-18 12:44:25 -04:00
Isaac Connor bdf5b5d202 Use empty() instead of length() which is faster. Add rtsp path to debug 2022-09-18 12:36:29 -04:00
Isaac Connor 67a7c0721a Fix bad merge reverts. Put back code that take username and password from fields in monitor instead of parsing from rtsp path 2022-09-17 18:58:50 -04:00
Isaac Connor b7143a3c84 Add a check for auth timeout and re-adding with a new auth token. 2022-09-14 20:29:33 -04:00
Isaac Connor 419a44f8ed Merge branch 'iiot' 2022-09-13 18:23:44 -04:00
Isaac Connor d079439005 Merge branch 'reports' of http://github.com/ConnorTechnology/zoneminder into reports 2022-09-12 19:40:27 +02:00
Isaac Connor 18fb1777ec If in a multi-server env, load the hostname instead of localhost for the server for this camera when using zm_rtsp_server. 2022-09-12 11:54:56 -04:00
Isaac Connor d2c461bcc9 When using RTSP_Server restream, need to auth as a ZM user. So load user and create an auth token. 2022-09-12 10:34:26 -04:00
Jonathan Bennett c35bbc8c30 Adds the Janus_pin to shared_memory, and a -j to zmu to fetch it 2022-09-07 15:49:47 -05:00
Jonathan Bennett 71c5339c2b Adds Janus options Profile-ID Override and Use RTSP Restream to work around camera issues 2022-08-19 13:33:22 -04:00
parvit (Vittorio Parrella) 3642abd155 typo 2022-08-15 14:35:16 -04:00
parvit (Vittorio Parrella) 408b42edd4 correct regex escaping 2022-08-15 14:30:48 -04:00
parvit (Vittorio Parrella) 603d10a072 janus password integration 2022-08-15 12:55:04 -04:00
Jonathan Bennett d41792ae00 Adds Janus options Profile-ID Override and Use RTSP Restream to work around camera issues 2022-08-09 00:54:41 -05:00
Isaac Connor 33943acbc4 Code style, spacing. Move check for trailing slash into the if specified janus_path part 2022-07-28 16:27:28 -04:00
Isaac Connor 4ab8166665 Init Janus_Healthy although it is never used 2022-07-14 10:29:10 -04:00
Jonathan Bennett ad3d593b1f Change case of rtsp:// URI to match RFC
At least one camera fails when receiving a DESCRIBE with the rtsp:// URI capitalized. The RFC uses lowercase, so this should be the more universal option.
2022-04-25 13:36:43 -05:00
Isaac Connor b103072b7e Cleanup code a bit moving variable declarations around to where they are used and removing duplicated curl free. 2022-03-10 12:24:00 -05:00
Isaac Connor 5dc4e5ddb4 Fix compile warning. Rename variables to be more descriptive and remove unused ones 2022-03-10 12:09:02 -05:00
Jonathan Bennett 9f4df40ac5 Add rtsp_quirk to Janus mountpoints.
Workaround for Vivotek and possibly other cameras that use nonstandard RTSP URIs,
2022-03-04 20:40:56 -06:00
Jonathan Bennett dde3884084 Moves Janus and Amcrest into their own nested classes 2022-02-03 16:31:07 -06:00