Added logging, and fixed instance STATUS dictionary for HBP systems - Start time was incorrectly recorded.
This commit is contained in:
parent
fe8b2e3595
commit
8acaded9dc
@ -57,12 +57,11 @@ import cPickle as pickle
|
|||||||
|
|
||||||
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
|
# Does anybody read this stuff? There's a PEP somewhere that says I should do this.
|
||||||
__author__ = 'Cortney T. Buffington, N0MJS'
|
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||||
__copyright__ = 'Copyright (c) 2016-2018PEER Cortney T. Buffington, N0MJS and the K0USY Group'
|
__copyright__ = 'Copyright (c) 2016-2018 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||||
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT'
|
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT'
|
||||||
__license__ = 'GNU GPLv3'
|
__license__ = 'GNU GPLv3'
|
||||||
__maintainer__ = 'Cort Buffington, N0MJS'
|
__maintainer__ = 'Cort Buffington, N0MJS'
|
||||||
__email__ = 'n0mjs@me.com'
|
__email__ = 'n0mjs@me.com'
|
||||||
__status__ = 'pre-alpha'
|
|
||||||
|
|
||||||
# Module gobal varaibles
|
# Module gobal varaibles
|
||||||
|
|
||||||
@ -174,7 +173,7 @@ def build_acl(_sub_acl):
|
|||||||
|
|
||||||
# Run this every minute for rule timer updates
|
# Run this every minute for rule timer updates
|
||||||
def rule_timer_loop():
|
def rule_timer_loop():
|
||||||
logger.info('(ALL HBSYSTEMS) Rule timer loop started')
|
logger.debug('(ALL HBSYSTEMS) Rule timer loop started')
|
||||||
_now = time()
|
_now = time()
|
||||||
|
|
||||||
for _bridge in BRIDGES:
|
for _bridge in BRIDGES:
|
||||||
@ -216,13 +215,23 @@ def stream_trimmer_loop():
|
|||||||
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
|
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
|
||||||
for stream_id in systems[system].STATUS:
|
for stream_id in systems[system].STATUS:
|
||||||
if systems[system].STATUS[stream_id]['LAST'] < _now - 5:
|
if systems[system].STATUS[stream_id]['LAST'] < _now - 5:
|
||||||
|
|
||||||
remove_list.append(stream_id)
|
remove_list.append(stream_id)
|
||||||
|
|
||||||
for stream_id in remove_list:
|
for stream_id in remove_list:
|
||||||
|
_system = systems[system].STATUS[stream_id]
|
||||||
|
_config = CONFIG['SYSTEMS'][system]
|
||||||
|
logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s PEER: %s TGID: %s TS 1 Duration: %s', \
|
||||||
|
system, int_id(stream_id), get_alias(int_id(_system['RFS']), subscriber_ids), get_alias(int_id(_config['NETWORK_ID']), peer_ids), get_alias(int_id(_system['TGID']), talkgroup_ids), _system['LAST'] - _system['START'])
|
||||||
|
# self._report.send_bridgeEvent('GROUP VOICE,END,{},{},{},{},{},{},{:.2f}'.format(self._system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), _slot, int_id(_dst_id), call_duration))
|
||||||
removed = systems[system].STATUS.pop(stream_id)
|
removed = systems[system].STATUS.pop(stream_id)
|
||||||
logger.debug('Inactive OpenBridge Stream ID removed from System: %s, Stream ID %s', system, int_id(stream_id))
|
logger.debug('Inactive OpenBridge Stream ID removed from System: %s, Stream ID %s', system, int_id(stream_id))
|
||||||
|
for system in systems:
|
||||||
|
if CONFIG['SYSTEMS'][system]['MODE'] != 'OPENBRIDGE':
|
||||||
|
for slot in range(1,3):
|
||||||
|
_slot = systems[system].STATUS[slot]
|
||||||
|
if _slot['RX_TYPE'] != hb_const.HBPF_SLT_VTERM and _slot['RX_TIME'] < _now - 5:
|
||||||
|
_slot['RX_TYPE'] = hb_const.HBPF_SLT_VTERM
|
||||||
|
logger.info('(%s) *TIME OUT* STREAM ID: %s SUB: %s (%s) TGID %s (%s), TS %s, Duration: %s', \
|
||||||
|
system, int_id(_slot['RX_STREAM_ID']), get_alias(_slot['RX_RFS'], subscriber_ids), int_id(_slot['RX_RFS']), get_alias(_slot['RX_TGID'], talkgroup_ids), int_id(_slot['RX_TGID']), slot, _slot['RX_TIME'] - _slot['RX_START'])
|
||||||
|
|
||||||
class routerOBP(OPENBRIDGE):
|
class routerOBP(OPENBRIDGE):
|
||||||
|
|
||||||
@ -435,7 +444,10 @@ class routerHBP(HBSYSTEM):
|
|||||||
# In TX_EMB_LC, 2-5 are burst B-E
|
# In TX_EMB_LC, 2-5 are burst B-E
|
||||||
self.STATUS = {
|
self.STATUS = {
|
||||||
1: {
|
1: {
|
||||||
|
'RX_ACTIVE': False,
|
||||||
|
'TX_ACTIVE': False,
|
||||||
'RX_START': time(),
|
'RX_START': time(),
|
||||||
|
'TX_START': time(),
|
||||||
'RX_SEQ': '\x00',
|
'RX_SEQ': '\x00',
|
||||||
'RX_RFS': '\x00',
|
'RX_RFS': '\x00',
|
||||||
'TX_RFS': '\x00',
|
'TX_RFS': '\x00',
|
||||||
@ -457,7 +469,10 @@ class routerHBP(HBSYSTEM):
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
2: {
|
2: {
|
||||||
|
'RX_ACTIVE': False,
|
||||||
|
'TX_ACTIVE': False,
|
||||||
'RX_START': time(),
|
'RX_START': time(),
|
||||||
|
'TX_START': time(),
|
||||||
'RX_SEQ': '\x00',
|
'RX_SEQ': '\x00',
|
||||||
'RX_RFS': '\x00',
|
'RX_RFS': '\x00',
|
||||||
'TX_RFS': '\x00',
|
'TX_RFS': '\x00',
|
||||||
@ -499,7 +514,7 @@ class routerHBP(HBSYSTEM):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# This is a new call stream
|
# This is a new call stream
|
||||||
self.STATUS['RX_START'] = pkt_time
|
self.STATUS[_slot]['RX_START'] = pkt_time
|
||||||
self._logger.info('(%s) *CALL START* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s', \
|
self._logger.info('(%s) *CALL START* 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._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 CONFIG['REPORTS']['REPORT']:
|
if CONFIG['REPORTS']['REPORT']:
|
||||||
@ -655,7 +670,7 @@ class routerHBP(HBSYSTEM):
|
|||||||
|
|
||||||
# Final actions - Is this a voice terminator?
|
# Final actions - Is this a voice terminator?
|
||||||
if (_frame_type == hb_const.HBPF_DATA_SYNC) and (_dtype_vseq == hb_const.HBPF_SLT_VTERM) and (self.STATUS[_slot]['RX_TYPE'] != hb_const.HBPF_SLT_VTERM):
|
if (_frame_type == hb_const.HBPF_DATA_SYNC) and (_dtype_vseq == hb_const.HBPF_SLT_VTERM) and (self.STATUS[_slot]['RX_TYPE'] != hb_const.HBPF_SLT_VTERM):
|
||||||
call_duration = pkt_time - self.STATUS['RX_START']
|
call_duration = pkt_time - self.STATUS[_slot]['RX_START']
|
||||||
self._logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Duration: %s', \
|
self._logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Duration: %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, 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)
|
||||||
if CONFIG['REPORTS']['REPORT']:
|
if CONFIG['REPORTS']['REPORT']:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user