This commit is contained in:
Cort Buffington 2020-10-12 06:37:40 -05:00
commit c8e1d88ecc
11 changed files with 1079 additions and 422 deletions

0
.gitattributes vendored Normal file → Executable file
View File

1191
bridge.py

File diff suppressed because it is too large Load Diff

View File

@ -228,6 +228,7 @@ def build_config(_config_file):
'TARGET_SOCK': (gethostbyname(config.get(section, 'TARGET_IP')), config.getint(section, 'TARGET_PORT')),
'TARGET_IP': gethostbyname(config.get(section, 'TARGET_IP')),
'TARGET_PORT': config.getint(section, 'TARGET_PORT'),
'BOTH_SLOTS': config.getboolean(section, 'BOTH_SLOTS'),
'USE_ACL': config.getboolean(section, 'USE_ACL'),
'SUB_ACL': config.get(section, 'SUB_ACL'),
'TG1_ACL': config.get(section, 'TGID_ACL'),

127
hblink-750.cfg Executable file
View File

@ -0,0 +1,127 @@
[GLOBAL]
PATH: ./
PING_TIME: 5
MAX_MISSED: 3
USE_ACL: False
REG_ACL: DENY:1
SUB_ACL: DENY:1
TGID_TS1_ACL: PERMIT:ALL
TGID_TS2_ACL: PERMIT:ALL
[REPORTS]
REPORT: False
REPORT_INTERVAL: 60
REPORT_PORT: 4321
REPORT_CLIENTS: 127.0.0.1
[LOGGER]
LOG_FILE: /tmp/hblink.log
LOG_HANDLERS: console-timed
LOG_LEVEL: INFO
LOG_NAME: 444.750
[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
[OBP]
MODE: OPENBRIDGE
ENABLED: True
IP:
PORT: 50100
NETWORK_ID: 1
PASSPHRASE: deadbeef
#TARGET_IP: olympic.k0usy.org
TARGET_IP: 127.0.0.1
#TARGET_PORT: 50666
TARGET_PORT: 50101
BOTH_SLOTS: True
USE_ACL: False
SUB_ACL: DENY:1
TGID_ACL: PERMIT:ALL
[444.750]
MODE: MASTER
ENABLED: True
REPEAT: True
MAX_PEERS: 5
EXPORT_AMBE: False
IP:
PORT: 50001
PASSPHRASE: jimmy
GROUP_HANGTIME: 10
USE_ACL: False
REG_ACL: DENY:1
SUB_ACL: DENY:1
TGID_TS1_ACL: DENY:8
TGID_TS2_ACL: PERMIT:3120
[TWO]
MODE: MASTER
ENABLED: False
REPEAT: True
MAX_PEERS: 5
EXPORT_AMBE: False
IP:
PORT:50002
PASSPHRASE: jimmy
GROUP_HANGTIME: 10
USE_ACL: False
REG_ACL: DENY:1
SUB_ACL: DENY:1
TGID_TS1_ACL: DENY:8
TGID_TS2_ACL: PERMIT:3120
[THREE]
MODE: MASTER
ENABLED: False
REPEAT: True
MAX_PEERS: 5
EXPORT_AMBE: False
IP:
PORT:50003
PASSPHRASE: jimmy
GROUP_HANGTIME: 10
USE_ACL: False
REG_ACL: DENY:1
SUB_ACL: DENY:1
TGID_TS1_ACL: DENY:8
TGID_TS2_ACL: PERMIT:3120
[KS-DMR]
MODE: PEER
ENABLED: False
LOOSE: False
EXPORT_AMBE: False
IP:
PORT: 54001
MASTER_IP: olympic.k0usy.org
MASTER_PORT: 62071
PASSPHRASE: c0ffee
CALLSIGN: W1ABC
RADIO_ID: 312312
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

127
hblink-800.cfg Executable file
View File

@ -0,0 +1,127 @@
[GLOBAL]
PATH: ./
PING_TIME: 5
MAX_MISSED: 3
USE_ACL: False
REG_ACL: DENY:1
SUB_ACL: DENY:1
TGID_TS1_ACL: PERMIT:ALL
TGID_TS2_ACL: PERMIT:ALL
[REPORTS]
REPORT: False
REPORT_INTERVAL: 60
REPORT_PORT: 4321
REPORT_CLIENTS: 127.0.0.1
[LOGGER]
LOG_FILE: /tmp/hblink.log
LOG_HANDLERS: console-timed
LOG_LEVEL: INFO
LOG_NAME: 444.800
[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
[OBP]
MODE: OPENBRIDGE
ENABLED: True
IP:
PORT: 50101
NETWORK_ID: 2
PASSPHRASE: deadbeef
#TARGET_IP: olympic.k0usy.org
TARGET_IP: 127.0.0.1
#TARGET_PORT: 50666
TARGET_PORT: 50100
BOTH_SLOTS: True
USE_ACL: False
SUB_ACL: DENY:1
TGID_ACL: PERMIT:ALL
[444.800]
MODE: MASTER
ENABLED: True
REPEAT: True
MAX_PEERS: 5
EXPORT_AMBE: False
IP:
PORT: 50011
PASSPHRASE: jimmy
GROUP_HANGTIME: 10
USE_ACL: False
REG_ACL: DENY:1
SUB_ACL: DENY:1
TGID_TS1_ACL: DENY:8
TGID_TS2_ACL: PERMIT:3120
[TWO]
MODE: MASTER
ENABLED: False
REPEAT: True
MAX_PEERS: 5
EXPORT_AMBE: False
IP:
PORT:50012
PASSPHRASE: jimmy
GROUP_HANGTIME: 10
USE_ACL: False
REG_ACL: DENY:1
SUB_ACL: DENY:1
TGID_TS1_ACL: DENY:8
TGID_TS2_ACL: PERMIT:3120
[THREE]
MODE: MASTER
ENABLED: False
REPEAT: True
MAX_PEERS: 5
EXPORT_AMBE: False
IP:
PORT:50013
PASSPHRASE: jimmy
GROUP_HANGTIME: 10
USE_ACL: False
REG_ACL: DENY:1
SUB_ACL: DENY:1
TGID_TS1_ACL: DENY:8
TGID_TS2_ACL: PERMIT:3120
[KS-DMR]
MODE: PEER
ENABLED: False
LOOSE: False
EXPORT_AMBE: False
IP:
PORT: 54011
MASTER_IP: olympic.k0usy.org
MASTER_PORT: 62071
PASSPHRASE: c0ffee
CALLSIGN: W1ABC
RADIO_ID: 312312
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

View File

@ -120,7 +120,9 @@ STALE_DAYS: 7
#
# ACLs:
# OpenBridge does not 'register', so registration ACL is meaningless.
# OpenBridge passes all traffic on TS1, so there is only 1 TGID ACL.
# Proper OpenBridge passes all traffic on TS1.
# HBlink can extend OPB to use both slots for unit calls only.
# Setting "BOTH_SLOTS" True ONLY affects unit traffic!
# Otherwise ACLs work as described in the global stanza
[OBP-1]
MODE: OPENBRIDGE
@ -131,6 +133,7 @@ NETWORK_ID: 3129100
PASSPHRASE: password
TARGET_IP: 1.2.3.4
TARGET_PORT: 62035
BOTH_SLOTS: True
USE_ACL: True
SUB_ACL: DENY:1
TGID_ACL: PERMIT:ALL

View File

@ -160,8 +160,8 @@ class OPENBRIDGE(DatagramProtocol):
_stream_id = _data[16:20]
#logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._system, int_id(_seq), int_id(_rf_src), int_id(_dst_id))
# Sanity check for OpenBridge -- all calls must be on Slot 1
if _slot != 1:
# Sanity check for OpenBridge -- all calls must be on Slot 1 for Brandmeister or DMR+. Other HBlinks can process timeslot on OPB if the flag is set
if _slot != 1 and not self._config['BOTH_SLOTS'] and not _call_type == 'unit':
logger.error('(%s) OpenBridge packet discarded because it was not received on slot 1. SID: %s, TGID %s', self._system, int_id(_rf_src), int_id(_dst_id))
return
@ -755,7 +755,7 @@ if __name__ == '__main__':
if cli_args.LOG_LEVEL:
CONFIG['LOGGER']['LOG_LEVEL'] = cli_args.LOG_LEVEL
logger = log.config_logging(CONFIG['LOGGER'])
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n')
logger.info('\n\nCopyright (c) 2013, 2014, 2015, 2016, 2018, 2019, 2020\n\tThe Regents of the K0USY Group. All rights reserved.\n')
logger.debug('(GLOBAL) Logging system started, anything from here on gets logged')
# Set up the signal handler

16
rules-750.py Executable file
View File

@ -0,0 +1,16 @@
BRIDGES = {
'1/2': [
{'SYSTEM': '444.750', 'TS': 1, 'TGID': 2, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []},
{'SYSTEM': 'OBP', 'TS': 1, 'TGID': 2, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []}
],
'KANSAS': [
{'SYSTEM': '444.750', 'TS': 2, 'TGID': 3120, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []},
{'SYSTEM': 'OBP', 'TS': 1, 'TGID': 3120, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []}
]
}
UNIT = ['444.750', 'OBP']
if __name__ == '__main__':
from pprint import pprint
pprint(BRIDGES)

16
rules-800.py Executable file
View File

@ -0,0 +1,16 @@
BRIDGES = {
'1/2': [
{'SYSTEM': '444.800', 'TS': 1, 'TGID': 2, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []},
{'SYSTEM': 'OBP', 'TS': 1, 'TGID': 2, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []}
],
'KANSAS': [
{'SYSTEM': '444.800', 'TS': 2, 'TGID': 3120, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []},
{'SYSTEM': 'OBP', 'TS': 1, 'TGID': 3120, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []}
]
}
UNIT = ["444.800", "OBP"]
if __name__ == '__main__':
from pprint import pprint
pprint(BRIDGES)

View File

@ -47,6 +47,18 @@ BRIDGES = {
]
}
'''
list the names of each system that should bridge unit to unit (individual) calls.
'''
UNIT = ['ONE', 'TWO']
'''
This is for testing the syntax of the file. It won't eliminate all errors, but running this file
like it were a Python program itself will tell you if the syntax is correct!
'''
if __name__ == '__main__':
from pprint import pprint
pprint(BRIDGES)
print(UNIT)

0
voice_lib.py Normal file → Executable file
View File