From 26eeb9fbbac218b3c25c746cd9411f309d701e11 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 13 Dec 2020 18:35:23 +0000 Subject: [PATCH] Another try at reflectors --- bridge_master.py | 32 +++++++++++--------------------- hblink.py | 2 +- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 4f40136..a4d7036 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -787,10 +787,10 @@ class routerOBP(OPENBRIDGE): _target_system = self._CONFIG['SYSTEMS'][_target['SYSTEM']] if _target_system['MODE'] == 'OPENBRIDGE': print(int_id(_target['TGID'])) - if _noOBP == True: + if _noOBP == True or _target['SYSTEM'] in _tgidIgnore: print('bang') continue - _tgidIgnore.append(int_id(_target['TGID'])) + _tgidIgnore.append(_target['SYSTEM']) # Is this a new call stream on the target? if (_stream_id not in _target_status): # This is a new call stream on the target @@ -965,8 +965,9 @@ class routerOBP(OPENBRIDGE): #if _bridge[0:1] != '#': if True: for _system in BRIDGES[_bridge]: - if (_system['SYSTEM'] == self._system and _system['TGID'] == _dst_id and _system['TS'] == _slot and _system['ACTIVE'] == True): - print(_OBtgidIgnore) + if _system['SYSTEM'] == self._system and _system['TGID'] == _dst_id and _system['TS'] == _slot and _system['ACTIVE'] == True: + _OBtgidIgnore = self.to_target(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data, pkt_time, dmrpkt, _bits,_bridge,_system,False,_OBtgidIgnore) + elif _system['SYSTEM'] == self._system and int_id(_system['TGID']) == 9 and _system['TS'] == 2 and _system['ACTIVE'] == True and _bridge == "#"+str(int_id(_system['TGID'])): _OBtgidIgnore = self.to_target(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data, pkt_time, dmrpkt, _bits,_bridge,_system,False,_OBtgidIgnore) @@ -1055,10 +1056,10 @@ class routerHBP(HBSYSTEM): if _target_system['MODE'] == 'OPENBRIDGE': print(int_id(_target['TGID'])) - if _noOBP == True: + if _noOBP == True or _target['SYSTEM'] in _tgidIgnore: print('bang') continue - _tgidIgnore.append(int_id(_target['TGID'])) + _tgidIgnore.append(_target['SYSTEM']) # Is this a new call stream on the target? if (_stream_id not in _target_status): # This is a new call stream on the target @@ -1187,7 +1188,7 @@ class routerHBP(HBSYSTEM): # Transmit the packet to the destination system systems[_target['SYSTEM']].send_system(_tmp_data) #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'])) - return(_tgidIgnore) + return _tgidIgnore def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data): pkt_time = time() @@ -1366,27 +1367,16 @@ class routerHBP(HBSYSTEM): logger.info('(%s) Bridge for TG %s does not exist. Creating as User Activated. Timeout %s',self._system, int_id(_dst_id),CONFIG['SYSTEMS'][self._system]['DEFAULT_UA_TIMER']) make_single_bridge(_dst_id,self._system,_slot,CONFIG['SYSTEMS'][self._system]['DEFAULT_UA_TIMER']) - #for _bridge in BRIDGES: - #for _system in BRIDGES[_bridge]: - #if _bridge[0:1] == '#': - #continue - #if (_system['SYSTEM'] == self._system and _system['TGID'] == _dst_id and _system['TS'] == _slot and _system['ACTIVE'] == True): - - #self.to_target(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data, pkt_time, dmrpkt, _bits,_bridge,_system,False) - - #_bridge = '#'+_bridge - #if _bridge in BRIDGES: - #self.to_target(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data, pkt_time, dmrpkt, _bits,_bridge,_system,True) _OBtgidIgnore = [] for _bridge in BRIDGES: #if _bridge[0:1] != '#': if True: for _system in BRIDGES[_bridge]: - if (_system['SYSTEM'] == self._system and _system['TGID'] == _dst_id and _system['TS'] == _slot and _system['ACTIVE'] == True): - print(_OBtgidIgnore) + if _system['SYSTEM'] == self._system and _system['TGID'] == _dst_id and _system['TS'] == _slot and _system['ACTIVE'] == True: + _OBtgidIgnore = self.to_target(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data, pkt_time, dmrpkt, _bits,_bridge,_system,False,_OBtgidIgnore) + elif _system['SYSTEM'] == self._system and int_id(_system['TGID']) == 9 and _system['TS'] == 2 and _system['ACTIVE'] == True and _bridge == "#"+str(int_id(_system['TGID'])): _OBtgidIgnore = self.to_target(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data, pkt_time, dmrpkt, _bits,_bridge,_system,False,_OBtgidIgnore) - # Final actions - Is this a voice terminator? if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM) and (self.STATUS[_slot]['RX_TYPE'] != HBPF_SLT_VTERM): diff --git a/hblink.py b/hblink.py index 562d1f0..8333179 100755 --- a/hblink.py +++ b/hblink.py @@ -280,7 +280,7 @@ class HBSYSTEM(DatagramProtocol): _packet = b''.join([_packet[:11], _peer, _packet[15:]]) self.transport.write(_packet, self._peers[_peer]['SOCKADDR']) # KEEP THE FOLLOWING COMMENTED OUT UNLESS YOU'RE DEBUGGING DEEPLY!!!! - logger.debug('(%s) TX Packet to %s on port %s: %s', self._peers[_peer]['RADIO_ID'], self._peers[_peer]['IP'], self._peers[_peer]['PORT'], ahex(_packet)) + #logger.debug('(%s) TX Packet to %s on port %s: %s', self._peers[_peer]['RADIO_ID'], self._peers[_peer]['IP'], self._peers[_peer]['PORT'], ahex(_packet)) def send_master(self, _packet): if _packet[:4] == DMRD: