Incorporate Loop Control !!

Squashed commit of the following:

commit da52307f858da5ef4f23950ff94c3c1dd78650a2
Author: Simon <simon@gb7fr.org.uk>
Date:   Wed Mar 24 18:14:42 2021 +0000

    Revert "Log UA Timer when logging bridge timer events"

    This reverts commit 8e1e96d9202afdbd2d88c73bba2abe7000718d89.

commit 79a2efcd03c736fd8f3a0187fd0b7c0033b43604
Author: Simon <simon@gb7fr.org.uk>
Date:   Wed Mar 24 18:14:41 2021 +0000

    Revert "Tidy up commented out code"

    This reverts commit c54353bddc3cb9f424a1b9087e30308b1da0f083.

commit 5081af43a9ed6a1ff62300876d089f18aeaec09f
Author: Simon <simon@gb7fr.org.uk>
Date:   Wed Mar 24 18:14:36 2021 +0000

    Revert "No UA timer on STAT bridges"

    This reverts commit 97f84c97e583ef45b5eaa57c60da24b2546a537f.

commit b605432e0fa2107928274bf848c094d5ec2bf919
Author: Simon <simon@gb7fr.org.uk>
Date:   Wed Mar 24 18:14:31 2021 +0000

    Revert "One missing"

    This reverts commit a479882017a9637107bb51e971402bf20b55d592.

commit a479882017a9637107bb51e971402bf20b55d592
Author: Simon <simon@gb7fr.org.uk>
Date:   Wed Mar 24 18:11:14 2021 +0000

    One missing

commit 97f84c97e583ef45b5eaa57c60da24b2546a537f
Author: Simon <simon@gb7fr.org.uk>
Date:   Wed Mar 24 18:06:38 2021 +0000

    No UA timer on STAT bridges

commit c54353bddc3cb9f424a1b9087e30308b1da0f083
Author: Simon <simon@gb7fr.org.uk>
Date:   Wed Mar 24 18:01:21 2021 +0000

    Tidy up commented out code

commit 8e1e96d9202afdbd2d88c73bba2abe7000718d89
Author: Simon <simon@gb7fr.org.uk>
Date:   Wed Mar 24 17:45:53 2021 +0000

    Log UA Timer when logging bridge timer events

commit 869fa90277bb72a104d0e4eb0bf91a54671f55b2
Author: Simon <simon@gb7fr.org.uk>
Date:   Wed Mar 24 09:25:05 2021 +0000

    RX_STREAM_ID keyerror

commit 6777f5892c0e64899372758a408d240ebae79704
Merge: 4bf055e 415346f
Author: Simon <simon@gb7fr.org.uk>
Date:   Wed Mar 24 09:05:27 2021 +0000

    Merge branch 'master' into loopy

commit 4bf055ede46b6cf31269def0b59ae6db738d3e8c
Author: Simon <simon@adlem.net>
Date:   Mon Feb 22 11:36:22 2021 +0000

    Revert "Log packet time"

    This reverts commit 59de64990df5cbdaf91d487254e4f0a08c3b7e73.

commit 59de64990df5cbdaf91d487254e4f0a08c3b7e73
Author: Simon <simon@adlem.net>
Date:   Mon Feb 22 11:07:26 2021 +0000

    Log packet time

commit df4b8ff525f7e6611ed1f1cfc006469695974b5e
Author: Simon <simon@adlem.net>
Date:   Mon Feb 22 10:51:53 2021 +0000

    Raise KeyError level for streamid to warning

commit 66c82257cf9f795efb6c68f077ade90681dc52cb
Author: Simon <simon@adlem.net>
Date:   Sun Feb 21 23:22:11 2021 +0000

    Only log once

commit 9989a3d06f106519dbabd4e5b83edd90205cc7ed
Author: Simon <simon@adlem.net>
Date:   Sun Feb 21 23:10:10 2021 +0000

    L

commit e61255ea761f084e20be3c0d943a8d1385695e1e
Author: Simon <simon@adlem.net>
Date:   Sun Feb 21 22:45:32 2021 +0000

    Try again

commit 7824304884d075a2ea99b2f56aa8d006b69aa979
Author: Simon <simon@adlem.net>
Date:   Sun Feb 21 22:23:48 2021 +0000

    compare streamid correctly

commit de23e7a1536306c7523fa1ff0638d84986809b2b
Author: Simon <simon@adlem.net>
Date:   Sun Feb 21 22:15:29 2021 +0000

    Disgard if stream was sourced from this system via HBP

commit 2a5e51b3c16fabd63b6ec69709ff52b734f025c3
Author: Simon <simon@adlem.net>
Date:   Sun Feb 21 19:36:19 2021 +0000

    Revert "Tidy up from loop control work"

    This reverts commit 3f43d86c71ac30b997c11a0dbd75dbe0a0be699d.

commit 3f43d86c71ac30b997c11a0dbd75dbe0a0be699d
Author: Simon <simon@adlem.net>
Date:   Sun Feb 21 19:23:37 2021 +0000

    Tidy up from loop control work

commit e7d25b2b1c40ab488d42d57b3bf1abbe10828955
Author: Simon <simon@adlem.net>
Date:   Sun Feb 21 18:44:43 2021 +0000

    Fix what I broke - voice

commit 01f8620ee5068bc58c7c2e53ecb891cb25648423
Author: Simon <simon@adlem.net>
Date:   Sun Feb 21 16:55:39 2021 +0000

    lop

commit 234e528547641e017525c5c6d56e79f0a3f74ae1
Merge: d71d7c1 2f1b128
Author: Simon <simon@adlem.net>
Date:   Sun Feb 21 16:30:42 2021 +0000

    Merge branch 'master' into loopy

commit d71d7c10799706439c9fd32c7e955ef3cbfbc840
Author: Simon <simon@adlem.net>
Date:   Sat Feb 20 21:05:02 2021 +0000

    Fix speech issue

commit f5f354592e2dc2099db3576a3e93eba0d25c281b
Author: Simon <simon@adlem.net>
Date:   Mon Feb 15 10:40:16 2021 +0000

    LoopHold should be an integer

commit 5455b3920876bfc41f9e48ef9605fddbbb7772c7
Author: Simon <simon@adlem.net>
Date:   Mon Feb 15 10:35:14 2021 +0000

    5 packet loophold for rebound packets

commit 7aa8c65cef58bdebb37361fc1ca3ac5198fb3aab
Author: Simon <simon@adlem.net>
Date:   Mon Feb 15 10:28:47 2021 +0000

    No square brackets in loophold

commit 096fae4dc99ac6f20fa1430fe8cbebc240099a3b
Author: Simon <simon@adlem.net>
Date:   Mon Feb 15 10:27:01 2021 +0000

    Loophold top stop rebound packets

commit c6284ea4c1d1f301b5112a11f0a71144224d71ad
Author: Simon <simon@adlem.net>
Date:   Mon Feb 15 10:10:43 2021 +0000

    Further typo in last change

commit 1ef70d4bdd8bc465a101aa2ab46dd275634a75d8
Author: Simon <simon@adlem.net>
Date:   Mon Feb 15 10:08:37 2021 +0000

    Typo in keyerror string

commit ac76346cbd60ee56c622912fe7addda9751de880
Author: Simon <simon@adlem.net>
Date:   Mon Feb 15 01:25:47 2021 +0000

    TGID

commit f9a654aa9069dd29e9e921516e81033e1e3b81d8
Author: Simon <simon@adlem.net>
Date:   Mon Feb 15 00:18:33 2021 +0000

    1st

commit 19060a430d350a16611816bed789246c00c58cd5
Author: Simon <simon@adlem.net>
Date:   Mon Feb 15 00:14:24 2021 +0000

    Whitespace!

commit e682f6924125242b5846123d0c031f99733b5a30
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:37:33 2021 +0000

    Revert "Revert "b+""

    This reverts commit 312483086181c3f9cd1136e29c6574781e637e60.

commit c6b7863ab34c6aceeaae8c39d00c9ef7a12bd62c
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:36:59 2021 +0000

    Revert "Revert "TGID2""

    This reverts commit d10091ff5e1f09c88da38f2a7fbe4e4e58d85dfa.

commit ecae036c4cb193940137bb157778969986817bf4
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:36:46 2021 +0000

    Revert "Revert "tgid""

    This reverts commit 1059c0c552e2db4bf74de539dd618bd2b4fc3a18.

commit 4466c029d9e04715e879ffb8b82b57c62464bbb6
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:36:36 2021 +0000

    Revert "Revert "f""

    This reverts commit b7c60f4dd3281273aa67d5e6c9e2f8137f6e69cf.

commit b7c60f4dd3281273aa67d5e6c9e2f8137f6e69cf
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:32:02 2021 +0000

    Revert "f"

    This reverts commit 35a10397e92b634b56cd6c4631ee36b12c87d8df.

commit 1059c0c552e2db4bf74de539dd618bd2b4fc3a18
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:30:58 2021 +0000

    Revert "tgid"

    This reverts commit b427a63584d2715900ee8a599181ef7332267bb2.

commit d10091ff5e1f09c88da38f2a7fbe4e4e58d85dfa
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:30:38 2021 +0000

    Revert "TGID2"

    This reverts commit 0da3a895a1c8941f135798a4f8728916ae01a630.

commit 312483086181c3f9cd1136e29c6574781e637e60
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:30:19 2021 +0000

    Revert "b+"

    This reverts commit 3e62cd48d60adb3e9d39960e2e6a54b813e03075.

commit 3e62cd48d60adb3e9d39960e2e6a54b813e03075
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:29:04 2021 +0000

    b+

commit 0da3a895a1c8941f135798a4f8728916ae01a630
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:26:01 2021 +0000

    TGID2

commit b427a63584d2715900ee8a599181ef7332267bb2
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:24:31 2021 +0000

    tgid

commit 35a10397e92b634b56cd6c4631ee36b12c87d8df
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 23:11:23 2021 +0000

    f

commit 46c33c1aa92071e364af2f87f5f612bb01513242
Author: Simon <simon@adlem.net>
Date:   Sun Feb 14 22:52:02 2021 +0000

    lo
This commit is contained in:
Simon 2021-03-24 18:19:18 +00:00
parent 415346f458
commit bec116337e

View File

@ -384,7 +384,7 @@ def stream_trimmer_loop():
if systems[system].STATUS[stream_id]['LAST'] < _now - 5:
remove_list.append(stream_id)
except:
logger.debug("(%s) Keyerror - stream trimmer Stream ID: %s Start: %s Contention: %s RFS: %s TGID: %s",stream_id,systems[system].STATUS[stream_id]['START'],systems[system].STATUS[stream_id]['CONTENTION'],systems[system].STATUS[stream_id]['RFS'],int_id(systems[system].STATUS[stream_id]['TGID']))
logger.warning("(%s) Keyerror - stream trimmer Stream ID: %s",system,stream_id)
systems[system].STATUS[stream_id]['LAST'] = _now
continue
@ -1062,7 +1062,10 @@ class routerOBP(OPENBRIDGE):
'TGID': _dst_id,
}
# Generate LCs (full and EMB) for the TX stream
dst_lc = b''.join([self.STATUS[_stream_id]['LC'][0:3], _target['TGID'], _rf_src])
try:
dst_lc = b''.join([self.STATUS[_stream_id]['LC'][0:3], _target['TGID'], _rf_src])
except:
return
_target_status[_stream_id]['H_LC'] = bptc.encode_header_lc(dst_lc)
_target_status[_stream_id]['T_LC'] = bptc.encode_terminator_lc(dst_lc)
_target_status[_stream_id]['EMB_LC'] = bptc.encode_emblc(dst_lc)
@ -1209,14 +1212,15 @@ class routerOBP(OPENBRIDGE):
if _call_type == 'group':
# Is this a new call stream?
if (_stream_id not in self.STATUS):
# This is a new call stream
self.STATUS[_stream_id] = {
'START': pkt_time,
'CONTENTION':False,
'RFS': _rf_src,
'TGID': _dst_id,
'1ST': True
}
# 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:
@ -1231,6 +1235,45 @@ class routerOBP(OPENBRIDGE):
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)
else:
# Loop Control
#if 'LOOPHOLD' in self.STATUS[_stream_id]:
#if self.STATUS[_stream_id]['LOOPHOLD'] < 5:
#logger.debug ('(%s) Avoid packet due to loophold: %s',self._system,self.STATUS[_stream_id]['LOOPHOLD'])
#self.STATUS[_stream_id]['LOOPHOLD'] = self.STATUS[_stream_id]['LOOPHOLD'] + 1
#else:
#try:
#self.STATUS.pop('LOOPHOLD')
#except:
#pass
#return
for system in systems:
if system == self._system:
continue
if CONFIG['SYSTEMS'][system]['MODE'] != 'OPENBRIDGE':
for _sysslot in systems[system].STATUS:
if 'RX_STREAM_ID' in systems[system].STATUS[_sysslot] and _stream_id == systems[system].STATUS[_sysslot]['RX_STREAM_ID']:
if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']:
logger.warning("(%s) OBP LoopControl - call originated from HBP %s, stream id: %s, TG: %s, TS: %s, disgarding stream",self._system, system, int_id(_stream_id), int_id(_dst_id),_sysslot)
self.STATUS[_stream_id]['LOOPLOG'] = True
self.STATUS[_stream_id]['LAST'] = pkt_time
return
else:
#if _stream_id in systems[system].STATUS and systems[system].STATUS[_stream_id]['START'] <= self.STATUS[_stream_id]['START']:
if _stream_id in systems[system].STATUS and '1ST' in systems[system].STATUS[_stream_id] and systems[system].STATUS[_stream_id]['TGID'] == _dst_id:
if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']:
logger.warning("(%s) OBP LoopControl - system %s is first system for stream id: %s on TG %s, disgarding stream from this system",self._system, system, int_id(_stream_id), int_id(_dst_id))
self.STATUS[_stream_id]['LOOPLOG'] = True
self.STATUS[_stream_id]['LAST'] = pkt_time
return
#Move this here to stop messing up the dash - we only want to log a QSO if we allow it
if (_stream_id not in self.STATUS):
if CONFIG['REPORTS']['REPORT']:
self._report.send_bridgeEvent('GROUP 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'))
@ -1261,10 +1304,10 @@ 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'))
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:
selflogger.error('(%s) *CALL END* STREAM ID: %s NOT IN LIST -- THIS IS A REAL PROBLEM', self._system, int_id(_stream_id))
#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:
#selflogger.error('(%s) *CALL END* STREAM ID: %s NOT IN LIST -- THIS IS A REAL PROBLEM', self._system, int_id(_stream_id))
#Reset sequence number
self._lastSeq = False