From 43ddb6c889e66e2b5283ceb8d7d0874812dac348 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 5 Jan 2022 16:03:08 +0000 Subject: [PATCH 1/7] print --- bridge_master.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bridge_master.py b/bridge_master.py index 45f959a..8e5da9b 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1636,6 +1636,7 @@ class routerOBP(OPENBRIDGE): else: + print(self.STATUS[_stream_id]) self.STATUS[_stream_id]['packets'] = self.STATUS[_stream_id]['packets'] +1 #Finished stream handling# if '_fin' in self.STATUS[_stream_id]: From 999196ac78200a96ea1c62651bdf484f9175199a Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 5 Jan 2022 16:11:05 +0000 Subject: [PATCH 2/7] hmf --- bridge_master.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 8e5da9b..c9342e4 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1636,8 +1636,8 @@ class routerOBP(OPENBRIDGE): else: - print(self.STATUS[_stream_id]) - self.STATUS[_stream_id]['packets'] = self.STATUS[_stream_id]['packets'] +1 + if 'packets' in self.STATUS[_stream_id]: + self.STATUS[_stream_id]['packets'] = self.STATUS[_stream_id]['packets'] +1 #Finished stream handling# if '_fin' in self.STATUS[_stream_id]: if '_finlog' not in self.STATUS[_stream_id]: @@ -1737,7 +1737,9 @@ class routerOBP(OPENBRIDGE): # Final actions - Is this a voice terminator? if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM): call_duration = pkt_time - self.STATUS[_stream_id]['START'] - packet_rate = self.STATUS[_stream_id][packets] / call_duration + packet_rate = 100 + if 'packets' in self.STATUS[_stream_id]: + packet_rate = self.STATUS[_stream_id]['packets'] / call_duration logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Duration: %.2f, Packet rate: %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, packet_rate) if CONFIG['REPORTS']['REPORT']: From f947206556a55a6ffb75641c4493fe552c8cc19a Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 5 Jan 2022 16:15:17 +0000 Subject: [PATCH 3/7] 2 dp --- bridge_master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge_master.py b/bridge_master.py index c9342e4..4d73c26 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1740,7 +1740,7 @@ class routerOBP(OPENBRIDGE): packet_rate = 100 if 'packets' in self.STATUS[_stream_id]: packet_rate = self.STATUS[_stream_id]['packets'] / call_duration - logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Duration: %.2f, Packet rate: %s', \ + logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Duration: %.2f, Packet rate: %.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, packet_rate) 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')) From 489cf97fa31917fe95f0df1c424d44021b5e319d Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 5 Jan 2022 16:16:53 +0000 Subject: [PATCH 4/7] remove 2nd condit --- bridge_master.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 4d73c26..a797c71 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1738,9 +1738,9 @@ class routerOBP(OPENBRIDGE): if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM): call_duration = pkt_time - self.STATUS[_stream_id]['START'] packet_rate = 100 - if 'packets' in self.STATUS[_stream_id]: - packet_rate = self.STATUS[_stream_id]['packets'] / call_duration - logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Duration: %.2f, Packet rate: %.2f', \ + #if 'packets' in self.STATUS[_stream_id]: + packet_rate = self.STATUS[_stream_id]['packets'] / call_duration + logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Duration: %.2f, Packet rate: %.2f/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, packet_rate) 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')) From 3b68e153c9808d5c944f5c9e1c6afa90a31c26a3 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 5 Jan 2022 17:16:08 +0000 Subject: [PATCH 5/7] ping --- bridge_master.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index a797c71..181655b 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1675,7 +1675,10 @@ class routerOBP(OPENBRIDGE): if self._system != fi: if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']: - logger.warning("(%s) OBP *LoopControl* FIRST OBP %s, STREAM ID: %s, TG %s, IGNORE THIS SOURCE",self._system, fi, int_id(_stream_id), int_id(_dst_id)) + call_duration = pkt_time - self.STATUS[_stream_id]['START'] + packet_rate = 0 + packet_rate = self.STATUS[_stream_id]['packets'] / call_duration + logger.warning("(%s) OBP *LoopControl* FIRST OBP %s, STREAM ID: %s, TG %s, IGNORE THIS SOURCE. PACKET RATE %0.2f",self._system, fi, int_id(_stream_id), int_id(_dst_id),call_duration) self.STATUS[_stream_id]['LOOPLOG'] = True self.STATUS[_stream_id]['LAST'] = pkt_time @@ -1737,8 +1740,7 @@ class routerOBP(OPENBRIDGE): # Final actions - Is this a voice terminator? if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM): call_duration = pkt_time - self.STATUS[_stream_id]['START'] - packet_rate = 100 - #if 'packets' in self.STATUS[_stream_id]: + packet_rate = 0 packet_rate = self.STATUS[_stream_id]['packets'] / call_duration logger.info('(%s) *CALL END* STREAM ID: %s SUB: %s (%s) PEER: %s (%s) TGID %s (%s), TS %s, Duration: %.2f, Packet rate: %.2f/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, packet_rate) From 605161d93bdc533ec4a1d9880c724970a035e101 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 5 Jan 2022 17:22:29 +0000 Subject: [PATCH 6/7] Packet rate reporting for loop too --- bridge_master.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge_master.py b/bridge_master.py index 181655b..64c1e61 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1678,7 +1678,7 @@ class routerOBP(OPENBRIDGE): call_duration = pkt_time - self.STATUS[_stream_id]['START'] packet_rate = 0 packet_rate = self.STATUS[_stream_id]['packets'] / call_duration - logger.warning("(%s) OBP *LoopControl* FIRST OBP %s, STREAM ID: %s, TG %s, IGNORE THIS SOURCE. PACKET RATE %0.2f",self._system, fi, int_id(_stream_id), int_id(_dst_id),call_duration) + logger.warning("(%s) OBP *LoopControl* FIRST OBP %s, STREAM ID: %s, TG %s, IGNORE THIS SOURCE. PACKET RATE %0.2f/s",self._system, fi, int_id(_stream_id), int_id(_dst_id),call_duration) self.STATUS[_stream_id]['LOOPLOG'] = True self.STATUS[_stream_id]['LAST'] = pkt_time From f06a49a14c934ec7f2aa1810d6a875322c406a65 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 5 Jan 2022 17:24:58 +0000 Subject: [PATCH 7/7] rate also on loops for unit data --- bridge_master.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bridge_master.py b/bridge_master.py index 64c1e61..28fef62 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1519,7 +1519,10 @@ class routerOBP(OPENBRIDGE): if self._system != fi: if 'LOOPLOG' not in self.STATUS[_stream_id] or not self.STATUS[_stream_id]['LOOPLOG']: - logger.warning("(%s) OBP UNIT *LoopControl* FIRST OBP %s, STREAM ID: %s, TG %s, IGNORE THIS SOURCE",self._system, fi, int_id(_stream_id), int_id(_dst_id)) + call_duration = pkt_time - self.STATUS[_stream_id]['START'] + packet_rate = 0 + packet_rate = self.STATUS[_stream_id]['packets'] / call_duration + logger.warning("(%s) OBP UNIT *LoopControl* FIRST OBP %s, STREAM ID: %s, TG %s, IGNORE THIS SOURCE. PACKET RATE %0.2f/s",self._system, fi, int_id(_stream_id), int_id(_dst_id),packet_rate) self.STATUS[_stream_id]['LOOPLOG'] = True self.STATUS[_stream_id]['LAST'] = pkt_time return