restore bridge.py to original state
This commit is contained in:
parent
a0176551b8
commit
7263c41ac6
@ -2,6 +2,7 @@
|
||||
#
|
||||
###############################################################################
|
||||
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com>
|
||||
# Copyright 2021, Eric, KF7EEL <KF7EEL@qsl.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
47
config.py
Executable file → Normal file
47
config.py
Executable file → Normal file
@ -106,7 +106,6 @@ def build_config(_config_file):
|
||||
CONFIG['GLOBAL'] = {}
|
||||
CONFIG['REPORTS'] = {}
|
||||
CONFIG['LOGGER'] = {}
|
||||
CONFIG['GPS_DATA'] = {}
|
||||
CONFIG['ALIASES'] = {}
|
||||
CONFIG['SYSTEMS'] = {}
|
||||
|
||||
@ -142,49 +141,6 @@ def build_config(_config_file):
|
||||
if not CONFIG['LOGGER']['LOG_FILE']:
|
||||
CONFIG['LOGGER']['LOG_FILE'] = '/dev/null'
|
||||
|
||||
elif section == 'GPS_DATA':
|
||||
CONFIG['GPS_DATA'].update({
|
||||
'DATA_DMR_ID': config.get(section, 'DATA_DMR_ID'),
|
||||
'USER_APRS_SSID': config.get(section, 'USER_APRS_SSID'),
|
||||
'CALL_TYPE': config.get(section, 'CALL_TYPE'),
|
||||
'UNIT_SMS_TS': config.get(section, 'UNIT_SMS_TS'),
|
||||
'USER_APRS_COMMENT': config.get(section, 'USER_APRS_COMMENT'),
|
||||
'APRS_LOGIN_CALL': config.get(section, 'APRS_LOGIN_CALL'),
|
||||
'APRS_LOGIN_PASSCODE': config.get(section, 'APRS_LOGIN_PASSCODE'),
|
||||
'APRS_SERVER': config.get(section, 'APRS_SERVER'),
|
||||
'APRS_PORT': config.get(section, 'APRS_PORT'),
|
||||
'APRS_FILTER': config.get(section, 'APRS_FILTER'),
|
||||
'IGATE_BEACON_TIME': config.get(section, 'IGATE_BEACON_TIME'),
|
||||
'IGATE_BEACON_ICON': config.get(section, 'IGATE_BEACON_ICON'),
|
||||
'IGATE_BEACON_COMMENT': config.get(section, 'IGATE_BEACON_COMMENT'),
|
||||
'IGATE_LATITUDE': config.get(section, 'IGATE_LATITUDE'),
|
||||
'IGATE_LONGITUDE': config.get(section, 'IGATE_LONGITUDE'),
|
||||
'APRS_STATIC_REPORT_INTERVAL': config.get(section, 'APRS_STATIC_REPORT_INTERVAL'),
|
||||
'APRS_STATIC_MESSAGE': config.get(section, 'APRS_STATIC_MESSAGE'),
|
||||
'EMAIL_SENDER': config.get(section, 'EMAIL_SENDER'),
|
||||
'EMAIL_PASSWORD': config.get(section, 'EMAIL_PASSWORD'),
|
||||
'SMTP_SERVER': config.get(section, 'SMTP_SERVER'),
|
||||
'SMTP_PORT': config.get(section, 'SMTP_PORT'),
|
||||
'LOCATION_FILE': config.get(section, 'LOCATION_FILE'),
|
||||
'BULLETIN_BOARD_FILE': config.get(section, 'BULLETIN_BOARD_FILE'),
|
||||
'MAILBOX_FILE': config.get(section, 'MAILBOX_FILE'),
|
||||
'EMERGENCY_SOS_FILE': config.get(section, 'EMERGENCY_SOS_FILE'),
|
||||
'USER_SETTINGS_FILE': config.get(section, 'USER_SETTINGS_FILE'),
|
||||
'USE_API': config.getboolean(section, 'USE_API'),
|
||||
'AUTHORIZED_TOKENS_FILE': config.get(section, 'AUTHORIZED_TOKENS_FILE'),
|
||||
'AUTHORIZED_USERS_FILE': config.get(section, 'AUTHORIZED_USERS_FILE'),
|
||||
'ACCESS_SYSTEMS_FILE': config.get(section, 'ACCESS_SYSTEMS_FILE'),
|
||||
'USE_PUBLIC_APPS': config.getboolean(section, 'USE_PUBLIC_APPS'),
|
||||
'PUBLIC_APPS_LIST': config.get(section, 'PUBLIC_APPS_LIST'),
|
||||
'MY_API_NAME': config.get(section, 'MY_API_NAME'),
|
||||
'DASHBOARD_URL': config.get(section, 'DASHBOARD_URL'),
|
||||
'SERVER_NAME': config.get(section, 'SERVER_NAME'),
|
||||
|
||||
|
||||
})
|
||||
if not CONFIG['LOGGER']['LOG_FILE']:
|
||||
CONFIG['LOGGER']['LOG_FILE'] = '/dev/null'
|
||||
|
||||
elif section == 'ALIASES':
|
||||
CONFIG['ALIASES'].update({
|
||||
'TRY_DOWNLOAD': config.getboolean(section, 'TRY_DOWNLOAD'),
|
||||
@ -226,7 +182,7 @@ def build_config(_config_file):
|
||||
'SOFTWARE_ID': bytes(config.get(section, 'SOFTWARE_ID').ljust(40)[:40], 'utf-8'),
|
||||
'PACKAGE_ID': bytes(config.get(section, 'PACKAGE_ID').ljust(40)[:40], 'utf-8'),
|
||||
'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME'),
|
||||
'OPTIONS': bytes(config.get(section, 'OPTIONS'), 'utf-8'),
|
||||
'OPTIONS': b''.join([b'Type=HBlink;', bytes(config.get(section, 'OPTIONS'), 'utf-8')]),
|
||||
'USE_ACL': config.getboolean(section, 'USE_ACL'),
|
||||
'SUB_ACL': config.get(section, 'SUB_ACL'),
|
||||
'TG1_ACL': config.get(section, 'TGID_TS1_ACL'),
|
||||
@ -293,7 +249,6 @@ def build_config(_config_file):
|
||||
CONFIG['SYSTEMS'].update({section: {
|
||||
'MODE': config.get(section, 'MODE'),
|
||||
'ENABLED': config.getboolean(section, 'ENABLED'),
|
||||
'STATIC_APRS_POSITION_ENABLED': config.getboolean(section, 'STATIC_APRS_POSITION_ENABLED'),
|
||||
'REPEAT': config.getboolean(section, 'REPEAT'),
|
||||
'MAX_PEERS': config.getint(section, 'MAX_PEERS'),
|
||||
'IP': gethostbyname(config.get(section, 'IP')),
|
||||
|
@ -107,11 +107,11 @@ import json
|
||||
import hashlib
|
||||
|
||||
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
|
||||
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||
__author__ = 'Cortney T. Buffington, N0MJS, Eric Craw, KF7EEL'
|
||||
__copyright__ = 'Copyright (c) 2016-2019 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT'
|
||||
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT, Xavier FRS2013'
|
||||
__license__ = 'GNU GPLv3'
|
||||
__maintainer__ = 'Cort Buffington, N0MJS'
|
||||
__maintainer__ = 'Eric Craw, KF7EEL'
|
||||
__email__ = 'n0mjs@me.com'
|
||||
|
||||
# Module gobal varaibles
|
||||
@ -2308,6 +2308,8 @@ if __name__ == '__main__':
|
||||
user_bb_file.close()
|
||||
#Only create if API enabled
|
||||
if use_api == True:
|
||||
# Generate the apps dictionary
|
||||
generate_apps()
|
||||
logger.info('Dashboard API enabled')
|
||||
#API variables
|
||||
auth_token_file = CONFIG['GPS_DATA']['AUTHORIZED_TOKENS_FILE']
|
||||
@ -2416,8 +2418,5 @@ if __name__ == '__main__':
|
||||
aprs_thread = threading.Thread(target=aprs_rx, args=(aprs_callsign, aprs_passcode, aprs_server, aprs_port, aprs_filter, user_ssid,))
|
||||
aprs_thread.daemon = True
|
||||
aprs_thread.start()
|
||||
#logger.info(UNIT_MAP)
|
||||
#global authorized_users, other_systems
|
||||
#from .scripts.dashboard.authorized_apps import authorized_users, other_systems
|
||||
logger.info(generate_apps())
|
||||
|
||||
reactor.run()
|
||||
|
54
rules_SAMPLE.py
Executable file → Normal file
54
rules_SAMPLE.py
Executable file → Normal file
@ -69,63 +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 = [
|
||||
# [ 456, 'CLIENT-1'],
|
||||
# [ 123, 'MASTER-1'],
|
||||
[ 9099, 'D-APRS']
|
||||
]
|
||||
|
||||
authorized_users = {
|
||||
## 'DEF':{
|
||||
## 'mode':'msg_xfer',
|
||||
## 'user':'test_name',
|
||||
## 'password':'passw0rd'
|
||||
## },
|
||||
'XYZ':{
|
||||
'mode':'msg_xfer',
|
||||
'user':'test_name',
|
||||
'password':'passw0rd'
|
||||
}
|
||||
}
|
||||
|
||||
local_systems = {
|
||||
# Shortcut used in SMS message
|
||||
## 'XYZ':{
|
||||
## # Mode of transfer, this case, message transfer
|
||||
## 'mode':'msg_xfer',
|
||||
## # Public or Private auth
|
||||
## 'auth_type':'public',
|
||||
## # Name of the server/network
|
||||
## 'network_name':'My HBlink Server',
|
||||
## # URL to the dashboard of the server/network
|
||||
## 'url':'http://example.net/',
|
||||
## # Username and password given to you by network operator
|
||||
## 'user':'test_name',
|
||||
## 'password':'passw0rd'
|
||||
## },
|
||||
## # Shortcut used in SMS message
|
||||
## 'BBD':{
|
||||
## # Mode for application, operates differently than msg_xfer
|
||||
## 'mode':'app',
|
||||
## # Name of external application
|
||||
## 'app_name':'Multi Network Bulletin Board',
|
||||
## # Endpoint URL of API
|
||||
## 'url':'http://hbl.ink/bb/post',
|
||||
## # Website for users to get info
|
||||
## 'website':'http://hbl.ink',
|
||||
## },
|
||||
## 'HBL':{
|
||||
## 'mode':'msg_xfer',
|
||||
## 'auth_type':'public',
|
||||
## 'network_name':'KF7EEL Development Server',
|
||||
## 'url':'http://hbl.ink/d-aprs/',
|
||||
## }
|
||||
}
|
||||
|
||||
|
||||
'''
|
||||
|
||||
}
|
||||
|
||||
'''
|
||||
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!
|
||||
|
139
rules_full_bridge-SAMPLE.py
Executable file
139
rules_full_bridge-SAMPLE.py
Executable file
@ -0,0 +1,139 @@
|
||||
'''
|
||||
THIS EXAMPLE WILL NOT WORK AS IT IS - YOU MUST SPECIFY YOUR OWN VALUES!!!
|
||||
|
||||
This file is organized around the "Conference Bridges" that you wish to use. If you're a c-Bridge
|
||||
person, think of these as "bridge groups". You might also liken them to a "reflector". If a particular
|
||||
system is "ACTIVE" on a particular conference bridge, any traffid from that system will be sent
|
||||
to any other system that is active on the bridge as well. This is not an "end to end" method, because
|
||||
each system must independently be activated on the bridge.
|
||||
|
||||
The first level (e.g. "WORLDWIDE" or "STATEWIDE" in the examples) is the name of the conference
|
||||
bridge. This is any arbitrary ASCII text string you want to use. Under each conference bridge
|
||||
definition are the following items -- one line for each HBSystem as defined in the main HBlink
|
||||
configuration file.
|
||||
|
||||
* SYSTEM - The name of the sytem as listed in the main hblink configuration file (e.g. hblink.cfg)
|
||||
This MUST be the exact same name as in the main config file!!!
|
||||
* TS - Timeslot used for matching traffic to this confernce bridge
|
||||
XLX connections should *ALWAYS* use TS 2 only.
|
||||
* TGID - Talkgroup ID used for matching traffic to this conference bridge
|
||||
XLX connections should *ALWAYS* use TG 9 only.
|
||||
* ON and OFF are LISTS of Talkgroup IDs used to trigger this system off and on. Even if you
|
||||
only want one (as shown in the ON example), it has to be in list format. None can be
|
||||
handled with an empty list, such as " 'ON': [] ".
|
||||
* TO_TYPE is timeout type. If you want to use timers, ON means when it's turned on, it will
|
||||
turn off afer the timout period and OFF means it will turn back on after the timout
|
||||
period. If you don't want to use timers, set it to anything else, but 'NONE' might be
|
||||
a good value for documentation!
|
||||
* TIMOUT is a value in minutes for the timout timer. No, I won't make it 'seconds', so don't
|
||||
ask. Timers are performance "expense".
|
||||
* RESET is a list of Talkgroup IDs that, in addition to the ON and OFF lists will cause a running
|
||||
timer to be reset. This is useful if you are using different TGIDs for voice traffic than
|
||||
triggering. If you are not, there is NO NEED to use this feature.
|
||||
'''
|
||||
|
||||
BRIDGES = {
|
||||
## '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': []},
|
||||
]
|
||||
}
|
||||
|
||||
'''
|
||||
list the names of each system that should bridge unit to unit (individual) calls.
|
||||
'''
|
||||
|
||||
UNIT = ['MASTER-1', 'PEER-1']
|
||||
|
||||
'''
|
||||
Unit Call flood timeout:
|
||||
The amount of time to keep sending private calls to a single system before
|
||||
flooding all systems with the call. A higher value should be set for systems where subscribers
|
||||
are not moving between systems often. A lower value should be set for systems that have subscribers
|
||||
moving between systems often.
|
||||
|
||||
Time is in minutes.
|
||||
'''
|
||||
UNIT_TIME = 1
|
||||
|
||||
'''
|
||||
Input the DMR ID and SYSTEM of a subscriber that you would like to have always have private calls routed.
|
||||
This will not flood all systems.
|
||||
'''
|
||||
STATIC_UNIT = [
|
||||
[ 9099, 'MASTER-1']
|
||||
]
|
||||
|
||||
'''
|
||||
Manually specify other networks/servers that are authorized to send SMS to your server
|
||||
'''
|
||||
|
||||
authorized_users = {
|
||||
## 'DEF':{
|
||||
## 'mode':'msg_xfer',
|
||||
## 'user':'test_name',
|
||||
## 'password':'passw0rd'
|
||||
## },
|
||||
## 'XYZ':{
|
||||
## 'mode':'msg_xfer',
|
||||
## 'user':'test_name',
|
||||
## 'password':'passw0rd'
|
||||
## }
|
||||
}
|
||||
|
||||
'''
|
||||
List of external servers/networks or external applications that your users can access. The list below can be used in conjunction
|
||||
with or instead of the public list.
|
||||
'''
|
||||
|
||||
local_systems = {
|
||||
# Shortcut used in SMS message
|
||||
## 'XYZ':{
|
||||
# Mode of transfer, this case, message transfer
|
||||
## 'mode':'msg_xfer',
|
||||
# Public or Private auth
|
||||
## 'auth_type':'public',
|
||||
# Name of the server/network
|
||||
## 'network_name':'My HBlink Server',
|
||||
# URL to the dashboard of the server/network
|
||||
## 'url':'http://example.net/',
|
||||
# Username and password given to you by network operator
|
||||
## 'user':'test_name',
|
||||
## 'password':'passw0rd'
|
||||
## },
|
||||
# Shortcut used in SMS message
|
||||
## 'BBD':{
|
||||
# Mode for application, operates differently than msg_xfer
|
||||
## 'mode':'app',
|
||||
# Name of external application
|
||||
## 'app_name':'Multi Network Bulletin Board',
|
||||
# Endpoint URL of API
|
||||
## 'url':'http://hbl.ink/bb/post',
|
||||
# Website for users to get info
|
||||
## 'website':'http://hbl.ink',
|
||||
## },
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
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)
|
||||
print(STATIC_UNIT)
|
Loading…
Reference in New Issue
Block a user