From 09d1614adb18f5ad03d572c9a0a77fbd315ba416 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 e2c810d3f397395c959736682543826ac2fee172 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 df2bb56ba7367e600c182a44615e636a4eb6577a 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 75ccf3fe3cf1a705d29708654e2e4048b466e16f 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 2e42df99c0e851f390235d5b5d8df8505388823b 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 82b02ec8ec5a30c6cc06144d2a623b48d5265953 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 86c70aa1cac8f718e2338f1852b28b2161cc8073 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 25a7e3d39799b7e3c5ddd455e52b9c1884b38165 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 0f8374cea9c116aaec312ee5ee0148035405443a 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)) + 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 (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)) + 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