mirror of
https://github.com/ShaYmez/hblink3.git
synced 2024-11-25 09:18:50 -05:00
Works, but no contention handler
Private call forwarding works, with destionation routing cache, but no contention handler yet.
This commit is contained in:
parent
e5eafeec3e
commit
f98c12096c
72
bridge.py
72
bridge.py
@ -436,6 +436,9 @@ class routerHBP(HBSYSTEM):
|
|||||||
HBSYSTEM.__init__(self, _name, _config, _report)
|
HBSYSTEM.__init__(self, _name, _config, _report)
|
||||||
self.name = _name
|
self.name = _name
|
||||||
|
|
||||||
|
# list of targets for unit (subscriber, private) calls
|
||||||
|
self.targets = []
|
||||||
|
|
||||||
# Status information for the system, TS1 & TS2
|
# Status information for the system, TS1 & TS2
|
||||||
# 1 & 2 are "timeslot"
|
# 1 & 2 are "timeslot"
|
||||||
# In TX_EMB_LC, 2-5 are burst B-E
|
# In TX_EMB_LC, 2-5 are burst B-E
|
||||||
@ -756,16 +759,29 @@ class routerHBP(HBSYSTEM):
|
|||||||
|
|
||||||
# Is this a new call stream?
|
# Is this a new call stream?
|
||||||
if (_stream_id != self.STATUS[_slot]['RX_STREAM_ID']):
|
if (_stream_id != self.STATUS[_slot]['RX_STREAM_ID']):
|
||||||
|
# Create a destination list for the call:
|
||||||
|
if _dst_id in UNIT_MAP:
|
||||||
|
if UNIT_MAP[_dst_id][0] != self._system:
|
||||||
|
self._targets = [UNIT_MAP[_dst_id][0]]
|
||||||
|
_target_route = UNIT_MAP[_dst_id][0]
|
||||||
|
else:
|
||||||
|
self._targets = []
|
||||||
|
logger.debug('UNIT call to a subscriber on the same system, send nothing')
|
||||||
|
else:
|
||||||
|
self._targets = list(systems)
|
||||||
|
self._targets.remove(self._system)
|
||||||
|
_target_route = 'FLOOD'
|
||||||
|
|
||||||
if (self.STATUS[_slot]['RX_TYPE'] != HBPF_SLT_VTERM) and (pkt_time < (self.STATUS[_slot]['RX_TIME'] + STREAM_TO)) and (_rf_src != self.STATUS[_slot]['RX_RFS']):
|
if (self.STATUS[_slot]['RX_TYPE'] != HBPF_SLT_VTERM) and (pkt_time < (self.STATUS[_slot]['RX_TIME'] + STREAM_TO)) and (_rf_src != self.STATUS[_slot]['RX_RFS']):
|
||||||
logger.warning('(%s) Packet received with STREAM ID: %s <FROM> SUB: %s PEER: %s <TO> UNIT %s, SLOT %s collided with existing call', self._system, int_id(_stream_id), int_id(_rf_src), int_id(_peer_id), int_id(_dst_id), _slot)
|
logger.warning('(%s) Packet received with STREAM ID: %s <FROM> SUB: %s PEER: %s <TO> UNIT %s, SLOT %s collided with existing call', self._system, int_id(_stream_id), int_id(_rf_src), int_id(_peer_id), int_id(_dst_id), _slot)
|
||||||
return
|
return
|
||||||
|
|
||||||
# This is a new call stream
|
# This is a new call stream
|
||||||
self.STATUS[_slot]['RX_START'] = pkt_time
|
self.STATUS[_slot]['RX_START'] = pkt_time
|
||||||
logger.info('(%s) *UNIT CALL START* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) UNIT %s (%s), TS %s', \
|
logger.info('(%s) *UNIT CALL START* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) UNIT: %s (%s), TS: %s, FORWARD: %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._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, _target_route)
|
||||||
if CONFIG['REPORTS']['REPORT']:
|
if CONFIG['REPORTS']['REPORT']:
|
||||||
self._report.send_bridgeEvent('UNIT VOICE,START,RX,{},{},{},{},{},{}'.format(self._system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), _slot, int_id(_dst_id)).encode(encoding='utf-8', errors='ignore'))
|
self._report.send_bridgeEvent('UNIT VOICE,START,RX,{},{},{},{},{},{},{}'.format(self._system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), _slot, int_id(_dst_id), _target_route).encode(encoding='utf-8', errors='ignore'))
|
||||||
|
|
||||||
# If we can, use the LC from the voice header as to keep all options intact
|
# If we can, use the LC from the voice header as to keep all options intact
|
||||||
if _frame_type == HBPF_DATA_SYNC and _dtype_vseq == HBPF_SLT_VHEAD:
|
if _frame_type == HBPF_DATA_SYNC and _dtype_vseq == HBPF_SLT_VHEAD:
|
||||||
@ -777,44 +793,34 @@ class routerHBP(HBSYSTEM):
|
|||||||
else:
|
else:
|
||||||
self.STATUS[_slot]['RX_LC'] = LC_OPT + _dst_id + _rf_src
|
self.STATUS[_slot]['RX_LC'] = LC_OPT + _dst_id + _rf_src
|
||||||
|
|
||||||
|
for _target in self._targets:
|
||||||
|
if self._CONFIG['SYSTEMS'][_target]['MODE'] == 'OPENBRIDGE':
|
||||||
|
# THIS IS ONLY UNTIL OPENBRIDGE IS SUPPORTED
|
||||||
|
continue
|
||||||
|
|
||||||
#if _dst_id in UNIT_MAP:
|
_target_status = systems[_target].STATUS
|
||||||
if True:
|
#_target_system = self._CONFIG['SYSTEMS'][_target]
|
||||||
_target = UNIT_MAP[_dst_id][0]
|
|
||||||
|
|
||||||
#if _target != self._system:
|
# Is this a new call stream?
|
||||||
if True:
|
if (_stream_id != self.STATUS[_slot]['RX_STREAM_ID']):
|
||||||
_target_status = systems[_target].STATUS
|
# Record the DST TGID and Stream ID
|
||||||
_target_system = self._CONFIG['SYSTEMS'][_target]
|
_target_status[_slot]['TX_START'] = pkt_time
|
||||||
|
_target_status[_slot]['TX_TGID'] = _dst_id
|
||||||
|
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
|
||||||
|
_target_status[_slot]['TX_RFS'] = _rf_src
|
||||||
|
_target_status[_slot]['TX_PEER'] = _peer_id
|
||||||
|
|
||||||
|
# Set other values for the contention handler to test next time there is a frame to forward
|
||||||
|
_target_status[_slot]['TX_TIME'] = pkt_time
|
||||||
|
_target_status[_slot]['TX_TYPE'] = _dtype_vseq
|
||||||
|
|
||||||
# Is this a new call stream?
|
#send the call:
|
||||||
if (_stream_id != self.STATUS[_slot]['RX_STREAM_ID']):
|
systems[_target].send_system(_data)
|
||||||
# Record the DST TGID and Stream ID
|
|
||||||
_target_status[_slot]['TX_START'] = pkt_time
|
|
||||||
_target_status[_slot]['TX_TGID'] = _dst_id
|
|
||||||
_target_status[_slot]['TX_STREAM_ID'] = _stream_id
|
|
||||||
_target_status[_slot]['TX_RFS'] = _rf_src
|
|
||||||
_target_status[_slot]['TX_PEER'] = _peer_id
|
|
||||||
|
|
||||||
# Set other values for the contention handler to test next time there is a frame to forward
|
|
||||||
_target_status[_slot]['TX_TIME'] = pkt_time
|
|
||||||
_target_status[_slot]['TX_TYPE'] = _dtype_vseq
|
|
||||||
|
|
||||||
#send the call:
|
|
||||||
|
|
||||||
systems[_target].send_system(_data)
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
#for target in systems:
|
|
||||||
# systems[target].send_system(_data)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Final actions - Is this a voice terminator?
|
# 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):
|
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM) and (self.STATUS[_slot]['RX_TYPE'] != HBPF_SLT_VTERM):
|
||||||
|
self._targets = []
|
||||||
call_duration = pkt_time - self.STATUS[_slot]['RX_START']
|
call_duration = pkt_time - self.STATUS[_slot]['RX_START']
|
||||||
logger.info('(%s) *UNIT CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) UNIT %s (%s), TS %s, Duration: %.2f', \
|
logger.info('(%s) *UNIT CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) UNIT %s (%s), TS %s, Duration: %.2f', \
|
||||||
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, call_duration)
|
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, call_duration)
|
||||||
|
Loading…
Reference in New Issue
Block a user