This repository was archived by the owner on Nov 18, 2026. It is now read-only.
Repository navigation
feat(streaming): RTSP video sources through the video gateway - #381
Closed
edospadoni wants to merge 13 commits into
Closed
edospadoni wants to merge 13 commits into
edospadoni wants to merge 13 commits into
Conversation
This was referenced Nov 10, 2026
edospadoni
marked this pull request as ready for review
November 17, 2026 09:02
- sources API no longer returns device addresses and credentials, adds type, WHEP url and gates - short-lived stream tokens and the authentication hook of the video gateway (MediaMTX), with revocation of the sessions when a permission or a source is removed - several gates per source, opened by DTMF or by an HTTP action URL called by the server (Basic/Digest) - image sources with credentials
The tls_skip_verify flag of a source applies to its snapshot requests and to its URL gates only.
PlayDTMF on a ringing channel reports success but the tones are lost: return 409 call_not_answered instead of a false success.
- with "Skip TLS certificate verification" the certificate of an https:// snapshot URL or URL gate must match the SHA-256 fingerprint pinned by FreePBX when the source was saved: the connection is opened and checked before the request (and the credentials) is written. Sources saved by an older version (no fingerprint) keep working unpinned and are logged. - the device address is resolved and loopback, link-local and unspecified addresses are refused (any numeric form, IPv4-mapped IPv6 included), LAN addresses are allowed - redirects are never followed, snapshot bodies are limited to 5 MB and gate responses to 64 KB - gate errors gate_certificate_changed and gate_address_not_allowed
The clients read cmdOpen only for the configurations without gates: for the other sources it is empty, the gates are opened by the server.
…ions - the control API of the gateway is no longer excluded from the hook: it is allowed only to the internal user nethcti-server with the password of services.json (mediamtx.api_password), compared in constant time, sent by this server as HTTP Basic; without a password the API is not used - a stream token opens a single gateway session (bound to the first session id the gateway authorizes); at most 3 sessions per user and source and 30 per user, refreshed from the gateway before denying, and at most 300 tokens per user per minute: 429 too_many_sessions or too_many_requests from streaming/token, denials logged - the token is read only from the Authorization header, never from the query string
Arrays and objects are refused with 400 invalid_gate (numbers are still accepted). The documented errors of streaming/open include 409 call_not_answered and the new gate errors.
The call and streaming popups wrote the caller name, number and source description from the query string as HTML on the CTI origin. They are written as text now; the image URL must be a same-origin path or an http(s) URL, the source id a plain identifier, the server image a data URL of an image and the CTI protocol http or https.
…e checks The fake devices listen on a non-loopback address: loopback devices are refused now.
The clients released before the gates (phone-island 1.1.7 and older, in NethLink and the CTI) show the open door button only when cmdOpen is not empty, and the button calls streaming/open without a gate: the server opens the first gate. A source with gates now sends "*" instead of an empty cmdOpen, never its DTMF code; the newer clients ignore cmdOpen when gates is present, and a source without gates still sends an empty one.
The sampler logged only the first error of a source until a success, so after a device restart (ECONNREFUSED) a later TLS_FINGERPRINT_MISMATCH was never logged. The last error code of each source is kept: an error is logged again only when it differs from the previous one.
streaming/image answered a plain 500 when the device of an image source
presented another certificate than the pinned one. It answers 502 with
{ code: "source_certificate_changed", message } now, like the
gate_certificate_changed error of streaming/open; the other failures are
unchanged.
The sources without gates use their "open" code: a failed DTMF sequence now returns the same "dtmf_failed" error of the DTMF gates instead of a generic 500. The REST doc of streaming/open says that the gate identifier is the global "id" of a gate returned by streaming/sources.
edospadoni
force-pushed
the
feat/rtsp-video-sources
branch
from
November 17, 2026 09:06
c45bba0 to
fadbc15
Compare
Member
Author
|
Superseded by nethesis/ns8-nethvoice#1184. After the monorepo import (nethesis/ns8-nethvoice#906) these changes live in the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Server side of NethServer/dev#7535: RTSP video sources (door intercoms, cameras) played by the CTI clients over WebRTC through the MediaMTX video gateway of the module, with door opening by DTMF or HTTP(S) action URL.
Related PRs:
Changes
GET /streaming/sources): same keys as before, buturl,userandpasswordare always empty, so device addresses and credentials never reach the clients (call events included). New keys:type(image/rtsp),whep(stream URL for RTSP sources) andgates(id,name,typeonly).POST /streaming/token): 60 s single-use token bound to user and source, checked against thevs_*permission. Clients send it only in theAuthorization: Bearerheader of the WHEP request.POST /mediamtx/authon the streaming REST port): allows only WebRTC readers with a valid token for that source; unknown paths are denied. It answers only loopback requests not forwarded by a proxy and it is outside the prefixes routed by the HTTP proxy.POST /streaming/openwith optionalgate): several gates per source, opened by DTMF (only on an answered call, otherwise 409call_not_answered) or by an HTTP(S) action URL called by the server with the gate credentials (Basic or Digest, 5 s timeout). Withoutgatethe first one is opened, as released clients expect. The gate identifier is the globalidof a gate returned bystreaming/sources, not its position in the source (the REST doc examples say so). A failed DTMF sequence answers 502dtmf_failed, also for the legacy open code of sources without gates (it answered a generic 500).streaming/imageanswers 502source_certificate_changed(instead of 500) when the device presents another certificate than the pinned one. The sampler logs an error again when it changes (for example a device restart followed by a certificate change), not only the first one until a success.Security hardening
Done after a code review and a live penetration test on a test instance:
nethcti-serverwith the per-instance password fromservices.json, compared in constant time.too_many_sessions/too_many_requests); denials are logged.https://snapshot URLs and URL gates must match the certificate fingerprint pinned by FreePBX, checked before any request or credential is sent. Sources saved without a fingerprint keep working unpinned and are logged.cmdOpenis the placeholder*, so the open door button of released clients (phone-island 1.1.8 and older) keeps working: they callstreaming/openwithout a gate.streaming/openaccepts only a string or numeric gate identifier.static/templates/notification_popup/call.htmlandstreaming.html): query string values are written as text and URLs/identifiers are validated.Testing
plugins/streaming/testandplugins/com_streaming_rest/test: parsing, payload sanitization, tokens and limits, hook decisions, gateway API user, revocation, gates, pinning and address checks, snapshots.Notes for reviewers
streaming.jsonwritten by older FreePBX versions (notype, nogates) keeps the previous behaviour.authorization_userheader from local processes (pre-existing design).Before merge
ns8-nethvoice#1184 pins this branch by commit (
NETHCTI_SERVER_COMMIT): after merging, that pin moves to the mergedns8commit. Merge order: this PR → phone-island#315 (release) → nethvoice-cti#630 (release) and nethlink#263 → ns8-nethvoice#1184.Refs NethServer/dev#7535