update SAMPLEs, finish uncommenting of SS

This commit is contained in:
KF7EEL 2022-09-24 19:13:35 -07:00
parent 754b8b54eb
commit cb0f93579c
4 changed files with 87 additions and 81 deletions

View File

@ -47,6 +47,21 @@ TGID_TS1_ACL: PERMIT:ALL
TGID_TS2_ACL: PERMIT:ALL
# Web Service# This is where to configure the details for use with a user managment script
[WEB_SERVICE]
THIS_SERVER_NAME: DATA_GATEWAY
# This must be set to True in order to use the web service an any mode.
REMOTE_CONFIG_ENABLED: False
# If web service unavailable, quit.
DISABLE_FALLBACK: True
# FreeDMR and HBLink - set DASHBOARD_ONLY to True, leave THIS_SERVER_NAME and SHARED_SECRET as DATA_GATEWAY
# HBNet - set DASHBOARD_ONLY to False
DASHBOARD_ONLY: False
# URL of the user managment server
URL: http://localhost:8080/svr
### Secret used to authenticate with web service
SHARED_SECRET: DATA_GATEWAY
# NOT YET WORKING: NETWORK REPORTING CONFIGURATION
# Enabling "REPORT" will configure a socket-based reporting
# system that will send the configuration and other items
@ -105,19 +120,6 @@ PEER_URL: https://www.radioid.net/static/rptrs.json
SUBSCRIBER_URL: https://www.radioid.net/static/users.json
STALE_DAYS: 7
# Web Service# This is where to configure the details for use with a user managment script
[WEB_SERVICE]
THIS_SERVER_NAME: DATA_GATEWAY
# This must be set to True in order to use the web service an any mode.
REMOTE_CONFIG_ENABLED: False
# FreeDMR and HBLink - set DASHBOARD_ONLY to True, leave THIS_SERVER_NAME and SHARED_SECRET as DATA_GATEWAY
# HBNet - set DASHBOARD_ONLY to False
DASHBOARD_ONLY: False
# URL of the user managment server
URL: http://localhost:8080/svr
### Secret used to authenticate with web service
SHARED_SECRET: DATA_GATEWAY
[DATA_CONFIG]
DATA_DMR_ID: 9099
CALL_TYPE: both

View File

@ -448,28 +448,28 @@ def send_mb(CONFIG, _dst_callsign, _src_callsign, message, _dst_dmr_id, _src_dmr
logger.error('Config server unreachable')
def send_ss(CONFIG, callsign, message, dmr_id):
if LOCAL_CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True:
user_man_url = CONFIG['WEB_SERVICE']['URL']
shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
sms_data = {
'ss_update': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
'secret':shared_secret,
'callsign': callsign,
'message' : message,
'dmr_id' : dmr_id,
# def send_ss(CONFIG, callsign, message, dmr_id):
# if LOCAL_CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True:
# user_man_url = CONFIG['WEB_SERVICE']['URL']
# shared_secret = str(sha256(CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
# sms_data = {
# 'ss_update': CONFIG['WEB_SERVICE']['THIS_SERVER_NAME'],
# 'secret':shared_secret,
# 'callsign': callsign,
# 'message' : message,
# 'dmr_id' : dmr_id,
}
json_object = json.dumps(sms_data, indent = 4)
# }
# json_object = json.dumps(sms_data, indent = 4)
try:
req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
logger.debug('Social Status sent.')
## resp = json.loads(req.text)
## print(resp)
## return resp['rules']
except requests.ConnectionError:
logger.error('Config server unreachable')
# try:
# req = requests.post(user_man_url, data=json_object, headers={'Content-Type': 'application/json'})
# logger.debug('Social Status sent.')
# ## resp = json.loads(req.text)
# ## print(resp)
# ## return resp['rules']
# except requests.ConnectionError:
# logger.error('Config server unreachable')
def send_unit_table(CONFIG, _data):
user_man_url = CONFIG['WEB_SERVICE']['URL']
@ -882,13 +882,13 @@ def process_sms(_rf_src, sms, call_type, system_name):
parse_sms = sms.split(' ')
logger.debug(parse_sms)
## logger.debug(call_type)
# Social Status function
if '*SS' == parse_sms[0]:
s = ' '
post = s.join(parse_sms[1:])
send_ss(CONFIG, str(get_alias(int_id(_rf_src), subscriber_ids)), post, int_id(_rf_src))
# # Social Status function
# if '*SS' == parse_sms[0]:
# s = ' '
# post = s.join(parse_sms[1:])
# send_ss(CONFIG, str(get_alias(int_id(_rf_src), subscriber_ids)), post, int_id(_rf_src))
# Offload some commands onto the HBNet web service
elif '*RSS' in parse_sms[0] or '*RBB' in parse_sms[0] or '*RMB' in parse_sms[0]:
if '*RSS' in parse_sms[0] or '*RBB' in parse_sms[0] or '*RMB' in parse_sms[0]:
send_sms_cmd(CONFIG, int_id(_rf_src), sms)
# Tiny Page query
elif '?' in parse_sms[0]:

View File

@ -46,6 +46,35 @@ SUB_ACL: DENY:1
TGID_TS1_ACL: PERMIT:ALL
TGID_TS2_ACL: PERMIT:ALL
# This is where to configure the details for use with the web service. The web service is the GUI frontend.
[WEB_SERVICE]
THIS_SERVER_NAME: MMDVM_Server
# Secret used to authenticate with user managment server, before checking if user login is approved
SHARED_SECRET: test
# Retrieve configuration from web service.
REMOTE_CONFIG_ENABLED: True
# When web service unreachable, die.
DISABLE_FALLBACK: True
# URL of the web service
URL: http://localhost:8080/svr
# The options below are used for generating random passphrases
# Set to a value between 1 - 99. This value is used in the normal calculation.
APPEND_INT: 1
# Set to a value between 1 - 99 This value is used in the normal calculation.
EXTRA_INT_1: 5
# Set to a value between 1 - 99 This value is used in the normal calculation.
EXTRA_INT_2: 8
# Additional phrases
EXTRA_1: TeSt
EXTRA_2: DmR4
# Shorten passphrases
SHORTEN_PASSPHRASE: True
SHORTEN_SAMPLE: 4
SHORTEN_LENGTH: 4
BURN_FILE: ./burn_ids.txt
# Set to a value between 1 - 99. This value is used for compromised passphrases.
BURN_INT: 5
# NOT YET WORKING: NETWORK REPORTING CONFIGURATION
# Enabling "REPORT" will configure a socket-based reporting
@ -106,31 +135,6 @@ PEER_URL: https://www.radioid.net/static/rptrs.json
SUBSCRIBER_URL: https://www.radioid.net/static/users.json
STALE_DAYS: 7
# USER MANAGER
# This is where to configure the details for use with a user managment script
[WEB_SERVICE]
THIS_SERVER_NAME: MMDVM_Server
# When web service unreachable, die.
DISABLE_FALLBACK: True
REMOTE_CONFIG_ENABLED: True
# URL of the user managment server
URL: http://localhost:8080/svr
# Integer appended to DMR ID during the generation of a passphrase
APPEND_INT: 1
EXTRA_INT_1: 5
EXTRA_INT_2: 8
EXTRA_1: TeSt
EXTRA_2: DmR4
# Secret used to authenticate with user managment server, before checking if user login is approved
SHARED_SECRET: test
# Shorten passphrases
SHORTEN_PASSPHRASE: True
SHORTEN_SAMPLE: 4
SHORTEN_LENGTH: 4
BURN_FILE: ./burn_ids.txt
BURN_INT: 5
# 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

View File

@ -7599,10 +7599,10 @@ Name: <strong>''' + p.name + '''</strong>&nbsp; -&nbsp; Port: <strong>''' + str(
mailbox_add(hblink_req['src_callsign'], hblink_req['dst_callsign'], hblink_req['message'], hblink_req['src_dmr_id'], hblink_req['dst_dmr_id'], hblink_req['mb_add'], hblink_req['system_name'])
response = 'rcvd'
elif 'ss_update' in hblink_req:
del_ss(hblink_req['dmr_id'])
ss_add(hblink_req['callsign'], str(hblink_req['message']), hblink_req['dmr_id'])
response = 'rcvd'
# elif 'ss_update' in hblink_req:
# del_ss(hblink_req['dmr_id'])
# ss_add(hblink_req['callsign'], str(hblink_req['message']), hblink_req['dmr_id'])
# response = 'rcvd'
elif 'unit_table' in hblink_req:
## del_unit_table(hblink_req['unit_table'])
try:
@ -7676,20 +7676,20 @@ Name: <strong>''' + p.name + '''</strong>&nbsp; -&nbsp; Port: <strong>''' + str(
sms_que_add('', '', 0, hblink_req['rf_id'], 'motorola', 'unit', hblink_req['sms_cmd'], '', tp.content)
except:
sms_que_add('', '', 0, hblink_req['rf_id'], 'motorola', 'unit', hblink_req['sms_cmd'], '', 'Query not found or other error.')
elif hblink_req['cmd'][:4] == '*RSS':
try:
try:
retr = int(split_cmd[1])
except:
retr = split_cmd[1]
# elif hblink_req['cmd'][:4] == '*RSS':
# try:
# try:
# retr = int(split_cmd[1])
# except:
# retr = split_cmd[1]
if type(retr) == int:
ss = Social.query.filter_by(dmr_id=int(split_cmd[1])).order_by(Social.time.desc()).first()
elif type(retr) == str:
ss = Social.query.filter_by(callsign=str(split_cmd[1]).upper()).order_by(Social.time.desc()).first()
sms_que_add('', '', 0, hblink_req['rf_id'], 'motorola', 'unit', hblink_req['sms_cmd'], '', 'Last: ' + ss.message)
except:
sms_que_add('', '', 0, hblink_req['rf_id'], 'motorola', 'unit', hblink_req['sms_cmd'], '', 'Not found or other error')
# if type(retr) == int:
# ss = Social.query.filter_by(dmr_id=int(split_cmd[1])).order_by(Social.time.desc()).first()
# elif type(retr) == str:
# ss = Social.query.filter_by(callsign=str(split_cmd[1]).upper()).order_by(Social.time.desc()).first()
# sms_que_add('', '', 0, hblink_req['rf_id'], 'motorola', 'unit', hblink_req['sms_cmd'], '', 'Last: ' + ss.message)
# except:
# sms_que_add('', '', 0, hblink_req['rf_id'], 'motorola', 'unit', hblink_req['sms_cmd'], '', 'Not found or other error')
elif hblink_req['cmd'][:4] == '*RBB':
try: