Files
dmrlink3/bridge_rules_SAMPLE.py
Cort BuffingtonandClaude Sonnet 4.6 adc1712058 Update docs: bridge trigger timing, per-system activation, dashboard features
bridge_rules_SAMPLE.py:
- Document that ON and OFF triggers both fire on key-down (VOICE_HEAD)
- Clarify per-system activation: each system manages its own entry state
- Note ACTIVE=True + TO_TYPE=ON starts the timeout countdown on load;
  recommend TO_TYPE=NONE for permanently-active entries

README.md:
- Expand bridge.py key features to describe edge triggering and per-system
  activation behavior
- Note ACTIVE=True/TO_TYPE=ON timer-on-load behavior
- Add dashboard features section documenting TS pills (RX/TX/hang/idle),
  bridge table timer countdown, and immediate push on state change

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 21:25:15 -05:00

90 lines
4.2 KiB
Python

'''
DMRlink3 bridge rules — SAMPLE FILE
====================================
THIS FILE WILL NOT WORK AS-IS. You must substitute your own system names,
talkgroup IDs, and timeslot assignments.
Rename this file to bridge_rules.py (or whatever you pass to -b/--bridge-rules
on the bridge.py command line).
BRIDGE STRUCTURE
----------------
Bridges are organized by name (e.g. 'WORLDWIDE', 'STATEWIDE'). Think of each
bridge as a conference room: any system that is ACTIVE on a bridge will receive
all voice traffic arriving on that bridge from any other active system.
Each system entry under a bridge has the following keys:
SYSTEM - Name matching a section in dmrlink.cfg (case-sensitive)
TS - Timeslot to match (1 or 2)
TGID - Integer talkgroup ID to match on that timeslot
ACTIVE - Initial state: True = bridging active, False = bridging off
Note: if TO_TYPE is 'ON', the entry starts a TIMEOUT-minute
countdown immediately on load. It will deactivate after TIMEOUT
minutes unless a call on an ON tgid resets the timer. Use
TO_TYPE 'NONE' for entries that should stay active indefinitely.
TIMEOUT - Timer duration in MINUTES (used with TO_TYPE ON or OFF)
TO_TYPE - Timer behavior:
'ON' - When activated, deactivate after TIMEOUT minutes of
inactivity (timer resets on each ON-trigger key-down)
'OFF' - When deactivated, reactivate after TIMEOUT minutes
'NONE' - No timer; state only changes via ON/OFF triggers
ON - List of TGIDs that activate this entry. Activation fires on
key-down (VOICE_HEAD) so the bridge is active for the entire
call including the first packet.
OFF - List of TGIDs that deactivate this entry. Deactivation also
fires on key-down so the bridge goes inactive immediately when
someone keys up on an OFF tgid, without waiting for unkey.
RESET - List of TGIDs that reset a running ON-type timer without
changing active state. Useful when voice traffic arrives on a
different TGID than the trigger.
IMPORTANT — PER-SYSTEM ACTIVATION:
Each system entry manages its own ACTIVE state independently. When a system
receives an ON or OFF trigger TGID, only that system's entry in the bridge
changes state. The other systems' entries change state only when those systems
themselves receive the trigger. This means all entries that should participate
in a bridge typically start with ACTIVE: True so that traffic flows from the
moment the bridge loads. Entries with TO_TYPE 'ON' then self-manage via timer.
TRUNKS
------
TRUNKS is a list of system names that bypass contention handling. All traffic
is always forwarded to a trunk system without checking group-hangtime or
timeslot-clear-time rules. Leave as [] if not needed.
BRIDGE_CONF
-----------
Global options for bridge.py. Currently unused beyond the REPORT key (which
is vestigial from the dmrlink pickle-reporting era and can be left as-is).
'''
# Global bridge.py options
BRIDGE_CONF = {
'REPORT': True,
}
# Trunk systems — contention handling bypassed for these
TRUNKS = []
# Bridge definitions
BRIDGES = {
'WORLDWIDE': [
{'SYSTEM': 'MASTER-1', 'TS': 1, 'TGID': 91, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [91], 'OFF': [9, 10], 'RESET': []},
{'SYSTEM': 'CLIENT-1', 'TS': 1, 'TGID': 91, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [91], 'OFF': [9, 10], 'RESET': []},
],
'NATIONWIDE': [
{'SYSTEM': 'MASTER-1', 'TS': 1, 'TGID': 3100, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8, 10], 'RESET': []},
{'SYSTEM': 'CLIENT-2', 'TS': 1, 'TGID': 3100, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8, 10], 'RESET': []},
],
'STATEWIDE': [
{'SYSTEM': 'MASTER-1', 'TS': 2, 'TGID': 3129, 'ACTIVE': False, 'TIMEOUT': 5, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7, 10], 'RESET': []},
{'SYSTEM': 'CLIENT-2', 'TS': 2, 'TGID': 3129, 'ACTIVE': False, 'TIMEOUT': 5, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7, 10], 'RESET': []},
],
}
if __name__ == '__main__':
from pprint import pprint
pprint(BRIDGES)