merge_top_level_config never copied OBP_PROXY, so a reload kept DEBUG as at start and the
'bind change ignored' warning could never fire. DEBUG now applies on SIGHUP; LISTEN_PORT,
LISTEN_IP and BIND_LEGACY_PORTS still need a restart and log the warning. Docs updated.
LOOP_GUARD now defaults to true: an echo coming back through a transcoding bridge is
dropped unless a system sets log (write a *LoopGuard* line and let it through) or false.
The example yaml explains what the guard catches that stream-ID loop control cannot.
The note on seq_advance and the two tests named one app; the capture on 7302 was from a
different one, and the fix covers any client that resets the sequence on the terminator.
A MASTER without the key now answers a hotspot's TG / ID 4000 with its link status;
TG4000_VOICE: false turns it off. Example yaml and docs (en/es) updated.
DVSwitch Mobile sends the terminator with seq 0 after ..., 28, 29. Since #127 seq_advance
takes it as a late packet and the ingress drops it, so on HBP and OBP the call only ended on
the 5 s stream timeout (5-10 s late on the dashboard) and a TG 4000 reply never fired. Before,
seq 0 skipped the checks. A terminator is now always the next packet; everything else keeps
#127's late/duplicate handling.
_release_legs_nobody_else_holds() checked the statics of the other
hotspots only: a hotspot with TS2=3340 in its OPTIONS that also held
3340 as a dynamic lost the 3340 leg after its own 4000, while the reply
said "linked to 3340". A leg is now kept while any connected hotspot,
the sender included, has the TG on that slot as an OPTIONS or YAML
static, or another one holds it as a dynamic.
The pacing test now gives each frame 5 ms of work, so a schedule that
drifts (next frame at now + 58 ms) fails it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
The follow-up agreed in #132:
- A private call to ID 4000 is answered with a private call from ID 4000
to the caller (pkt_gen(private=True): LC FLCO 3, DMRD unit bit), the
shape hotspot configs map back to the private contact (PCRewrite
...,84000,...,4000,...). A group 4000 keeps the group reply on TG 4000.
send_prompt_to_peer() gates and tracks a private frame as TG 4000 on
its slot, so routed group voice does not start under it.
- "linked to" + the statics the hotspot still has on that slot (its
OPTIONS and the MASTER's TS1/TS2_STATIC, both lists when simplex, up
to four), else "linked to N" with DEFAULT_REFLECTOR, else "not linked".
- The worker thread only loads the words and builds the frames; playback
is paced on the reactor with callLater (1 s after the over, then one
frame per 58 ms from a fixed start, no drift), stopping at the first
refused frame.
- On a shared MASTER, a dynamic leg only the sender held (no other
connected hotspot has that TG on that slot as a dynamic session, an
OPTIONS static or a YAML static) is set IDLE right away instead of
waiting for its timer (release_dynamic_leg / release_dynamic_leg_store,
reflector and static legs never touched).
Tests: 16 in tests/voice/test_tg4000_voice_reply.py, 12 of them fail on
develop. Docs (en/es): special numbers, configuration.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
Users get no feedback after keying TG 4000. With TG4000_VOICE: true on a
MASTER, the terminator of a hotspot's 4000 over (group or private call)
queues one reply to that hotspot only, about a second later:
- The words the disconnected prompt already says, in the system's
ANNOUNCEMENT_LANGUAGE: "not linked", or "linked to N" with a
DEFAULT_REFLECTOR (shared now as _link_status_words).
- A group call from the server voice ID to TG 4000 on the slot the 4000
came in on: the radio is still on that contact.
- Sent frame by frame on the reactor through the new
HBPProtocol.send_prompt_to_peer(): the hotspot did not subscribe to
TG 4000, so the OPTIONS filter does not apply, but its own slot gate
does; the reply stops if it gets busy with another stream on that
slot or leaves. MASTER slot rows are not touched, so nobody else on a
shared MASTER is held off, and it never goes to OpenBridge.
- One reply per over (stream ID); none if the terminator is lost.
Validator: bool, MASTER only. Default false; example yaml and docs
(en/es: configuration, special numbers) show it.
Refs #131.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
_apply_tg4000_reset() cleared the sender's UA sessions and stored
dynamic TGs, and then always ran the in-band 4000 signalling for the
whole system. On the proxy target MASTER, whose legs every hotspot
shares, that set every leg on the slot IDLE: the other hotspots stopped
hearing their talkgroups, OBP quenched them, and OPTIONS statics among
them (OFF legs with a timer) only came back after their timeout.
Seen on 2131 at 10:44:27 UTC: one hotspot's TG 4000 on TS2 logged
"clearing dynamic TGs for peer 213003507" and, in the same millisecond,
"[5b] ... (TG 4000 forced deactivation)" for 213, 2131, 3340, 7144,
9140 and 214480 on SYSTEM; 3340/7144/9140 were another hotspot's
OPTIONS statics and got "[7b] timeout timer reset to: 3600.0".
On a shared MASTER (_inject_multi_peer_options_filter) the in-band
signalling no longer runs; the sender's own dynamics are cleared as
before. A MASTER of its own keeps the full reset (in-band signalling +
deactivate all dynamic relays).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
Hotspots on the inject-only MASTER share one RX state per slot. With two
of them talking at once on the same slot:
- the first to end had its terminator dropped as 'already receiving':
the bridge hold its own transmission left was taken for a downlink, so
no END RX was sent and the dashboard kept the call lit;
- a stream that lost its terminator never timed out when another hotspot
keyed the same slot before the timer ran;
- START RX was repeated and END durations were wrong.
Each ingress stream is now tracked on its own (RX_STREAMS: peer, source,
TG, start, last frame): it times out by itself, its END carries its real
duration, and START is not repeated for it. The terminator check ignores
the hold of the hotspot's own transmission. Ingress controls are left as
they were.
With seq_advance a forward jump of 128 or more looked like a late
packet. A mesh stream that paused ~7.7 s or longer and resumed with the
same stream ID (its OBP state is kept for 180 s after the 5 s idle mark)
then had every following frame dropped; a pause over ~15 s could also
land on the same sequence and look like a duplicate.
A late packet arrives within milliseconds of its neighbours. The time of
the last accepted frame is now kept with lastSeq (lastSeqTime, on OBP and
HBP), and after more than SEQ_RESYNC_SILENCE_S (1 s) of silence the frame
is taken as a forward jump of its step (at least 1) and becomes the new
reference. Within that second the checks are unchanged.
Tests: seq_advance with silence (jump 150 after 9 s, a whole lap after
20 s, the same jump with no silence still late); the schedule seq 1..10,
9 s pause, 160..199 forwards all 40 frames and the terminator on OBP
(Max gap 9 s) and on HBP ingress. Both fail on 0caece5.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
expand_inject_proxy_systems deep-copied the whole inject MASTER, all its
peers included, once per virtual master (MAX_PEERS of them) and then
replaced PEERS. Each report to the monitor (every 60 s and on every
hotspot login, logout, RPTO, TG 4000 or dynamic TG change) blocked the
reactor for ~0.2 s with 26 hotspots and MAX_PEERS 200, ~0.75 s with 100;
hotspots hear gaps over MMDVMHost's 360 ms jitter as packet loss. A
shallow copy without PEERS is enough: the report only reads it, and the
dashboard_state and topology it produces are byte-identical.
The 8-bit sequence wraps 255 -> 0, but lastSeq was compared as a plain
number. A packet arriving late right after the wrap (254 after 0..3)
was not seen as out of order: it became lastSeq, so every later frame
of the call (and the terminator) was dropped as out of order. On OBP the
rest of the call never left over that mesh link and no *CALL END* was
logged; on HBP ingress the rest of the hotspot's over was lost. With
the previous commit the late packet would also have added ~250 to Loss.
seq_advance() (routing/helpers.py) gives the step from lastSeq to seq
modulo 256, used by both ingress paths:
- 1 next packet; 2..127 a forward jump, Loss += step - 1;
- 0 the same sequence again: duplicate, dropped;
- behind (128..255): late or out of order, Loss += 1, dropped, lastSeq
kept;
- as before, seq 0 repeated (voice header repeats) and seq 1 behind (a
source restarting its count) are taken as the next packet; seq 0
after 255 now goes through the same checks instead of skipping them.
Tests: seq_advance cases; the schedule ..., 253, 255, 0, 1, 2, 3, late
254, 4 ... 19 on OBP (frames after the late packet forwarded, CALL END
logged, Loss 2) and on HBP ingress (rest of the over forwarded). The HBP
one fails on develop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- "Missed packet(s)" added 1 to Loss per sequence jump, however many
packets it skipped: a jump of 93 counted as one, so OBP CALL END lines
read "Loss: 0.00%" over calls with seconds of audio missing.
It now adds every skipped packet.
- Frames held back upstream and released in a burst keep their sequence
numbers, so Loss cannot show them; the hotspot still hears a silence
("network watchdog has expired" on MMDVMHost). CALL END now ends with
"Max gap: N.NNs", the longest time between two frames of the stream.
It goes at the end of the line so parsers of the existing fields keep
working.
Cost: one subtraction and compare per OBP frame; a full OBP frame
through the deterministic harness stays at ~29.5 us either way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
VoiceUseCases._prompt_frame (on-demand 9991-9999, voice ident, the
disconnected prompt) stamps TX_TYPE / TX_RFS / TX_TIME on TS2 but left
TX_FROM_MESH as the last routed call wrote it. On SYSTEM that is usually
a mesh call, so master_slot_holds_server_broadcast() returned False for
this server's own prompt and mesh voice could interleave with it.
- _prompt_frame writes TX_FROM_MESH = False next to TX_RFS.
- The private call stamp writes it too (True when the call came in over
OpenBridge), and new slots start with it False, so every TX_RFS write
sets it.
- Test: a prompt on a slot whose last TX came from the mesh holds the
slot on every frame (fails without the fix).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
The monitor builds its hotspot table from the OPTIONS text the server
reports, which only carried what the hotspot sent, so TS1_STATIC /
TS2_STATIC from adn-server.yaml never showed although they were routed.
The reported options and ts1/ts2_static now carry the static TGs the
hotspot actually gets (the same list routing uses), yaml ones first.
The hotspot's stored OPTIONS are left as they are.
On the shared inject-only MASTER each hotspot only got the static TGs of
its own OPTIONS, so the TS1_STATIC / TS2_STATIC of adn-server.yaml reached
a hotspot only while it was the sole one connected. The yaml lists are now
kept per MASTER when the config is loaded or reloaded and added to every
hotspot's static TGs on that MASTER, on top of its OPTIONS. A SIGHUP
updates connected hotspots and the MASTER's bridge legs.
Every server announces as 1000001, so master_slot_holds_server_broadcast()
took an announcement relayed over OpenBridge for this server's own and
re-applied the global MASTER slot hold for it. When one server sends two
announcements at once (TG 9140 and TG 7144 at the top of the hour, both
bridged to TS2 of a MASTER with several hotspots), each took the slot
from the other: on 2131 a hotspot heard 52 of the 267 frames of one.
The TX row now records whether its stream came from the mesh
(TX_FROM_MESH, mirrored onto the flat row like the other TX_* keys), and
only this server's own voice holds the slot. Mesh announcements then go
through the per-hotspot checks like any other mesh call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
A failed login (REG_ACL / unregistered ID), a callsign mismatch or one
hotspot closing down set _reset on the whole system. With many hotspots
on one MASTER that dropped the next frame routed to it ("disallow
transmission until reset cycle is complete", which also stops a plugin
announcement as "slot taken"), and BRIDGERESET then set every leg of the
system IDLE: calls the other hotspots were listening to stopped and
their dynamic TGs were gone until someone keyed up again.
Seen on 2131 at 20:00:15 UTC: an invalid login from ID 2131 cut the
hourly announcement at packet 113/115, and the reset 5 s later stopped a
TG 21472 over a connected hotspot was receiving (it arrived over OBP
with 0.42 % loss and ran 5 s longer). 64 such resets in 24 h there.
All paths now do what the peer timeout already did: restore the default
OPTIONS and set _reset only when no peer is left.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
The trigger checked the slot's RX_TYPE after the terminator had already set
it to VTERM, so it never fired. It now reads the RX_TYPE from before the
frame, as legacy did, and only for on-demand service calls.
Routed voice on the MASTER slot's TX leg no longer stops a plugin announcement,
and a frame routing refuses is still played to the MASTER's hotspots: only a
radio or another stream on the RX leg stops it, as with the core announcements.
Reverts the global slot hold from #120, which cut the start of other calls for
every hotspot of the MASTER while an announcement played.
A remote caller's next over may reach this server first over another
OpenBridge link, so within the hold window it looked like an echo (8 of
3262 call starts on 2131, all OBP -> OBP re-keys). The mesh is now one
ingress: a real loop is still caught where the caller is local (HBP vs a
bridge peer, or HBP vs the mesh), and so is a local bridge peer echoing a
remote caller (the mesh vs HBP).
Show GLOBAL.LOOP_GUARD_HOLD and SYSTEM LOOP_GUARD with their defaults in
adn-server.example.yaml.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
Since announcements moved to the voice-announcements plugin they enter the
MASTER as a synthetic RX leg instead of stamping the slot's TX row. Routing
re-applies the global MASTER slot contention only when
master_slot_holds_server_broadcast() sees that TX row, so a call on another
TG bridged to the same slot (from OpenBridge, or with more than one hotspot
connected) skipped the contention and took the slot's TX leg. The next
announcement frame was then refused as "slot taken (QSO)" and the playback
stopped after a few seconds; on a busy server announcements were rarely heard
whole.
Plugin ingress now names its stream on the slot (PLUGIN_RX_STREAM_ID) and
routing applies the contention while that stream holds the RX leg, as it did
for the core announcements.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- playback_use_cases: _PLAYBACK_DELAY_S becomes public PLAYBACK_DELAY_S
(now used outside the module); the two echo tests that import it follow.
- loop_guard: MAX_LOOP_GUARD_HOLD_S = PLAYBACK_DELAY_S, so changing the
parrot's delay moves the cap with it. playback_use_cases only imports
from domain: no cycle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- The parrot replays an over 2.0 s after it ends (_PLAYBACK_DELAY_S),
under whatever system/TG name the sysop chose. A bridge echo starts
while the original is still on air, so the hold only has to cover very
short overs: default 1.0 s, and the validator rejects 2.0 s or more.
The runtime falls back to the default for anything out of range.
- LOOP_GUARD: false stays as an extra option.
- Test: a replay starting 2.0 s after the over ends is not flagged even
with LOOP_GUARD: true on that system.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- application/routing/loop_guard.py: when a group voice stream starts,
the same rf_src on the same TG from another ingress (system + peer; an
OBP link is one ingress), with another stream ID, while the original is
active or ended < GLOBAL.LOOP_GUARD_HOLD (2 s), is a loop echo.
Stream-ID LoopControl cannot see it (bridges start a new stream ID) and
the TG-busy check lets the same caller through on purpose.
- Bridges that relay to another TG are left alone (same TG required).
- Per system LOOP_GUARD: "log" (default, one *LoopGuard* line per echo),
true (drop), false (neither checked nor recorded: the ECHO parrot).
- Called from HBP and OBP ingress and from the MASTER local REPEAT, one
verdict per stream cached by stream ID; bound streams never reach it.
Server voice IDs and plugin/announcement frames are exempt.
- Validator: LOOP_GUARD true/false/"log", LOOP_GUARD_HOLD > 0.
- Docs: configuration.md and behaviour-and-timers.md (en/es); the example
ECHO sets LOOP_GUARD: false.
Closes#118
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- udp_hbp.py decides once per config, in __init__ and
apply_system_config (SIGHUP reload), and the two ingress write sites
test self._learns_sub_map before the direct assignment.
system_learns_sub_map stays the single place that decides;
_pvt_call_received keeps learn_sub_map.
- Tests switch the flag through apply_system_config, as a reload does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- When SUB_MAP (or the 6/7-digit hotspot-ID fallback) points the
destination at the very peer the frame came from, the two radios are on
the same hotspot and hear each other on RF; sending it back made the
hotspot transmit over their exchange and the SMS ACK was lost. Applies
to every peer: a duplex repeater already retransmits its own RF.
- Plugin frames carry SERVER_ID as peer, so they are never skipped.
- The same-system private call log line is the normal path, not an
error: logger.error -> logger.debug.
Closes#116
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- SUB_MAP_LEARN: false on a MASTER or PEER keeps traffic entering through
it from updating SUB_MAP, so a beacon, a bridge or the parrot never
becomes where a subscriber is reached for private calls and unit data.
Default true everywhere, no name-based default.
- One function, learn_sub_map, decides and writes for the three write
sites (MASTER ingress, PEER ingress, _pvt_call_received).
- OpenBridge always learns; the validator rejects the key there and
checks it is a boolean elsewhere.
- Entries that already point at a system with false are dropped after
the config is loaded and after every SIGHUP reload (SUB_MAP is persisted).
- Docs: configuration.md and private-calls.md (en/es); the example ECHO
sets it explicitly.
Closes#109
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- process_acls built every system's TG1_ACL from TGID_TS1_ACL (or
PERMIT:ALL), so TGID_ACL was never applied on an OpenBridge, in either
direction; the normalizer's copy never ran because TG1_ACL already existed.
- OpenBridge takes TG1_ACL from TGID_ACL, as in FreeDMR; MASTER/PEER keep
their slot ACLs.
The lists were downloaded once STALE_DAYS old, whatever the server had
published since: a DMR ID issued today could be refused at login on masters
with ALLOW_UNREG_ID: false for up to a day, and the unchanged 44MB subscriber
list was fetched again every day.
- The checksum file (a few hundred bytes) is fetched on every tick, and a
list is downloaded only when its published checksum no longer matches the
file on disk. Without a checksum file, STALE_DAYS decides as before.
- A published checksum the download never matches is retried once an hour,
not every tick, until the server publishes a different one.
- The file digest is cached against its stamp, so verifying an unchanged
44MB file costs nothing on each tick.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
Talker-alias buffers (_dmra_by_stream, _ta_voice_acc, _ta_complete), the
passthrough relay dedupe set and log-once ingress keys are only released on
the HBP VTERM hook. OPENBRIDGE streams never hit it, and the OBP branch of
stream_trimmer_loop returned before trim_dmra_streams(), so every stream seen
on an OBP left one entry per structure behind (~38k after 35 h on a live
master, ~2 KB per call).
- On stage-2 removal of an OBP stream, call clear_talker_alias_stream() and
drop the stream's log-once ingress keys.
- Run trim_dmra_streams() for OBP protocols too (catches buffers keyed by
streams that never got a STATUS row).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
HBP->OBP forward legs (to_target rows with H_LC) only became eligible for
removal when flagged _end_tx_sent/_bcsq_quenched. The VTERM path emitted
END,TX without setting the flag, so one row per forwarded call and per OBP
stayed in STATUS forever (~3 KB/call measured; ~30-40 MB/day on a live master).
- VTERM on a forward leg now sets _end_tx_sent.
- The stream trimmer marks any idle forward leg _to, so it is removed after
180 s even if VTERM never arrived.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vz1o2mo7r43iNnpD2MQRLA
- Parse the subscriber file once per reload, turning each record into a
profile as the decoder finishes it, instead of parsing it twice and
building the whole object tree first.
- Profiles are plain tuples with interned names: a dict each doubled the
memory, and a NamedTuple stays tracked by the garbage collector.
- One copy of subscriber_ids, and the default local subscriber file (the
subscriber file itself) is not parsed again.