From bd4bb0b61171b4f8c3cf8d72eb18bf737bcca4a5 Mon Sep 17 00:00:00 2001 From: KF7EEL Date: Thu, 7 Jan 2021 15:10:34 -0800 Subject: [PATCH] Change example to allow D-APRS out of the box --- gps_data-SAMPLE.cfg | 14 +-- hblink-SAMPLE.cfg | 54 +++++++++++- playback.cfg | 209 ++++++++++++++++++++++++++++++++++++++++++++ playback.py | 4 +- rules_SAMPLE.py | 31 +++---- 5 files changed, 285 insertions(+), 27 deletions(-) create mode 100644 playback.cfg diff --git a/gps_data-SAMPLE.cfg b/gps_data-SAMPLE.cfg index 1fa12ab..36e7869 100644 --- a/gps_data-SAMPLE.cfg +++ b/gps_data-SAMPLE.cfg @@ -208,27 +208,27 @@ TGID_TS2_ACL: PERMIT:ALL # ACLs: # See comments in the GLOBAL stanza -[PEER-1] +[D-APRS] MODE: PEER ENABLED: True LOOSE: True EXPORT_AMBE: False IP: -PORT: 54002 -MASTER_IP: 10.10.10.105 +PORT: 54071 +MASTER_IP: localhost MASTER_PORT: 54070 PASSPHRASE: passw0rd -CALLSIGN: GPS +CALLSIGN: D-APRS RADIO_ID: 9099 RX_FREQ: 000000000 TX_FREQ: 000000000 TX_POWER: 0 COLORCODE: 1 SLOTS: 1 -LATITUDE: 47.0000 -LONGITUDE: -120.0000 +LATITUDE: 00.0000 +LONGITUDE: 000.0000 HEIGHT: 0 -LOCATION: Somewhere, Cool +LOCATION: This Server DESCRIPTION: GPS to APRS URL: www.github.com/kf7eel/hblink3 SOFTWARE_ID: 20170620 diff --git a/hblink-SAMPLE.cfg b/hblink-SAMPLE.cfg index c2e789d..d420d29 100755 --- a/hblink-SAMPLE.cfg +++ b/hblink-SAMPLE.cfg @@ -126,7 +126,7 @@ STALE_DAYS: 7 # Otherwise ACLs work as described in the global stanza [OBP-1] MODE: OPENBRIDGE -ENABLED: True +ENABLED: False IP: PORT: 62035 NETWORK_ID: 3129100 @@ -167,6 +167,22 @@ SUB_ACL: DENY:1 TGID_TS1_ACL: PERMIT:ALL TGID_TS2_ACL: PERMIT:ALL +[D-APRS] +MODE: MASTER +ENABLED: True +REPEAT: True +MAX_PEERS: 2 +EXPORT_AMBE: False +IP: +PORT: 54070 +PASSPHRASE: passw0rd +GROUP_HANGTIME: 5 +USE_ACL: True +REG_ACL: DENY:1 +SUB_ACL: DENY:1 +TGID_TS1_ACL: PERMIT:ALL +TGID_TS2_ACL: PERMIT:ALL + # PEER INSTANCES - DUPLICATE SECTION FOR MULTIPLE PEERS # There are a LOT of errors in the HB Protocol specifications on this one! # MOST of these items are just strings and will be properly dealt with by the program @@ -181,7 +197,7 @@ TGID_TS2_ACL: PERMIT:ALL # See comments in the GLOBAL stanza [REPEATER-1] MODE: PEER -ENABLED: True +ENABLED: False LOOSE: False EXPORT_AMBE: False IP: @@ -211,9 +227,41 @@ SUB_ACL: DENY:1 TGID_TS1_ACL: PERMIT:ALL TGID_TS2_ACL: PERMIT:ALL +[ECHO] +MODE: PEER +ENABLED: True +LOOSE: False +EXPORT_AMBE: False +IP: +PORT: 54073 +MASTER_IP: localhost +MASTER_PORT: 54072 +passphrase: passw0rd +CALLSIGN: ECHO +RADIO_ID: 9999 +RX_FREQ: 000000000 +TX_FREQ: 000000000 +TX_POWER: 0 +COLORCODE: 1 +SLOTS: 1 +LATITUDE: 00.0000 +LONGITUDE: 000.0000 +HEIGHT: 0 +LOCATION: This Server +DESCRIPTION: Echo Server +URL: www.github.com/kf7eel/hblink3 +SOFTWARE_ID: 20170620 +PACKAGE_ID: MMDVM_HBlink +GROUP_HANGTIME: 5 +OPTIONS: +USE_ACL: True +SUB_ACL: DENY:1 +TGID_TS1_ACL: PERMIT:ALL +TGID_TS2_ACL: PERMIT:ALL + [XLX-1] MODE: XLXPEER -ENABLED: True +ENABLED: False LOOSE: True EXPORT_AMBE: False IP: diff --git a/playback.cfg b/playback.cfg new file mode 100644 index 0000000..c9e3384 --- /dev/null +++ b/playback.cfg @@ -0,0 +1,209 @@ +# PROGRAM-WIDE PARAMETERS GO HERE +# PATH - working path for files, leave it alone unless you NEED to change it +# PING_TIME - the interval that peers will ping the master, and re-try registraion +# - how often the Master maintenance loop runs +# MAX_MISSED - how many pings are missed before we give up and re-register +# - number of times the master maintenance loop runs before de-registering a peer +# +# ACLs: +# +# Access Control Lists are a very powerful tool for administering your system. +# But they consume packet processing time. Disable them if you are not using them. +# But be aware that, as of now, the configuration stanzas still need the ACL +# sections configured even if you're not using them. +# +# REGISTRATION ACLS ARE ALWAYS USED, ONLY SUBSCRIBER AND TGID MAY BE DISABLED!!! +# +# The 'action' May be PERMIT|DENY +# Each entry may be a single radio id, or a hypenated range (e.g. 1-2999) +# Format: +# ACL = 'action:id|start-end|,id|start-end,....' +# --for example-- +# SUB_ACL: DENY:1,1000-2000,4500-60000,17 +# +# ACL Types: +# REG_ACL: peer radio IDs for registration (only used on HBP master systems) +# SUB_ACL: subscriber IDs for end-users +# TGID_TS1_ACL: destination talkgroup IDs on Timeslot 1 +# TGID_TS2_ACL: destination talkgroup IDs on Timeslot 2 +# +# ACLs may be repeated for individual systems if needed for granularity +# Global ACLs will be processed BEFORE the system level ACLs +# Packets will be matched against all ACLs, GLOBAL first. If a packet 'passes' +# All elements, processing continues. Packets are discarded at the first +# negative match, or 'reject' from an ACL element. +# +# If you do not wish to use ACLs, set them to 'PERMIT:ALL' +# TGID_TS1_ACL in the global stanza is used for OPENBRIDGE systems, since all +# traffic is passed as TS 1 between OpenBridges +[GLOBAL] +PATH: ./ +PING_TIME: 5 +MAX_MISSED: 3 +USE_ACL: True +REG_ACL: PERMIT:ALL +SUB_ACL: DENY:1 +TGID_TS1_ACL: PERMIT:ALL +TGID_TS2_ACL: PERMIT:ALL + + +# NOT YET WORKING: NETWORK REPORTING CONFIGURATION +# Enabling "REPORT" will configure a socket-based reporting +# system that will send the configuration and other items +# to a another process (local or remote) that may process +# the information for some useful purpose, like a web dashboard. +# +# REPORT - True to enable, False to disable +# REPORT_INTERVAL - Seconds between reports +# REPORT_PORT - TCP port to listen on if "REPORT_NETWORKS" = NETWORK +# REPORT_CLIENTS - comma separated list of IPs you will allow clients +# to connect on. Entering a * will allow all. +# +# ****FOR NOW MUST BE TRUE - USE THE LOOPBACK IF YOU DON'T USE THIS!!!**** +[REPORTS] +REPORT: True +REPORT_INTERVAL: 60 +REPORT_PORT: 4322 +REPORT_CLIENTS: 127.0.0.1 + + +# SYSTEM LOGGER CONFIGURAITON +# This allows the logger to be configured without chaning the individual +# python logger stuff. LOG_FILE should be a complete path/filename for *your* +# system -- use /dev/null for non-file handlers. +# LOG_HANDLERS may be any of the following, please, no spaces in the +# list if you use several: +# null +# console +# console-timed +# file +# file-timed +# syslog +# LOG_LEVEL may be any of the standard syslog logging levels, though +# as of now, DEBUG, INFO, WARNING and CRITICAL are the only ones +# used. +# +[LOGGER] +LOG_FILE: /tmp/hb-playback.log +LOG_HANDLERS: console +LOG_LEVEL: DEBUG +LOG_NAME: HBlink3 Playback + +# DOWNLOAD AND IMPORT SUBSCRIBER, PEER and TGID ALIASES +# Ok, not the TGID, there's no master list I know of to download +# This is intended as a facility for other applcations built on top of +# HBlink to use, and will NOT be used in HBlink directly. +# STALE_DAYS is the number of days since the last download before we +# download again. Don't be an ass and change this to less than a few days. +[ALIASES] +TRY_DOWNLOAD: False +PATH: ./ +PEER_FILE: peer_ids.json +SUBSCRIBER_FILE: subscriber_ids.json +TGID_FILE: talkgroup_ids.json +PEER_URL: https://www.radioid.net/static/rptrs.json +SUBSCRIBER_URL: https://www.radioid.net/static/users.json +STALE_DAYS: 7 + +# OPENBRIDGE INSTANCES - DUPLICATE SECTION FOR MULTIPLE CONNECTIONS +# OpenBridge is a protocol originall created by DMR+ for connection between an +# IPSC2 server and Brandmeister. It has been implemented here at the suggestion +# of the Brandmeister team as a way to legitimately connect HBlink to the +# Brandemiester network. +# It is recommended to name the system the ID of the Brandmeister server that +# it connects to, but is not necessary. TARGET_IP and TARGET_PORT are of the +# Brandmeister or IPSC2 server you are connecting to. PASSPHRASE is the password +# that must be agreed upon between you and the operator of the server you are +# connecting to. NETWORK_ID is a number in the format of a DMR Radio ID that +# will be sent to the other server to identify this connection. +# other parameters follow the other system types. +# +# ACLs: +# OpenBridge does not 'register', so registration ACL is meaningless. +# OpenBridge passes all traffic on TS1, so there is only 1 TGID ACL. +# Otherwise ACLs work as described in the global stanza +#[OBP-1] +#MODE: OPENBRIDGE +#ENABLED: True +#IP: +#PORT: 62035 +#NETWORK_ID: 3129100 +#PASSPHRASE: password +#TARGET_IP: 1.2.3.4 +#TARGET_PORT: 62035 +#USE_ACL: True +#SUB_ACL: DENY:1 +#TGID_ACL: PERMIT:ALL + +# MASTER INSTANCES - DUPLICATE SECTION FOR MULTIPLE MASTERS +# HomeBrew Protocol Master instances go here. +# IP may be left blank if there's one interface on your system. +# Port should be the port you want this master to listen on. It must be unique +# and unused by anything else. +# Repeat - if True, the master repeats traffic to peers, False, it does nothing. +# +# MAX_PEERS -- maximun number of peers that may be connect to this master +# at any given time. This is very handy if you're allowing hotspots to +# connect, or using a limited computer like a Raspberry Pi. +# +# ACLs: +# See comments in the GLOBAL stanza +[MASTER] +MODE: MASTER +ENABLED: True +REPEAT: True +MAX_PEERS: 1 +EXPORT_AMBE: False +IP: +PORT: 54072 +PASSPHRASE: passw0rd +GROUP_HANGTIME: 5 +USE_ACL: True +REG_ACL: DENY:1 +SUB_ACL: DENY:1 +TGID_TS1_ACL: PERMIT:ALL +TGID_TS2_ACL: PERMIT:ALL + +# PEER INSTANCES - DUPLICATE SECTION FOR MULTIPLE PEERS +# There are a LOT of errors in the HB Protocol specifications on this one! +# MOST of these items are just strings and will be properly dealt with by the program +# The TX & RX Frequencies are 9-digit numbers, and are the frequency in Hz. +# Latitude is an 8-digit unsigned floating point number. +# Longitude is a 9-digit signed floating point number. +# Height is in meters +# Setting Loose to True relaxes the validation on packets received from the master. +# This will allow HBlink to connect to a non-compliant system such as XLXD, DMR+ etc. +# +# ACLs: +# See comments in the GLOBAL stanza +#[REPEATER-1] +#MODE: PEER +#ENABLED: True +#LOOSE: False +#EXPORT_AMBE: False +#IP: +#PORT: 54001 +#MASTER_IP: 172.16.1.1 +#MASTER_PORT: 54000 +#PASSPHRASE: homebrew +#CALLSIGN: W1ABC +#RADIO_ID: 312000 +#RX_FREQ: 449000000 +#TX_FREQ: 444000000 +#TX_POWER: 25 +#COLORCODE: 1 +#SLOTS: 1 +#LATITUDE: 38.0000 +#LONGITUDE: -095.0000 +#HEIGHT: 75 +#LOCATION: Anywhere, USA +#DESCRIPTION: This is a cool repeater +#URL: www.w1abc.org +#SOFTWARE_ID: 20170620 +#PACKAGE_ID: MMDVM_HBlink +#GROUP_HANGTIME: 5 +#OPTIONS: +#USE_ACL: True +#SUB_ACL: DENY:1 +#TGID_TS1_ACL: PERMIT:ALL +#TGID_TS2_ACL: PERMIT:ALL diff --git a/playback.py b/playback.py index c40f020..68bdd4e 100755 --- a/playback.py +++ b/playback.py @@ -169,13 +169,13 @@ if __name__ == '__main__': # CLI argument parser - handles picking up the config file from the command line, and sending a "help" message parser = argparse.ArgumentParser() - parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually hblink.cfg)') + parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually playback.cfg)') parser.add_argument('-l', '--logging', action='store', dest='LOG_LEVEL', help='Override config file logging level.') cli_args = parser.parse_args() # Ensure we have a path for the config file, if one wasn't specified, then use the default (top of file) if not cli_args.CONFIG_FILE: - cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg' + cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/playback.cfg' # Call the external routine to build the configuration dictionary CONFIG = config.build_config(cli_args.CONFIG_FILE) diff --git a/rules_SAMPLE.py b/rules_SAMPLE.py index b96d609..9c10d18 100755 --- a/rules_SAMPLE.py +++ b/rules_SAMPLE.py @@ -33,17 +33,17 @@ configuration file. ''' BRIDGES = { - 'WORLDWIDE': [ - {'SYSTEM': 'MASTER-1', 'TS': 1, 'TGID': 1, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [2,], 'OFF': [9,10], 'RESET': []}, - {'SYSTEM': 'CLIENT-1', 'TS': 1, 'TGID': 3100, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [2,], 'OFF': [9,10], 'RESET': []}, - ], - 'ENGLISH': [ - {'SYSTEM': 'MASTER-1', 'TS': 1, 'TGID': 13, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8,10], 'RESET': []}, - {'SYSTEM': 'CLIENT-2', 'TS': 1, 'TGID': 13, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8,10], 'RESET': []}, - ], - 'STATEWIDE': [ - {'SYSTEM': 'MASTER-1', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10], 'RESET': []}, - {'SYSTEM': 'CLIENT-2', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10], 'RESET': []}, +## 'ENGLISH': [ +## {'SYSTEM': 'CHANGE_ME-1', 'TS': 1, 'TGID': 13, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8,10], 'RESET': []}, +## {'SYSTEM': 'CHANGE_ME-2', 'TS': 1, 'TGID': 13, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8,10], 'RESET': []}, +## ], +## 'STATEWIDE': [ +## {'SYSTEM': 'CHANGE_ME-1', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10], 'RESET': []}, +## {'SYSTEM': 'CHANGE_ME-2', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10], 'RESET': []}, +## ], + 'ECHO': [ + {'SYSTEM': 'MASTER-1', 'TS': 2, 'TGID': 9999, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [9999,], 'OFF': [9,10], 'RESET': []}, + {'SYSTEM': 'ECHO', 'TS': 2, 'TGID': 9999, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [9999,], 'OFF': [9,10], 'RESET': []}, ] } @@ -51,7 +51,7 @@ BRIDGES = { list the names of each system that should bridge unit to unit (individual) calls. ''' -UNIT = ['ONE', 'TWO'] +UNIT = ['MASTER-1', 'CHANGE_ME'] ''' Unit Call flood timeout: @@ -69,9 +69,9 @@ Input the DMR ID and SYSTEM of a subscriber that you would like to have always h This will not flood all systems. ''' STATIC_UNIT = [ - [ 123, 'CLIENT-1'], - [ 456, 'CLIENT-1'], - [ 789, 'MASTER-1'] +# [ 456, 'CLIENT-1'], +# [ 123, 'MASTER-1'], + [ 9099, 'D-APRS'] ] @@ -84,3 +84,4 @@ if __name__ == '__main__': from pprint import pprint pprint(BRIDGES) print(UNIT) + print(STATIC_UNIT)