From 8e5f4f6830432c37fce6f00a29ef6942341703ec Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 22 Jul 2021 00:50:54 +0100 Subject: [PATCH 1/9] Fix logic error --- bridge_master.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index ea40d70..a1929b3 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -1397,9 +1397,9 @@ class routerOBP(OPENBRIDGE): #LoopControl hr_times = {} for system in systems: - if system == self._system: - continue - if CONFIG['SYSTEMS'][system]['MODE'] != 'OPENBRIDGE': + # if system == self._system: + # continue + if system != self._system CONFIG['SYSTEMS'][system]['MODE'] != 'OPENBRIDGE': for _sysslot in systems[system].STATUS: if 'RX_STREAM_ID' in systems[system].STATUS[_sysslot] and _stream_id == systems[system].STATUS[_sysslot]['RX_STREAM_ID']: if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']: From 2c9b93a78dbb8a4d8385af4b58411efdfe2ea3a9 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 22 Jul 2021 00:52:35 +0100 Subject: [PATCH 2/9] Andy --- bridge_master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge_master.py b/bridge_master.py index a1929b3..6ef69fa 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -1399,7 +1399,7 @@ class routerOBP(OPENBRIDGE): for system in systems: # if system == self._system: # continue - if system != self._system CONFIG['SYSTEMS'][system]['MODE'] != 'OPENBRIDGE': + if system != self._system and CONFIG['SYSTEMS'][system]['MODE'] != 'OPENBRIDGE': for _sysslot in systems[system].STATUS: if 'RX_STREAM_ID' in systems[system].STATUS[_sysslot] and _stream_id == systems[system].STATUS[_sysslot]['RX_STREAM_ID']: if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']: From 31ae7d00f9ea8e1a6f583c6c8fe25ab57600a6ad Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 22 Jul 2021 01:03:43 +0100 Subject: [PATCH 3/9] fi in logs --- bridge_master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge_master.py b/bridge_master.py index 6ef69fa..3b64d6b 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -1420,7 +1420,7 @@ class routerOBP(OPENBRIDGE): if self._system != fi: if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']: - logger.warning("(%s) OBP *LoopControl* FIRST OBP %s, STREAM ID: %s, TG %s, IGNORE THIS SOURCE",self._system, system, int_id(_stream_id), int_id(_dst_id)) + logger.warning("(%s) OBP *LoopControl* FIRST OBP %s, STREAM ID: %s, TG %s, IGNORE THIS SOURCE",self._system, fi, int_id(_stream_id), int_id(_dst_id)) self.STATUS[_stream_id]['LOOPLOG'] = True self.STATUS[_stream_id]['LAST'] = pkt_time From 2a4d4bdd55355a0cf72920e18e70d501fa14b7ce Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 22 Jul 2021 01:26:09 +0100 Subject: [PATCH 4/9] Clearer logging of BCSQ --- bridge_master.py | 8 ++++++-- config.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 3b64d6b..579c40a 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -415,8 +415,12 @@ def stream_trimmer_loop(): _stream = systems[system].STATUS[stream_id] _sysconfig = CONFIG['SYSTEMS'][system] #systems[system].STATUS[stream_id]['_fin'] = True - logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 Duration: %.2f', \ - system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids), _stream['LAST'] - _stream['START']) + if '_bcsq' not in systems[system].STATUS[stream_id]: + logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 Duration: %.2f', \ + system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids), _stream['LAST'] - _stream['START']) + else: + logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (BCSQ)', \ + system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids)) if CONFIG['REPORTS']['REPORT']: systems[system]._report.send_bridgeEvent('GROUP VOICE,END,RX,{},{},{},{},{},{},{:.2f}'.format(system, int_id(stream_id), int_id(_stream['RX_PEER']), int_id(_stream['RFS']), 1, int_id(_stream['TGID']), _stream['LAST'] - _stream['START']).encode(encoding='utf-8', errors='ignore')) systems[system].STATUS[stream_id]['_to'] = True diff --git a/config.py b/config.py index 500294f..afe383b 100755 --- a/config.py +++ b/config.py @@ -316,7 +316,7 @@ def build_config(_config_file): 'MODE': config.get(section, 'MODE'), 'ENABLED': config.getboolean(section, 'ENABLED'), 'NETWORK_ID': config.getint(section, 'NETWORK_ID').to_bytes(4, 'big'), - 'OVERRIDE_SERVER_ID': config.getint(section, 'OVERRIDE_SERVER_ID').to_bytes(4, 'big'), + #'OVERRIDE_SERVER_ID': config.getint(section, 'OVERRIDE_SERVER_ID').to_bytes(4, 'big'), 'IP': config.get(section, 'IP'), 'PORT': config.getint(section, 'PORT'), 'PASSPHRASE': bytes(config.get(section, 'PASSPHRASE').ljust(20,'\x00')[:20], 'utf-8'), From 81a35a8d6a221829fb7c89298c9d0c249eceee86 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 22 Jul 2021 01:39:33 +0100 Subject: [PATCH 5/9] Handle RX BCSQ --- bridge_master.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bridge_master.py b/bridge_master.py index 579c40a..10d6d63 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -418,8 +418,11 @@ def stream_trimmer_loop(): if '_bcsq' not in systems[system].STATUS[stream_id]: logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 Duration: %.2f', \ system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids), _stream['LAST'] - _stream['START']) + elif '_bcsq' in _sysconfig and _tgid in _sysconfig['_bcsq'] and _sysconfig['_bcsq'][_tgid] == stream_id: + logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (RX BCSQ)', \ + system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids)) else: - logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (BCSQ)', \ + logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (TX BCSQ)', \ system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids)) if CONFIG['REPORTS']['REPORT']: systems[system]._report.send_bridgeEvent('GROUP VOICE,END,RX,{},{},{},{},{},{},{:.2f}'.format(system, int_id(stream_id), int_id(_stream['RX_PEER']), int_id(_stream['RFS']), 1, int_id(_stream['TGID']), _stream['LAST'] - _stream['START']).encode(encoding='utf-8', errors='ignore')) From ea376ebbf333b6e24c47c228a1190c08a06e86c3 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 22 Jul 2021 01:41:30 +0100 Subject: [PATCH 6/9] fix streamid --- bridge_master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge_master.py b/bridge_master.py index 10d6d63..a4be826 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -418,7 +418,7 @@ def stream_trimmer_loop(): if '_bcsq' not in systems[system].STATUS[stream_id]: logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 Duration: %.2f', \ system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids), _stream['LAST'] - _stream['START']) - elif '_bcsq' in _sysconfig and _tgid in _sysconfig['_bcsq'] and _sysconfig['_bcsq'][_tgid] == stream_id: + elif '_bcsq' in _sysconfig and _tgid in _sysconfig['_bcsq'] and _sysconfig['_bcsq'][_stream['TGID']] == stream_id: logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (RX BCSQ)', \ system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids)) else: From f0efcfedbb0ff1aae44f938404b903ef5ac3666f Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 22 Jul 2021 01:42:50 +0100 Subject: [PATCH 7/9] more fixing streamid --- bridge_master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge_master.py b/bridge_master.py index a4be826..75b83a3 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -418,7 +418,7 @@ def stream_trimmer_loop(): if '_bcsq' not in systems[system].STATUS[stream_id]: logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 Duration: %.2f', \ system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids), _stream['LAST'] - _stream['START']) - elif '_bcsq' in _sysconfig and _tgid in _sysconfig['_bcsq'] and _sysconfig['_bcsq'][_stream['TGID']] == stream_id: + elif '_bcsq' in _sysconfig and _stream['TGID'] in _sysconfig['_bcsq'] and _sysconfig['_bcsq'][_stream['TGID']] == stream_id: logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (RX BCSQ)', \ system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids)) else: From 5c2de8ed4d4ef9334217e7951fbbcaea2a611d24 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 22 Jul 2021 01:48:42 +0100 Subject: [PATCH 8/9] Log all BCSQ the same --- bridge_master.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 75b83a3..24cf421 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -419,10 +419,10 @@ def stream_trimmer_loop(): logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 Duration: %.2f', \ system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids), _stream['LAST'] - _stream['START']) elif '_bcsq' in _sysconfig and _stream['TGID'] in _sysconfig['_bcsq'] and _sysconfig['_bcsq'][_stream['TGID']] == stream_id: - logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (RX BCSQ)', \ + logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (BCSQ)', \ system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids)) else: - logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (TX BCSQ)', \ + logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (BCSQ)', \ system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids)) if CONFIG['REPORTS']['REPORT']: systems[system]._report.send_bridgeEvent('GROUP VOICE,END,RX,{},{},{},{},{},{},{:.2f}'.format(system, int_id(stream_id), int_id(_stream['RX_PEER']), int_id(_stream['RFS']), 1, int_id(_stream['TGID']), _stream['LAST'] - _stream['START']).encode(encoding='utf-8', errors='ignore')) From b71f960bec9b807e2dabcf3532ab1c2218c0fecd Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 22 Jul 2021 01:55:39 +0100 Subject: [PATCH 9/9] More BCSQ logging tidying --- bridge_master.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 24cf421..b3225ba 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -415,15 +415,16 @@ def stream_trimmer_loop(): _stream = systems[system].STATUS[stream_id] _sysconfig = CONFIG['SYSTEMS'][system] #systems[system].STATUS[stream_id]['_fin'] = True - if '_bcsq' not in systems[system].STATUS[stream_id]: - logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 Duration: %.2f', \ - system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids), _stream['LAST'] - _stream['START']) - elif '_bcsq' in _sysconfig and _stream['TGID'] in _sysconfig['_bcsq'] and _sysconfig['_bcsq'][_stream['TGID']] == stream_id: - logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (BCSQ)', \ + if '_bcsq' in _sysconfig and _stream['TGID'] in _sysconfig['_bcsq'] and _sysconfig['_bcsq'][_stream['TGID']] == stream_id: + logger.debug('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (BCSQ)', \ system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids)) - else: - logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (BCSQ)', \ + elif '_bcsq' in systems[system].STATUS[stream_id] : + logger.debug('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 (BCSQ)', \ system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids)) + else: + logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 Duration: %.2f', \ + system, int_id(stream_id), get_alias(int_id(_stream['RFS']), subscriber_ids), get_alias(int_id(_stream['RX_PEER']), peer_ids), get_alias(int_id(_stream['TGID']), talkgroup_ids), _stream['LAST'] - _stream['START']) + if CONFIG['REPORTS']['REPORT']: systems[system]._report.send_bridgeEvent('GROUP VOICE,END,RX,{},{},{},{},{},{},{:.2f}'.format(system, int_id(stream_id), int_id(_stream['RX_PEER']), int_id(_stream['RFS']), 1, int_id(_stream['TGID']), _stream['LAST'] - _stream['START']).encode(encoding='utf-8', errors='ignore')) systems[system].STATUS[stream_id]['_to'] = True