From f6dcb6bc74e8927b6be25b2fe2a9e9f541b9251e Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 16:16:30 +0000 Subject: [PATCH 01/18] Added LoopControl to UNIT via OBP. Now proceeding with CAUTION! --- bridge_master.py | 102 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 90 insertions(+), 12 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 511f30b..1b2308e 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1378,6 +1378,49 @@ class routerOBP(OPENBRIDGE): #logger.debug('(%s) Packet routed by bridge: %s to system: %s TS: %s, TGID: %s', self._system, _bridge, _target['SYSTEM'], _target['TS'], int_id(_target['TGID'])) #Ignore this system and TS pair if it's called again on this packet return(_sysIgnore) + + def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src): + #Assemble transmit HBP packet header + _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) + _tmp_data = b''.join([_tmp_data, dmrpkt]) + systems[_d_system].send_system(_tmp_data) + logger.info('(%s) UNIT Data Bridged to HBP on slot 1: %s DST_ID: %s',self._system,_d_system,_int_dst_id) + if CONFIG['REPORTS']['REPORT']: + systems[_d_system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(_d_system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) + + def sendDatatoOBP(self,_target,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits): + + _int_dst_id = int_id(_dst_id) + _target_status = systems[_target].STATUS + _target_system = self._CONFIG['SYSTEMS'][_target] + + + #If target has missed 6 (on 1 min) of keepalives, don't send + if _target_system['ENHANCED_OBP'] and '_bcka' in _target_system and _target_system['_bcka'] < pkt_time - 60: + return + + if (_stream_id not in _target_status): + # This is a new call stream on the target + _target_status[_stream_id] = { + 'START': pkt_time, + 'CONTENTION':False, + 'RFS': _rf_src, + 'TGID': _dst_id, + 'RX_PEER': _peer_id + } + + # Record the time of this packet so we can later identify a stale stream + _target_status[_stream_id]['LAST'] = pkt_time + # Clear the TS bit -- all OpenBridge streams are effectively on TS1 + _tmp_bits = _bits & ~(1 << 7) + #Assemble transmit HBP packet header + _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) + _tmp_data = b''.join([_tmp_data, dmrpkt]) + systems[_target].send_system(_tmp_data) + logger.info('(%s) UNIT Data Bridged to OBP System: %s DST_ID: %s', self._system, _target,_int_dst_id) + if CONFIG['REPORTS']['REPORT']: + systems[system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(_target, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) + def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data): pkt_time = time() @@ -1389,6 +1432,45 @@ class routerOBP(OPENBRIDGE): ## if ahex(dmrpkt)[27:-27] == b'd5d7f77fd757': # This is a data call _data_call = True + + # Is this a new call stream? + if (_stream_id not in self.STATUS): + + # This is a new call stream + self.STATUS[_stream_id] = { + 'START': pkt_time, + 'CONTENTION':False, + 'RFS': _rf_src, + 'TGID': _dst_id, + '1ST': perf_counter(), + 'lastSeq': False, + 'lastData': False, + 'RX_PEER': _peer_id + + } + + if _stream_id in systems[system].STATUS and '1ST' in systems[system].STATUS[_stream_id] and systems[system].STATUS[_stream_id]['TGID'] == _dst_id: + hr_times[system] = systems[system].STATUS[_stream_id]['1ST'] + + #use the minimum perf_counter to ensure + #We always use only the earliest packet + fi = min(hr_times, key=hr_times.get, default = False) + + hr_times = None + + if not fi: + logger.warning("(%s) OBP UNIT *LoopControl* fi is empty for some reason : %s, STREAM ID: %s, TG: %s, TS: %s",self._system, int_id(_stream_id), int_id(_dst_id),_sysslot) + return + + if self._system != fi: + if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']: + logger.warning("(%s) OBP UNIT *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 + return + + + if _dtype_vseq == 3: logger.info('(%s) *UNIT CSBK* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) DST_ID %s (%s), TS %s', \ self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot) @@ -1413,7 +1495,7 @@ class routerOBP(OPENBRIDGE): logger.info('(%s) *UNKNOWN DATA TYPE* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s', \ self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot) - + self.STATUS[_stream_id]['LAST'] = pkt_time if _call_type == 'group' or _call_type == 'vcsbk': # Is this a new call stream? @@ -1829,8 +1911,6 @@ class routerHBP(HBSYSTEM): if CONFIG['REPORTS']['REPORT']: systems[system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(_target, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) - #return(_sysIgnore) - def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data): @@ -1880,15 +1960,13 @@ class routerHBP(HBSYSTEM): #Send to all openbridges # sysIgnore = [] - #Don't forward if ID is local - if _dst_id not in SUB_MAP: - for system in systems: - if system == self._system: - continue - #We only want to send data calls to individual IDs vis OpenBridge - if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and _int_dst_id >= 1000000: - #Disabled in master for now - self.sendDatatoOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits) + for system in systems: + if system == self._system: + continue + #We only want to send data calls to individual IDs vis OpenBridge + if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and _int_dst_id >= 1000000: + #Disabled in master for now + self.sendDatatoOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits) #Send UNIT data to data gateway #if CONFIG['GLOBAL']['DATA_GATEWAY'] and (CONFIG['GLOBAL']['DATA_GATEWAY'] in systems) \ From cc0a9295e55fcb1d6dad7df551905902bd4ac803 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 16:24:00 +0000 Subject: [PATCH 02/18] try to fix last error --- bridge_master.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bridge_master.py b/bridge_master.py index 1b2308e..2a94491 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1460,6 +1460,7 @@ class routerOBP(OPENBRIDGE): if not fi: logger.warning("(%s) OBP UNIT *LoopControl* fi is empty for some reason : %s, STREAM ID: %s, TG: %s, TS: %s",self._system, int_id(_stream_id), int_id(_dst_id),_sysslot) + self.STATUS[_stream_id]['LAST'] = pkt_time return if self._system != fi: From 49442d7607bc6069d21851dea3c010e6a7fff210 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 16:27:06 +0000 Subject: [PATCH 03/18] try to fix last error 2 --- bridge_master.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 2a94491..4d51721 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1448,9 +1448,12 @@ class routerOBP(OPENBRIDGE): 'RX_PEER': _peer_id } - + + self.STATUS[_stream_id]['LAST'] = pkt_time + + if _stream_id in systems[system].STATUS and '1ST' in systems[system].STATUS[_stream_id] and systems[system].STATUS[_stream_id]['TGID'] == _dst_id: - hr_times[system] = systems[system].STATUS[_stream_id]['1ST'] + hr_times[system] = systems[system].STATUS[_stream_id]['1ST'] #use the minimum perf_counter to ensure #We always use only the earliest packet @@ -1496,7 +1499,6 @@ class routerOBP(OPENBRIDGE): logger.info('(%s) *UNKNOWN DATA TYPE* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s', \ self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot) - self.STATUS[_stream_id]['LAST'] = pkt_time if _call_type == 'group' or _call_type == 'vcsbk': # Is this a new call stream? From 0bf131fe5f419f7db8da94107eda54415e402168 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 16:48:18 +0000 Subject: [PATCH 04/18] for system in systems --- bridge_master.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 4d51721..baad53f 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1449,29 +1449,29 @@ class routerOBP(OPENBRIDGE): } - self.STATUS[_stream_id]['LAST'] = pkt_time - - if _stream_id in systems[system].STATUS and '1ST' in systems[system].STATUS[_stream_id] and systems[system].STATUS[_stream_id]['TGID'] == _dst_id: - hr_times[system] = systems[system].STATUS[_stream_id]['1ST'] + hr_times = {} + for system in systems: + if _stream_id in systems[system].STATUS and '1ST' in systems[system].STATUS[_stream_id] and systems[system].STATUS[_stream_id]['TGID'] == _dst_id: + hr_times[system] = systems[system].STATUS[_stream_id]['1ST'] + + #use the minimum perf_counter to ensure + #We always use only the earliest packet + fi = min(hr_times, key=hr_times.get, default = False) - #use the minimum perf_counter to ensure - #We always use only the earliest packet - fi = min(hr_times, key=hr_times.get, default = False) - - hr_times = None - - if not fi: - logger.warning("(%s) OBP UNIT *LoopControl* fi is empty for some reason : %s, STREAM ID: %s, TG: %s, TS: %s",self._system, int_id(_stream_id), int_id(_dst_id),_sysslot) - self.STATUS[_stream_id]['LAST'] = pkt_time - return - - if self._system != fi: - if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']: - logger.warning("(%s) OBP UNIT *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 - return + hr_times = None + + if not fi: + logger.warning("(%s) OBP UNIT *LoopControl* fi is empty for some reason : %s, STREAM ID: %s, TG: %s, TS: %s",self._system, int_id(_stream_id), int_id(_dst_id),_sysslot) + self.STATUS[_stream_id]['LAST'] = pkt_time + return + + if self._system != fi: + if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']: + logger.warning("(%s) OBP UNIT *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 + return From d8db9aabd5f7311c9eee4d0c0b8060e106b9a636 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 16:51:46 +0000 Subject: [PATCH 05/18] boing --- bridge_master.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index baad53f..2fd88ec 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1449,29 +1449,30 @@ class routerOBP(OPENBRIDGE): } + self.STATUS[_stream_id]['LAST'] = pkt_time hr_times = {} for system in systems: if _stream_id in systems[system].STATUS and '1ST' in systems[system].STATUS[_stream_id] and systems[system].STATUS[_stream_id]['TGID'] == _dst_id: hr_times[system] = systems[system].STATUS[_stream_id]['1ST'] - #use the minimum perf_counter to ensure - #We always use only the earliest packet - fi = min(hr_times, key=hr_times.get, default = False) - - hr_times = None - - if not fi: - logger.warning("(%s) OBP UNIT *LoopControl* fi is empty for some reason : %s, STREAM ID: %s, TG: %s, TS: %s",self._system, int_id(_stream_id), int_id(_dst_id),_sysslot) - self.STATUS[_stream_id]['LAST'] = pkt_time - return - - if self._system != fi: - if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']: - logger.warning("(%s) OBP UNIT *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 - return + #use the minimum perf_counter to ensure + #We always use only the earliest packet + fi = min(hr_times, key=hr_times.get, default = False) + + hr_times = None + + if not fi: + logger.warning("(%s) OBP UNIT *LoopControl* fi is empty for some reason : %s, STREAM ID: %s, TG: %s, TS: %s",self._system, int_id(_stream_id), int_id(_dst_id),_sysslot) + self.STATUS[_stream_id]['LAST'] = pkt_time + return + + if self._system != fi: + if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']: + logger.warning("(%s) OBP UNIT *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 + return From 04da7a9d842a92af49c022511101ee6a9a91654b Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 16:55:58 +0000 Subject: [PATCH 06/18] check hbp too --- bridge_master.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 2fd88ec..692cdae 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1449,12 +1449,21 @@ class routerOBP(OPENBRIDGE): } - self.STATUS[_stream_id]['LAST'] = pkt_time + #self.STATUS[_stream_id]['LAST'] = pkt_time hr_times = {} for system in systems: - if _stream_id in systems[system].STATUS and '1ST' in systems[system].STATUS[_stream_id] and systems[system].STATUS[_stream_id]['TGID'] == _dst_id: - hr_times[system] = systems[system].STATUS[_stream_id]['1ST'] + 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']: + logger.warning("(%s) OBP UNIT *LoopControl* FIRST HBP: %s, STREAM ID: %s, TG: %s, TS: %s, IGNORE THIS SOURCE",self._system, system, int_id(_stream_id), int_id(_dst_id),_sysslot) + self.STATUS[_stream_id]['LOOPLOG'] = True + self.STATUS[_stream_id]['LAST'] = pkt_time + return + else: + if _stream_id in systems[system].STATUS and '1ST' in systems[system].STATUS[_stream_id] and systems[system].STATUS[_stream_id]['TGID'] == _dst_id: + hr_times[system] = systems[system].STATUS[_stream_id]['1ST'] #use the minimum perf_counter to ensure #We always use only the earliest packet From 715a5f8a78e6e219beaaaf1dcab2126f6186ac43 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 16:57:58 +0000 Subject: [PATCH 07/18] last again --- bridge_master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge_master.py b/bridge_master.py index 692cdae..32563bf 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1449,7 +1449,7 @@ class routerOBP(OPENBRIDGE): } - #self.STATUS[_stream_id]['LAST'] = pkt_time + self.STATUS[_stream_id]['LAST'] = pkt_time hr_times = {} for system in systems: From ec9356f31697ac885b36405525522954e19342d6 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 17:11:48 +0000 Subject: [PATCH 08/18] send to HBP locations from OBP --- bridge_master.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/bridge_master.py b/bridge_master.py index 32563bf..9ae1383 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1509,6 +1509,62 @@ class routerOBP(OPENBRIDGE): logger.info('(%s) *UNKNOWN DATA TYPE* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s', \ self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot) + #If destination ID is in the Subscriber Map + if _dst_id in SUB_MAP: + (_d_system,_d_slot,_d_time) = SUB_MAP[_dst_id] + _dst_slot = systems[_d_system].STATUS[_d_slot] + logger.info('(%s) SUB_MAP matched, System: %s Slot: %s, Time: %s',self._system, _d_system,_d_slot,_d_time) + #If slot is idle for RX and TX + if (_dst_slot['RX_TYPE'] == HBPF_SLT_VTERM) and (_dst_slot['TX_TYPE'] == HBPF_SLT_VTERM) and (time() - _dst_slot['TX_TIME'] > CONFIG['SYSTEMS'][_d_system]['GROUP_HANGTIME']): + #rewrite slot if required + if _slot != _d_slot: + _tmp_bits = _bits ^ 1 << 7 + else: + _tmp_bits = _bits + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src) + + else: + logger.info('(%s) UNIT Data not bridged to HBP on slot 1 - target busy: %s DST_ID: %s',self._system,_d_system,_int_dst_id) + + elif _int_dst_id == 900999: + if 'D-APRS' in systems and CONFIG['SYSTEMS']['D-APRS']['MODE'] == 'MASTER': + _d_system = 'D-APRS' + _d_slot = _slot + _dst_slot = systems['D-APRS'].STATUS[_slot] + logger.info('(%s) D-APRS ID matched, System: %s Slot: %s',self._system, _d_system,_slot) + #If slot is idle for RX and TX + if (_dst_slot['RX_TYPE'] == HBPF_SLT_VTERM) and (_dst_slot['TX_TYPE'] == HBPF_SLT_VTERM) and (time() - _dst_slot['TX_TIME'] > CONFIG['SYSTEMS'][_d_system]['GROUP_HANGTIME']): + #We will allow the system to use both slots + _tmp_bits = _bits + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src) + + else: + logger.info('(%s) UNIT Data not bridged to HBP on slot %s - target busy: %s DST_ID: %s',self._system,_d_slot,_d_system,_int_dst_id) + + else: + #If destination ID is logged in as a hotspot + for _d_system in systems: + if CONFIG['SYSTEMS'][_d_system]['MODE'] == 'MASTER': + for _to_peer in CONFIG['SYSTEMS'][_d_system]['PEERS']: + _int_to_peer = int_id(_to_peer) + if (str(_int_to_peer)[:7] == str(_int_dst_id)[:7]): + #(_d_system,_d_slot,_d_time) = SUB_MAP[_dst_id] + _d_slot = 2 + _dst_slot = systems[_d_system].STATUS[_d_slot] + logger.info('(%s) User Peer Hotspot ID matched, System: %s Slot: %s',self._system, _d_system,_d_slot) + #If slot is idle for RX and TX + if (_dst_slot['RX_TYPE'] == HBPF_SLT_VTERM) and (_dst_slot['TX_TYPE'] == HBPF_SLT_VTERM) and (time() - _dst_slot['TX_TIME'] > CONFIG['SYSTEMS'][_d_system]['GROUP_HANGTIME']): + #Always use slot2 for hotspots - many of them are simplex and this + #is the convention + #rewrite slot if required (slot 2 is used on hotspots) + if _slot != 2: + _tmp_bits = _bits ^ 1 << 7 + else: + _tmp_bits = _bits + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src) + + else: + logger.info('(%s) UNIT Data not bridged to HBP on slot %s - target busy: %s DST_ID: %s',self._system,_d_slot,_d_system,_int_dst_id) if _call_type == 'group' or _call_type == 'vcsbk': # Is this a new call stream? From a365c6a2e2a37628f9516396c2f2f3ac3283db96 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 17:13:39 +0000 Subject: [PATCH 09/18] send to HBP locations from OBP-- --- bridge_master.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bridge_master.py b/bridge_master.py index 9ae1383..47277d6 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1429,6 +1429,8 @@ class routerOBP(OPENBRIDGE): # Match UNIT data, SMS/GPS, and send it to the dst_id if it is in out UNIT_MAP if _call_type == 'unit' and (_dtype_vseq == 6 or _dtype_vseq == 7 or ((_stream_id not in self.STATUS) and _dtype_vseq == 3)): + + _int_dst_id = int_id(_dst_id) ## if ahex(dmrpkt)[27:-27] == b'd5d7f77fd757': # This is a data call _data_call = True From 1082b87d815712ee0c10064dc22aabf449cc26cc Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 17:20:02 +0000 Subject: [PATCH 10/18] its that int_dst_id again! --- bridge_master.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bridge_master.py b/bridge_master.py index 47277d6..f11e03a 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1380,6 +1380,7 @@ class routerOBP(OPENBRIDGE): return(_sysIgnore) def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src): + _int_dst_id = int_id(_dst_id) #Assemble transmit HBP packet header _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) _tmp_data = b''.join([_tmp_data, dmrpkt]) From 04ea37ff9bf43509bc4819c011164f0559dcd69d Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 17:25:31 +0000 Subject: [PATCH 11/18] _stream_id --- bridge_master.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index f11e03a..cf66f75 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1379,7 +1379,7 @@ class routerOBP(OPENBRIDGE): #Ignore this system and TS pair if it's called again on this packet return(_sysIgnore) - def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src): + def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id): _int_dst_id = int_id(_dst_id) #Assemble transmit HBP packet header _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) @@ -1524,7 +1524,7 @@ class routerOBP(OPENBRIDGE): _tmp_bits = _bits ^ 1 << 7 else: _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot 1 - target busy: %s DST_ID: %s',self._system,_d_system,_int_dst_id) @@ -1539,7 +1539,7 @@ class routerOBP(OPENBRIDGE): if (_dst_slot['RX_TYPE'] == HBPF_SLT_VTERM) and (_dst_slot['TX_TYPE'] == HBPF_SLT_VTERM) and (time() - _dst_slot['TX_TIME'] > CONFIG['SYSTEMS'][_d_system]['GROUP_HANGTIME']): #We will allow the system to use both slots _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot %s - target busy: %s DST_ID: %s',self._system,_d_slot,_d_system,_int_dst_id) @@ -1564,7 +1564,7 @@ class routerOBP(OPENBRIDGE): _tmp_bits = _bits ^ 1 << 7 else: _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot %s - target busy: %s DST_ID: %s',self._system,_d_slot,_d_system,_int_dst_id) @@ -1939,7 +1939,7 @@ class routerHBP(HBSYSTEM): return _sysIgnore - def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src): + def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id): #Assemble transmit HBP packet header _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) _tmp_data = b''.join([_tmp_data, dmrpkt]) @@ -2072,7 +2072,7 @@ class routerHBP(HBSYSTEM): _tmp_bits = _bits ^ 1 << 7 else: _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot 1 - target busy: %s DST_ID: %s',self._system,_d_system,_int_dst_id) @@ -2087,7 +2087,7 @@ class routerHBP(HBSYSTEM): if (_dst_slot['RX_TYPE'] == HBPF_SLT_VTERM) and (_dst_slot['TX_TYPE'] == HBPF_SLT_VTERM) and (time() - _dst_slot['TX_TIME'] > CONFIG['SYSTEMS'][_d_system]['GROUP_HANGTIME']): #We will allow the system to use both slots _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot %s - target busy: %s DST_ID: %s',self._system,_d_slot,_d_system,_int_dst_id) @@ -2112,7 +2112,7 @@ class routerHBP(HBSYSTEM): _tmp_bits = _bits ^ 1 << 7 else: _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot %s - target busy: %s DST_ID: %s',self._system,_d_slot,_d_system,_int_dst_id) From 6ab68f64bb1433316105d0ddea2783b61cb48bb7 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 17:30:12 +0000 Subject: [PATCH 12/18] _peer_id --- bridge_master.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index cf66f75..00f5a78 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1379,7 +1379,7 @@ class routerOBP(OPENBRIDGE): #Ignore this system and TS pair if it's called again on this packet return(_sysIgnore) - def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id): + def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id): _int_dst_id = int_id(_dst_id) #Assemble transmit HBP packet header _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) @@ -1524,7 +1524,7 @@ class routerOBP(OPENBRIDGE): _tmp_bits = _bits ^ 1 << 7 else: _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot 1 - target busy: %s DST_ID: %s',self._system,_d_system,_int_dst_id) @@ -1539,7 +1539,7 @@ class routerOBP(OPENBRIDGE): if (_dst_slot['RX_TYPE'] == HBPF_SLT_VTERM) and (_dst_slot['TX_TYPE'] == HBPF_SLT_VTERM) and (time() - _dst_slot['TX_TIME'] > CONFIG['SYSTEMS'][_d_system]['GROUP_HANGTIME']): #We will allow the system to use both slots _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot %s - target busy: %s DST_ID: %s',self._system,_d_slot,_d_system,_int_dst_id) @@ -1564,7 +1564,7 @@ class routerOBP(OPENBRIDGE): _tmp_bits = _bits ^ 1 << 7 else: _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot %s - target busy: %s DST_ID: %s',self._system,_d_slot,_d_system,_int_dst_id) @@ -1939,7 +1939,7 @@ class routerHBP(HBSYSTEM): return _sysIgnore - def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id): + def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id): #Assemble transmit HBP packet header _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) _tmp_data = b''.join([_tmp_data, dmrpkt]) @@ -2072,7 +2072,7 @@ class routerHBP(HBSYSTEM): _tmp_bits = _bits ^ 1 << 7 else: _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot 1 - target busy: %s DST_ID: %s',self._system,_d_system,_int_dst_id) @@ -2087,7 +2087,7 @@ class routerHBP(HBSYSTEM): if (_dst_slot['RX_TYPE'] == HBPF_SLT_VTERM) and (_dst_slot['TX_TYPE'] == HBPF_SLT_VTERM) and (time() - _dst_slot['TX_TIME'] > CONFIG['SYSTEMS'][_d_system]['GROUP_HANGTIME']): #We will allow the system to use both slots _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot %s - target busy: %s DST_ID: %s',self._system,_d_slot,_d_system,_int_dst_id) @@ -2112,7 +2112,7 @@ class routerHBP(HBSYSTEM): _tmp_bits = _bits ^ 1 << 7 else: _tmp_bits = _bits - self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id) + self.sendDataToHBP(_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id) else: logger.info('(%s) UNIT Data not bridged to HBP on slot %s - target busy: %s DST_ID: %s',self._system,_d_slot,_d_system,_int_dst_id) From 1a0477fdbf9cf6d34464d8f20cfc9fb09237e141 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 18:49:33 +0000 Subject: [PATCH 13/18] Send data to other obps --- bridge_master.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bridge_master.py b/bridge_master.py index 00f5a78..94ffc87 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1512,6 +1512,14 @@ class routerOBP(OPENBRIDGE): logger.info('(%s) *UNKNOWN DATA TYPE* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s', \ self._system, int_id(_stream_id), get_alias(_rf_src, subscriber_ids), int_id(_rf_src), get_alias(_peer_id, peer_ids), int_id(_peer_id), get_alias(_dst_id, talkgroup_ids), int_id(_dst_id), _slot) + #Send other openbridges + for system in systems: + if system == self._system: + continue + #We only want to send data calls to individual IDs via OpenBridge + if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and _int_dst_id >= 1000000: + self.sendDatatoOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits) + #If destination ID is in the Subscriber Map if _dst_id in SUB_MAP: (_d_system,_d_slot,_d_time) = SUB_MAP[_dst_id] @@ -2035,7 +2043,7 @@ class routerHBP(HBSYSTEM): for system in systems: if system == self._system: continue - #We only want to send data calls to individual IDs vis OpenBridge + #We only want to send data calls to individual IDs via OpenBridge if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and _int_dst_id >= 1000000: #Disabled in master for now self.sendDatatoOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits) From f64b14c2eed8e72383574f3c9911969bc4e04d25 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 19:16:28 +0000 Subject: [PATCH 14/18] Send data to other obps - fix --- bridge_master.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 94ffc87..c370867 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1389,7 +1389,7 @@ class routerOBP(OPENBRIDGE): if CONFIG['REPORTS']['REPORT']: systems[_d_system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(_d_system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) - def sendDatatoOBP(self,_target,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits): + def sendDataToOBP(self,_target,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits): _int_dst_id = int_id(_dst_id) _target_status = systems[_target].STATUS @@ -1518,7 +1518,7 @@ class routerOBP(OPENBRIDGE): continue #We only want to send data calls to individual IDs via OpenBridge if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and _int_dst_id >= 1000000: - self.sendDatatoOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits) + self.sendDataToOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits) #If destination ID is in the Subscriber Map if _dst_id in SUB_MAP: @@ -1956,7 +1956,7 @@ class routerHBP(HBSYSTEM): if CONFIG['REPORTS']['REPORT']: systems[_d_system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(_d_system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) - def sendDatatoOBP(self,_target,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits): + def sendDataToOBP(self,_target,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits): # _sysIgnore = sysIgnore _int_dst_id = int_id(_dst_id) _target_status = systems[_target].STATUS @@ -2046,7 +2046,7 @@ class routerHBP(HBSYSTEM): #We only want to send data calls to individual IDs via OpenBridge if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and _int_dst_id >= 1000000: #Disabled in master for now - self.sendDatatoOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits) + self.sendDataToOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits) #Send UNIT data to data gateway #if CONFIG['GLOBAL']['DATA_GATEWAY'] and (CONFIG['GLOBAL']['DATA_GATEWAY'] in systems) \ From 523190e5e97f952208dae9f4d677481eeded8cad Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 19:19:17 +0000 Subject: [PATCH 15/18] bloody indents --- bridge_master.py | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index c370867..a0442e3 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1389,39 +1389,39 @@ class routerOBP(OPENBRIDGE): if CONFIG['REPORTS']['REPORT']: systems[_d_system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(_d_system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) - def sendDataToOBP(self,_target,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits): + def sendDataToOBP(self,_target,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits): - _int_dst_id = int_id(_dst_id) - _target_status = systems[_target].STATUS - _target_system = self._CONFIG['SYSTEMS'][_target] + _int_dst_id = int_id(_dst_id) + _target_status = systems[_target].STATUS + _target_system = self._CONFIG['SYSTEMS'][_target] + + #If target has missed 6 (on 1 min) of keepalives, don't send + if _target_system['ENHANCED_OBP'] and '_bcka' in _target_system and _target_system['_bcka'] < pkt_time - 60: + return + + if (_stream_id not in _target_status): + # This is a new call stream on the target + _target_status[_stream_id] = { + 'START': pkt_time, + 'CONTENTION':False, + 'RFS': _rf_src, + 'TGID': _dst_id, + 'RX_PEER': _peer_id + } - #If target has missed 6 (on 1 min) of keepalives, don't send - if _target_system['ENHANCED_OBP'] and '_bcka' in _target_system and _target_system['_bcka'] < pkt_time - 60: - return - - if (_stream_id not in _target_status): - # This is a new call stream on the target - _target_status[_stream_id] = { - 'START': pkt_time, - 'CONTENTION':False, - 'RFS': _rf_src, - 'TGID': _dst_id, - 'RX_PEER': _peer_id - } - - # Record the time of this packet so we can later identify a stale stream - _target_status[_stream_id]['LAST'] = pkt_time - # Clear the TS bit -- all OpenBridge streams are effectively on TS1 - _tmp_bits = _bits & ~(1 << 7) - #Assemble transmit HBP packet header - _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) - _tmp_data = b''.join([_tmp_data, dmrpkt]) - systems[_target].send_system(_tmp_data) - logger.info('(%s) UNIT Data Bridged to OBP System: %s DST_ID: %s', self._system, _target,_int_dst_id) - if CONFIG['REPORTS']['REPORT']: - systems[system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(_target, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) - + # Record the time of this packet so we can later identify a stale stream + _target_status[_stream_id]['LAST'] = pkt_time + # Clear the TS bit -- all OpenBridge streams are effectively on TS1 + _tmp_bits = _bits & ~(1 << 7) + #Assemble transmit HBP packet header + _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) + _tmp_data = b''.join([_tmp_data, dmrpkt]) + systems[_target].send_system(_tmp_data) + logger.info('(%s) UNIT Data Bridged to OBP System: %s DST_ID: %s', self._system, _target,_int_dst_id) + if CONFIG['REPORTS']['REPORT']: + systems[system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(_target, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) + def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data): pkt_time = time() From 52794c623b352b6dbe58365cbb9df8f58e5e1a76 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 19:24:15 +0000 Subject: [PATCH 16/18] int id again --- bridge_master.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bridge_master.py b/bridge_master.py index a0442e3..fe5957a 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1949,6 +1949,7 @@ class routerHBP(HBSYSTEM): def sendDataToHBP(self,_d_system,_d_slot,_dst_id,_tmp_bits,_data,dmrpkt,_rf_src,_stream_id,_peer_id): #Assemble transmit HBP packet header + _int_dst_id = int_id(_dst_id) _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) _tmp_data = b''.join([_tmp_data, dmrpkt]) systems[_d_system].send_system(_tmp_data) From 37240c1d5211d73f6d498406104162e1dce13d3a Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 19:38:24 +0000 Subject: [PATCH 17/18] remove data gateay --- config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config.py b/config.py index cecd047..51b6c4e 100755 --- a/config.py +++ b/config.py @@ -145,8 +145,7 @@ def build_config(_config_file): 'GEN_STAT_BRIDGES': config.getboolean(section, 'GEN_STAT_BRIDGES'), 'ALLOW_NULL_PASSPHRASE': config.getboolean(section, 'ALLOW_NULL_PASSPHRASE'), 'ANNOUNCEMENT_LANGUAGES': config.get(section, 'ANNOUNCEMENT_LANGUAGES'), - 'SERVER_ID': config.getint(section, 'SERVER_ID').to_bytes(4, 'big'), - 'DATA_GATEWAY': config.get(section, 'DATA_GATEWAY') + 'SERVER_ID': config.getint(section, 'SERVER_ID').to_bytes(4, 'big') }) if not CONFIG['GLOBAL']['ANNOUNCEMENT_LANGUAGES']: From 909bc92928336e3007cb92e1f1ee64b17717e16e Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 13 Nov 2021 23:02:36 +0000 Subject: [PATCH 18/18] Hello --- bridge_master.py | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index fe5957a..a5ac6ea 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -2048,26 +2048,7 @@ class routerHBP(HBSYSTEM): if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and _int_dst_id >= 1000000: #Disabled in master for now self.sendDataToOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits) - - #Send UNIT data to data gateway - #if CONFIG['GLOBAL']['DATA_GATEWAY'] and (CONFIG['GLOBAL']['DATA_GATEWAY'] in systems) \ - #and CONFIG['SYSTEMS'][CONFIG['GLOBAL']['DATA_GATEWAY']]['MODE'] == 'OPENBRIDGE': - #Clear the TS bit -- all OpenBridge streams are effectively on TS1 - #_tmp_bits = _bits & ~(1 << 7) - #Assemble transmit HBP packet header - #_tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) - #_tmp_data = b''.join([_tmp_data, dmrpkt]) - #systems[CONFIG['GLOBAL']['DATA_GATEWAY']].send_system(_tmp_data) - #logger.info('(%s) UNIT Data Bridged to DATA_GATEWAY: %s DST_ID: %s', self._system,CONFIG['GLOBAL']['DATA_GATEWAY'],_int_dst_id) - #if CONFIG['REPORTS']['REPORT']: - #systems[system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) - #else: - #if not bool(CONFIG['GLOBAL']['DATA_GATEWAY']): - #logger.info('(%s) UNIT Data not Bridged - no DATA_GATEWAY: %s, DST_ID: %s',self._system,_int_dst_id) - #elif CONFIG['GLOBAL']['DATA_GATEWAY'] not in systems: - #logger.warning('(%s) UNIT Data not Bridged - DATA_GATEWAY: %s not valid. DST_ID: %s',self._system, CONFIG['GLOBAL']['DATA_GATEWAY'],_int_dst_id) - #elif CONFIG['SYSTEMS'][CONFIG['GLOBAL']['DATA_GATEWAY']]['MODE'] != 'OPENBRIDGE': - #logger.warning('(%s) UNIT Data not Bridged - DATA_GATEWAY: %s not OPENBRIDGE. DST_ID: %s',self._system, CONFIG['GLOBAL']['DATA_GATEWAY'],_int_dst_id) + #If destination ID is in the Subscriber Map if _dst_id in SUB_MAP: