Handle stream end properly

This commit is contained in:
Simon 2021-03-25 22:51:41 +00:00
parent 339ed8b9ce
commit 092248b3ce
1 changed files with 6 additions and 0 deletions

View File

@ -380,6 +380,11 @@ def stream_trimmer_loop():
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE':
remove_list = []
for stream_id in systems[system].STATUS:
#if stream already marked as finished, just remove it
if '_fin' in [system].STATUS[stream_id] and systems[system].STATUS[stream_id]['LAST'] < _now - 5:
removed = systems[system].STATUS.pop(stream_id)
try:
if systems[system].STATUS[stream_id]['LAST'] < _now - 5:
remove_list.append(stream_id)
@ -1304,6 +1309,7 @@ class routerOBP(OPENBRIDGE):
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']:
self._report.send_bridgeEvent('GROUP VOICE,END,RX,{},{},{},{},{},{},{:.2f}'.format(self._system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), _slot, int_id(_dst_id), call_duration).encode(encoding='utf-8', errors='ignore'))
self.STATUS[_stream_id]['_fin'] = True
#removed = self.STATUS.pop(_stream_id)
#logger.debug('(%s) OpenBridge sourced call stream end, remove terminated Stream ID: %s', self._system, int_id(_stream_id))
#if not removed: