parse_dmrd_header and DmrdHeader move from the plugin package to
domain/dmrd.py so other layers can use them; plugins/domain/send.py
re-exports them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jYm3g9skKGroRdrfwJsCG
The Talker Alias path reassembled the embedded LC of bursts B-E inline.
collect_embedded_lc() (domain/dmr/embedded_lc.py) does it for any LC,
with the same fragments, decode and errors, and the Talker Alias uses it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jYm3g9skKGroRdrfwJsCG
pkt_gen built the header, the A-F bursts and the terminator in one
generator. DmrdStream (domain/dmr/frames.py) builds them one at a time
and pkt_gen now uses it; its output is byte for byte the same
(test_pkt_gen_golden pins the old digest). voice_bits() takes the 216
voice bits of a burst, as the recorder did inline.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jYm3g9skKGroRdrfwJsCG
Moves the RPTL/RPTK/RPTC/RPTO exchange and the RPTPING keepalive out of
the PEER mode of HBPProtocol into application/hbp_peer_login.py, with
the same states, stats and log lines. The MASTER's salt goes to an
on_salt hook, so a caller can relay it and send_key() later. The PEER
mode builds its PeerLogin with the system, and again on a hot reload.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jYm3g9skKGroRdrfwJsCG
The application layer needs them for the PEER login; hbp_constants
re-exports them, as it already does with the frame types.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jYm3g9skKGroRdrfwJsCG
On the inject-only proxy MASTER (or any MASTER with MAX_PEERS > 1) the hourly
voice ident never played. Now VOICE_IDENT in the YAML allows it and each
hotspot that asks with VOICE=1 (or IDENT=1) in its OPTIONS gets its own ident
on TS2, sent to that hotspot only, with its callsign, LANG and VOICETG/IDENTTG,
once it has been quiet for 30 s. On a shared MASTER a hotspot's OPTIONS no
longer change VOICE_IDENT or the ident TG for the others. An empty
OVERRIDE_IDENT_TG now means all-call instead of failing the ident.
The bootstrap's LoopingCall errback got its arguments reversed, so it raised
itself and the loop died without a proper log; the HBP maintenance, OBP
keepalive/DNS and self-service loops had no restart at all. A dead
maintenance or stream trimmer loop leaves peers and streams that never time
out. Every periodic task now goes through start_loop: the error is logged
with its traceback and the loop is scheduled again at its interval.
peer_matches_rf_source() runs for every hotspot on every group voice frame
(_peer_should_receive_dmrd). It matched every peer of the MASTER against the
source with _fuzzy_peer_matches() and then looked for this peer in the list:
O(peers) per hotspot, O(peers^2) per frame, each step converting a key to int
and str. The answer only depends on this peer's own ID, so it is now checked
directly with the same rule (_peer_id_matches, shared with
_fuzzy_peer_matches). Peers stored with int/str keys keep the scan, which
normalises them.
Measured with tests/support/hbp_repeat_stack (REPEAT MASTER, group voice on a
static TG, 2,880 frames x 3 runs, Raspberry Pi 5), µs per frame:
peers 1: 143 -> 146
peers 5: 600 -> 572
peers 20: 2711 -> 2079 (-23 %)
peers 50: 8792 -> 5126 (-42 %)
Tests: direct cases (suffix, own ID, 5-digit prefix rule) and 300 randomised
peer tables (bytes, int and str keys) checked against the previous
implementation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jYm3g9skKGroRdrfwJsCG
Slot RX_TYPE/TX_TYPE stored the frame's raw dtype/vseq, so voice burst C
(vseq 2) looked like HBPF_SLT_VTERM. Record voice bursts as
SLOT_TYPE_VOICE | vseq via domain slot_frame_type at every write site.
_pvt_call_received kept a private call's targets (_pvt_targets,
_pvt_target_peer_ids, _pvt_same_system_dst_peer_id) on the
RoutingUseCases instance, so every private call on the server shared
them. When two private calls overlapped on different systems, the
second call's header re-targeted the first call's frames to the second
call's destination, and the second call's terminator emptied the
targets, so the rest of the first call reached nobody.
Keep them in the source slot's state, which already holds the rest of
the call's RX state. They are written and read at the same points as
before, including the clear on the terminator.
A per-stream bridge TX leg on a MASTER slot is popped by its terminator, so a leg still there after 5 s lost it. The trimmer also required TX_TYPE != VTERM, but TX_TYPE holds the frame's dtype_vseq and voice burst C carries 2, the terminator's value: a call that lost its terminator right after burst C kept its leg forever and never got its END TX.
Loss divided the skipped frames by the frames received, so a stream resuming after a
pause (a jump of 150 with 51 frames received) logged 292 %. It also counted repeated,
late and out-of-order frames as lost, and a late frame twice: once in the jump it fell
into and once when dropped. Those now go to their own "dropped" counter, and Loss is
skipped / (received - dropped + skipped).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LweTug2oJgREHKxEUuE38Q
_send_data_to_hbp rebuilt each frame as header + burst and dropped the two
BER/RSSI octets, so every unit-data frame went out 53 bytes long. DMRGateway
only accepts DMRD frames of exactly 55 bytes (g4klx/DMRGateway DMRNetwork.cpp,
HOMEBREW_DATA_PACKET_LENGTH), so these frames never reached the radio.
It went unnoticed because a peer-originated data stream also reached the
hotspot through the private-call path in full. Frames sent by a plugin
(ServerContext.send_dmrd) only take the unit-data path: a D-APRS plugin's
answers reached the hotspot but the Hytera/MOTOTRBO radio never heard them
(seen on air 24-oct-2026: same bytes accepted at 55, ignored at 53).
Keep the received BER/RSSI octets (zero when absent).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LweTug2oJgREHKxEUuE38Q
The MASTER local REPEAT (_pvt_repeat_targets) already delivers a private
unit-data frame to the destination hotspot when both are on the same MASTER;
the SUB_MAP lookup in RoutingUseCases sent it a second time through
_send_data_to_hbp. The hotspot got every CSBK/header/block twice, which
breaks unconfirmed (rate 1/2) SMS reassembly on the radio. Same rule as
private voice. Plugin frames still go out through routing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LweTug2oJgREHKxEUuE38Q
The config normalizer, the settings lookup and the HBP embedded-LC buffer
all defaulted a missing key to false. Default it to true, matching the
example config; an explicit false still disables it.
With ALLOW_UNREG_ID off, the master compared the RPTC callsign with the
subscriber DB byte for byte. Older IPSC2HBP builds send it lower case
("hp3icc"), so after a good RPTL/RPTK the master answered MSTNAK
("Callsign does not match subscriber database: Sent Call: hp3icc, DB
call HP3ICC") on every attempt, while BM, XLX and other masters accepted
the same repeater.
Callsigns are case-insensitive: compare both sides upper-cased. An
unknown ID (validate_id() returns False) is still rejected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ma9qC57Hrw7b4dZWoErMp4
An empty SUB_MAP_FILE already loaded sub_map.pkl, but the periodic save,
SIGHUP, kill switch and shutdown all skipped writing, so routes learned
since startup were lost on restart. Write to the same path the map is
loaded from; docs now say empty means sub_map.pkl.
With SUB_MAP_FILE empty the server loads sub_map.pkl at startup but never
writes it, so private-call routes were lost on every restart for installs
based on the example. Set it to sub_map.pkl and correct the docs, which
claimed an empty value fell back to a default name.
Unit data on a shared MASTER, TG 4000 on a multi-peer MASTER, the
announcements' quiet-TG wait and tg_quiet_for, connected_at in topology;
monitor MAP section, dashboard config reload, SERVER_STATUS_URL and the
WebSocket compressed once per broadcast. English and Spanish.
Unit data was recognised by data type 6, 7 and 8 only. An SMS sent as rate 1
blocks (data type 10) went down the private voice path instead: repeated to
every hotspot of a shared MASTER and sent over slots playing voice, the same
crackle #144 removed for rate 1/2 and 3/4 data. One UNIT_DATA_DTYPES set now
drives the dispatch, the unit data checks and the local REPEAT.
The shared-MASTER handling only applied to the proxy target. A MASTER with
MAX_PEERS > 1 that hotspots reach on its own port still ran the in-band 4000
signalling and deactivated every dynamic bridge, so one hotspot's 4000 cut the
talkgroups every other hotspot on it was listening to.
A radio's GPS/ARS to an ID never heard on the shared MASTER was repeated to
every hotspot on it, and MMDVMHost drops the network voice it is playing when
a CSBK or data header lands on that slot: everyone heard a crackle every few
minutes. Unit data now goes only to its destination's hotspot, never as a
broadcast on a shared MASTER, and not while that hotspot carries voice on the
slot (any slot when simplex).
Review of #141:
- A live over sharing a slot with another TG: on the shared SYSTEM the
slot's flat RX fields only hold the last frame, so with hotspot A on
TG 213 and hotspot B on TG 91 talking on the same slot (B's frame
last) tg_quiet_for(213) counted time while A was on air.
tg_quiet_for now also reads each slot's RX_STREAMS (#129): a stream on
the TG with its last frame within STREAM_TO is live.
- An over that ends without a terminator left the record at its start:
the stream trimmer now notes the TG at the stream's last frame when a
hotspot stream (RX_STREAMS) or an OpenBridge ingress stream times out.
_note_tg_heard never moves the record back.
- Tests: your interleaved A/B case, a hotspot over and a mesh over that
lose their terminator (quiet from the last frame, not the start), and
a core announcement (synthetic, no plugin origin) not counted. Each
fails when its fix is removed. The deterministic harness now keeps
RX_STREAMS on HBP ingress, as udp_hbp does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
Review of #141:
- The quiet window is a voice-announcements option, tg_quiet_s
(config.yaml, default 3 s; 0 turns it off), not the MASTER's
GROUP_HANGTIME, which is 15 s in the example yaml and would have kept
announcements retrying through normal pauses until they were dropped.
- Routing keeps a per-TG record of when an over last started or ended
(_tg_last_heard, written on voice headers and terminators only, from
any ingress but the server's own voice, pruned past 2048 TGs / 600 s).
On the shared SYSTEM the slot's flat RX_TGID / RX_TIME only remember
the latest stream, so a hotspot keying TG 91 erased the pause of a QSO
on TG 213 on the same slot; the record does not.
- RoutingUseCases.tg_quiet_for(tg): 0.0 while a stream on the TG is live
anywhere (tg_has_active_conversation), else seconds since the record,
inf if never heard. Offered to plugins as ServerContext.tg_quiet_for
(PluginDmrdSender: granted talkgroups only), next to voice_slot_for_tg,
which is back to develop's.
- The announcer waits before choosing a slot while quiet < tg_quiet_s:
every 5 s while voice is live, else right when it has been quiet long
enough. tg_voice_heard_within and the own-stream list are gone.
Tests: routing (never heard, from the end of a mesh over, live, another
MASTER, TG 91 on the same slot keeps the 213 trace, own voice not
counted), sender (granted TGs only), announcer (waits through a QSO,
a short pause keeps it waiting, 0 turns it off, no tg_quiet_for = as
before). 10 fail on develop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11