confirmed FreeDMR group and unit call RX
This commit is contained in:
parent
75625510c9
commit
88d4447bae
@ -352,9 +352,11 @@ def all_data(_data):
|
|||||||
for system in CONFIG['SYSTEMS']:
|
for system in CONFIG['SYSTEMS']:
|
||||||
if CONFIG['SYSTEMS'][system]['ENABLED']:
|
if CONFIG['SYSTEMS'][system]['ENABLED']:
|
||||||
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
|
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
|
||||||
|
print(CONFIG['SYSTEMS'][system]['OTHER_OPTIONS'])
|
||||||
if 'ALL_DATA' in CONFIG['SYSTEMS'][system]['OTHER_OPTIONS']:
|
if 'ALL_DATA' in CONFIG['SYSTEMS'][system]['OTHER_OPTIONS']:
|
||||||
print('mirrored to ' + system)
|
print('mirrored to ' + system)
|
||||||
systems[system].send_system(_data)
|
print(SVRD + b'DATA' + _data)
|
||||||
|
systems[system].send_system(SVRD + b'DATA' + _data)
|
||||||
|
|
||||||
|
|
||||||
# Import Bridging rules
|
# Import Bridging rules
|
||||||
@ -1370,15 +1372,17 @@ class routerHBP(HBSYSTEM):
|
|||||||
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
|
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
|
||||||
if _call_type == 'group':
|
if _call_type == 'group':
|
||||||
self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
|
self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
|
||||||
|
## all_data(_data)
|
||||||
elif _call_type == 'unit':
|
elif _call_type == 'unit':
|
||||||
if self._system not in UNIT:
|
if self._system not in UNIT:
|
||||||
logger.error('(%s) *UNIT CALL NOT FORWARDED* UNIT calling is disabled for this system (INGRESS)', self._system)
|
logger.error('(%s) *UNIT CALL NOT FORWARDED* UNIT calling is disabled for this system (INGRESS)', self._system)
|
||||||
else:
|
else:
|
||||||
self.unit_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
|
self.unit_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
|
||||||
|
## all_data(_data)
|
||||||
elif _call_type == 'vcsbk':
|
elif _call_type == 'vcsbk':
|
||||||
self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
|
self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
|
||||||
logger.debug('CSBK recieved, forwarded to destination TG.')
|
logger.debug('CSBK recieved, forwarded to destination TG.')
|
||||||
all_data(_data)
|
## all_data(_data)
|
||||||
else:
|
else:
|
||||||
logger.error('Unknown call type recieved -- not processed')
|
logger.error('Unknown call type recieved -- not processed')
|
||||||
|
|
||||||
|
@ -1196,9 +1196,32 @@ class OBP(OPENBRIDGE):
|
|||||||
data_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data)
|
data_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data)
|
||||||
|
|
||||||
def svrd_received(self, _mode, _data):
|
def svrd_received(self, _mode, _data):
|
||||||
|
print('SVRD RCV')
|
||||||
if _mode == b'UNIT':
|
if _mode == b'UNIT':
|
||||||
UNIT_MAP[_data] = (self._system, time())
|
UNIT_MAP[_data] = (self._system, time())
|
||||||
print(UNIT_MAP)
|
print(UNIT_MAP)
|
||||||
|
if _mode == b'DATA':
|
||||||
|
# DMR Data packet, sent via SVRD
|
||||||
|
_peer_id = _data[11:15]
|
||||||
|
_seq = _data[4]
|
||||||
|
_rf_src = _data[5:8]
|
||||||
|
_dst_id = _data[8:11]
|
||||||
|
_bits = _data[15]
|
||||||
|
_slot = 2 if (_bits & 0x80) else 1
|
||||||
|
#_call_type = 'unit' if (_bits & 0x40) else 'group'
|
||||||
|
if _bits & 0x40:
|
||||||
|
_call_type = 'unit'
|
||||||
|
elif (_bits & 0x23) == 0x23:
|
||||||
|
_call_type = 'vcsbk'
|
||||||
|
else:
|
||||||
|
_call_type = 'group'
|
||||||
|
_frame_type = (_bits & 0x30) >> 4
|
||||||
|
_dtype_vseq = (_bits & 0xF) # data, 1=voice header, 2=voice terminator; voice, 0=burst A ... 5=burst F
|
||||||
|
_stream_id = _data[16:20]
|
||||||
|
|
||||||
|
self.dmrd_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data)
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class HBP(HBSYSTEM):
|
class HBP(HBSYSTEM):
|
||||||
|
53
hblink.py
53
hblink.py
@ -187,6 +187,7 @@ class OPENBRIDGE(DatagramProtocol):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def datagramReceived(self, _packet, _sockaddr):
|
def datagramReceived(self, _packet, _sockaddr):
|
||||||
|
## print(_packet[:4])
|
||||||
# Keep This Line Commented Unless HEAVILY Debugging!
|
# Keep This Line Commented Unless HEAVILY Debugging!
|
||||||
## logger.debug('(%s) RX packet from %s -- %s', self._system, _sockaddr, ahex(_packet))
|
## logger.debug('(%s) RX packet from %s -- %s', self._system, _sockaddr, ahex(_packet))
|
||||||
if _packet[:4] == DMRD or _packet[:4] == EOBP:
|
if _packet[:4] == DMRD or _packet[:4] == EOBP:
|
||||||
@ -199,10 +200,6 @@ class OPENBRIDGE(DatagramProtocol):
|
|||||||
_data = _packet[:53]
|
_data = _packet[:53]
|
||||||
_hash = _packet[53:]
|
_hash = _packet[53:]
|
||||||
_ckhs = hmac_new(self._config['PASSPHRASE'],_data,sha1).digest()
|
_ckhs = hmac_new(self._config['PASSPHRASE'],_data,sha1).digest()
|
||||||
## print(ahex(_ckhs))
|
|
||||||
## print(ahex(_hash))
|
|
||||||
|
|
||||||
## print(compare_digest(_hash, _ckhs))
|
|
||||||
|
|
||||||
if compare_digest(_hash, _ckhs) and _sockaddr == self._config['TARGET_SOCK']:
|
if compare_digest(_hash, _ckhs) and _sockaddr == self._config['TARGET_SOCK']:
|
||||||
_peer_id = _data[11:15]
|
_peer_id = _data[11:15]
|
||||||
@ -265,30 +262,33 @@ class OPENBRIDGE(DatagramProtocol):
|
|||||||
elif _packet[:4] == SVRD:
|
elif _packet[:4] == SVRD:
|
||||||
_d_pkt = decrypt_packet(self._config['ENCRYPTION_KEY'], _packet[4:])
|
_d_pkt = decrypt_packet(self._config['ENCRYPTION_KEY'], _packet[4:])
|
||||||
## logger.info('SVRD Received: ' + str(_d_pkt))
|
## logger.info('SVRD Received: ' + str(_d_pkt))
|
||||||
|
|
||||||
# DMR Data packet, sent via SVRD
|
# DMR Data packet, sent via SVRD
|
||||||
if _d_pkt[:4] == b'DATA':
|
## if _d_pkt[4:8] == b'DATA':
|
||||||
_data = _d_pkt[4:]
|
## print('----------------------')
|
||||||
_peer_id = _data[11:15]
|
## _data = _d_pkt[4:]
|
||||||
_seq = _data[4]
|
## _peer_id = _data[11:15]
|
||||||
_rf_src = _data[5:8]
|
## _seq = _data[4]
|
||||||
_dst_id = _data[8:11]
|
## _rf_src = _data[5:8]
|
||||||
_bits = _data[15]
|
## _dst_id = _data[8:11]
|
||||||
_slot = 2 if (_bits & 0x80) else 1
|
## _bits = _data[15]
|
||||||
#_call_type = 'unit' if (_bits & 0x40) else 'group'
|
## _slot = 2 if (_bits & 0x80) else 1
|
||||||
if _bits & 0x40:
|
## #_call_type = 'unit' if (_bits & 0x40) else 'group'
|
||||||
_call_type = 'unit'
|
## if _bits & 0x40:
|
||||||
elif (_bits & 0x23) == 0x23:
|
## _call_type = 'unit'
|
||||||
_call_type = 'vcsbk'
|
## elif (_bits & 0x23) == 0x23:
|
||||||
else:
|
## _call_type = 'vcsbk'
|
||||||
_call_type = 'group'
|
## else:
|
||||||
_frame_type = (_bits & 0x30) >> 4
|
## _call_type = 'group'
|
||||||
_dtype_vseq = (_bits & 0xF) # data, 1=voice header, 2=voice terminator; voice, 0=burst A ... 5=burst F
|
## _frame_type = (_bits & 0x30) >> 4
|
||||||
_stream_id = _data[16:20]
|
## _dtype_vseq = (_bits & 0xF) # data, 1=voice header, 2=voice terminator; voice, 0=burst A ... 5=burst F
|
||||||
self.dmrd_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data)
|
## _stream_id = _data[16:20]
|
||||||
else:
|
## print(_stream_id)
|
||||||
|
##
|
||||||
|
## print(_call_type)
|
||||||
|
## self.dmrd_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data)
|
||||||
|
## else:
|
||||||
|
|
||||||
self.svrd_received(_d_pkt[4:8], _d_pkt[8:])
|
self.svrd_received(_d_pkt[4:8], _d_pkt[8:])
|
||||||
|
|
||||||
#************************************************
|
#************************************************
|
||||||
# HB MASTER CLASS
|
# HB MASTER CLASS
|
||||||
@ -539,7 +539,6 @@ class HBSYSTEM(DatagramProtocol):
|
|||||||
|
|
||||||
# Aliased in __init__ to datagramReceived if system is a master
|
# Aliased in __init__ to datagramReceived if system is a master
|
||||||
def master_datagramReceived(self, _data, _sockaddr):
|
def master_datagramReceived(self, _data, _sockaddr):
|
||||||
## global user_db
|
|
||||||
# Keep This Line Commented Unless HEAVILY Debugging!
|
# Keep This Line Commented Unless HEAVILY Debugging!
|
||||||
# logger.debug('(%s) RX packet from %s -- %s', self._system, _sockaddr, ahex(_data))
|
# logger.debug('(%s) RX packet from %s -- %s', self._system, _sockaddr, ahex(_data))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user