Files
HBlink4/.github
cortandClaude Opus 4.7 32286ae1ed feat: RPTO slot/TGID translation and outbound rf_src override
Trusted repeaters can now declare per-entry slot/TGID translation rules in
their RPTO (OPTIONS) string, plus an optional single-ID rf_src override for
outbound group voice.

Grammar (operator-facing, goes into MMDVM.ini / DMRGateway.ini):
  TS1 = entry[,entry...]
  TS2 = entry[,entry...]
  SRC = radio_id
  entry = net_tgid_spec[:local_slot[:local_tgid]]
  net_tgid_spec: N | N-M (range, specificity 2) | N (exact, specificity 3)
  local_slot: 1 | 2 | * (preserve net slot)
  local_tgid: N | * (preserve matched net tgid)

Wildcards on the network side (*, N*) are rejected at parse time to keep
the hot path O(1). Ranges expand to concrete map entries at RPTO parse
time (capped at 10,000 tgids). Most-specific rule wins on collision;
losers are dropped with a warning.

Runtime:
- RepeaterState grows inbound_map / outbound_map (inverses) and a single
  tx_src_override.
- _check_inbound_routing translates local -> network before the ACL check
  so subscriptions stay in one vocabulary.
- _calculate_stream_targets uses each target's outbound_map to run the
  slot-busy / hang-time check against the slot the packet will actually
  occupy on air.
- _forward_stream (and the outbound->local forwarding path) rewrite
  bytes 5-7 (rf_src via override), 8-10 (tgid), 11-14 (repeater id for
  outbound targets), and the slot bit in byte 15. Data-sync frames
  (frame_type==2) get bytes 20-52 zeroed so MMDVMHost's BPTC decode
  fails and it falls back to the rewritten DMRD header; voice frames
  keep AMBE vocoder bits intact.
- Untranslated repeaters pay zero overhead (empty-dict short-circuits).
- Unit/private calls are still rejected upstream; SRC= has a defensive
  group-only gate regardless.
- Mid-stream RPTO logs a warning and applies new rules immediately;
  in-flight streams finish on their cached routing.

Validated via parser unit tests (exact/range/collision/error cases, NAT
grammar, specificity precedence) and module imports. NOT yet validated
on live DMR traffic — that's what this branch is for.

Docs:
- docs/dmrd_translation.md: full feature reference (new)
- docs/configuration.md: trust + RPTO extensions section
- docs/connecting_to_hblink4.md: operator Options= examples for
  MMDVMHost / DMRGateway (Pi-Star/WPSD references stripped — out of scope)
- docs/protocol.md: extended RPTO grammar note

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 13:55:24 -05:00
..