# FreeDMR 1.x Changelog ## Test Harnesses - Added an in-process deterministic packet harness for `bridge_master.py` routing, state, expiry and packet rewrite checks without UDP. - Added a black-box UDP harness that starts FreeDMR with generated test configs, emulates HBP clients and FBP/OpenBridge peers, captures outbound UDP, supports venv bootstrap, and can model packet loss, duplicates and reordering. - Added synthetic and recorded packet fixture coverage for routing, slot rewrite, byte preservation, malformed packets, cadence and link impairment. ## Configuration and Options - Hardened config parsing for booleans, alias stale time, missing session options and invalid numeric fields. - Added `DIAL_A_TG` to disable private-call dial-a-TG control. - Added `DYNAMIC_TG_ROUTING` to disable automatic creation of unknown conventional TG bridges. - Deprecated `DEFAULT_REFLECTOR` as the system default dial-a-TG setting, while keeping it as a TS2 compatibility alias. - Added canonical per-slot defaults: `DEFAULT_DIAL_TS1` and `DEFAULT_DIAL_TS2`. - Kept legacy OPTIONS aliases `DIAL`, `StartRef` and `DEFAULT_REFLECTOR` mapped to TS2; explicit `DEFAULT_DIAL_TS2` takes precedence. - Added validation/logging so invalid default dial values do not create bridge state and normalize to no default for the active runtime session. ## Dial-a-TG - Made dial-a-TG private-call control slot-local: TS1 controls TS1, TS2 controls TS2. TS1 no longer retunes or disconnects TS2. - Preserved voice prompts on TG9 TS2. - Preserved TG9 as the RF-visible dial-a-TG talkgroup for both slots. - Rejected reserved/control targets consistently for live dial-a-TG and default startup/session configuration. - Preserved the current FreeDMR dial-a-TG policy cap of `999999`. - Ensured FBP route targets created for dial-a-TG remain active across local retunes/disconnects, in line with the mesh "everything everywhere" model. ## Data Path - Preserved DMR data forwarding support. - Kept DATA-GATEWAY behavior for protocol-v1 SMS/GPS style handling. - Reported group-addressed data as data/control, not as voice lifecycle. - Suppressed false `GROUP VOICE` timeout reports for data/control packets. - Preserved data-sync/control payload bytes across HBP and FBP forwarding. - Kept `SUB_MAP` last-known-location behavior for unit data routed toward HBP. - Preserved FBP metadata such as source server, source repeater, BER, RSSI and hops according to protocol version. ## Voice Path - Preserved real inbound LC where available and used explicit synthetic LC only as fallback. - Switched normal synthetic group voice LC service options to `0x00`; retained HBLink `0x20` only as an explicit legacy compatibility constant. - Reworked embedded LC handling so same-TG forwarding preserves embedded LC payloads where possible, while TG-mapped forwarding regenerates routing LC. - Added in-call Talker Alias and GPS embedded-LC logging without changing routing or packet mutation behavior. - Added generated prompt lifecycle handling so real RF voice can interrupt a prompt instead of being blocked as busy. - Fixed private dial-a-TG/AMI timeout reporting so private control calls do not emit unmatched group voice lifecycle events. - Made HBP and FBP voice sequence handling modulo-256 with explicit duplicate, loss and stale/out-of-order treatment. - Ensured voice terminators mark streams finished even when reporting is disabled, preventing late same-stream packets from reopening ended streams. ## Mesh and FBP/OpenBridge - Added malformed/truncated `DMRD` and `DMRE` guards before fixed-offset parsing. - Corrected source-quench matching so BCSQ uses the TG namespace visible to the peer being quenched, including dial-a-TG reflector TGs. - Made STUN/BCST handling consistent as a broad FBP traffic gate. - Preserved protocol-version-sensitive FBP/OBP metadata layout. - Added tests for FBP keepalive gating, wrong network ID, bad hashes, stale timestamps, max-hop handling, v4 characterization and v1 refusal on v5 links. ## Reporting and Dashboard Compatibility - Kept the legacy report socket opcode model unchanged. - Kept bridge event CSV field order unchanged. - Kept `DEFAULT_REFLECTOR` in runtime config as the effective TS2 default for compatibility with existing config/API/report consumers. - Kept prompt/ident generated audio visible as TG9 TS2. - The latest per-slot default-dial changes do not introduce new report event names or new report event fields. - Expected dashboard impact is low if the dashboard reads event fields and bridge entries by their existing keys. - Compatibility risk: `BRIDGE_SND` pickled bridge state may now include active TS1 `#reflector` entries. A dashboard that assumes every `#reflector` entry is TS2-only may need an update; a dashboard that already respects `TS`, `TGID` and `ACTIVE` should continue to parse it. - TS1 dial-a-TG activity may now appear as RF-visible TG9 on slot 1, which is intentional new behavior. ## Codec and Utility Cleanup - Added `freedmr_dmr_codec.py` for locally tested DMR LC, embedded LC, slot type, BPTC, Hamming, Golay and RS parity helper behavior. - Moved runtime LC generation and byte/int helper usage away from older `dmrutils3` functions where covered. - Added standalone codec tests using fixed fixtures and MMDVMHost-style behavior. - Added focused utility tests for ID/byte helpers and alias lookup. ## API and Support Tools - Replaced the Spyne-based API path with a small bounded HTTP/JSON control API. - Kept API operations as small in-memory control-plane actions. - Added API tests for request size limits, key validation, JSON responses, option storage and reset/kill behavior. - Tidied auxiliary tests for report receiver flags, SQL report insertion, AMI factory state and proxy environment booleans. ## Bridge.py Backports - Backported only directly relevant, already-supported fixes from `bridge_master.py` to `bridge.py`. - Kept `bridge.py` focused on its existing conference-bridge role; did not add FreeDMR master-only features such as dial-a-TG. ## Documentation - Added and updated harness, testing, API and architecture documentation. - Added FreeDMR 2 design/ADR documents separately, without changing current 1.x runtime behavior. - Maintained `docs/codex-notes.md` as the engineering notebook for findings, assumptions, protocol-sensitive areas, invariants and unresolved questions. ## Validation - Current non-UDP test discovery passes. - Focused UDP black-box tests for TS1 dial-a-TG and disabled dynamic TG routing pass when local UDP sockets are permitted. - Live RF validation is still required before treating protocol-visible behavior changes as release-ready.