diff --git a/bridge.py b/bridge.py index 9294f14..fc40c19 100755 --- a/bridge.py +++ b/bridge.py @@ -457,12 +457,14 @@ class routerOBP(OPENBRIDGE): # This is a new call stream, so log & report - self.STATUS['START'] = pkt_time 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._targets) 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), self._targets).encode(encoding='utf-8', errors='ignore')) + # Record the time of this packet so we can later identify a stale stream + self.STATUS[_stream_id]['LAST'] = pkt_time + for _target in self._targets: _target_status = systems[_target].STATUS _target_system = self._CONFIG['SYSTEMS'][_target] @@ -486,12 +488,14 @@ class routerOBP(OPENBRIDGE): # Record the time of this packet so we can later identify a stale stream _target_status[_stream_id]['LAST'] = pkt_time # Clear the TS bit and follow propper OBP definition, unless "BOTH_SLOTS" is set. This only works for unit calls. - if not _target_system['BOTH_SLOTS']: + if _target_system['BOTH_SLOTS']: + _tmp_bits = _bits + else: _tmp_bits = _bits & ~(1 << 7) - # Assemble transmit HBP packet - _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) - _data = b''.join([_tmp_data, dmrpkt]) + # Assemble transmit HBP packet + _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) + _data = b''.join([_tmp_data, dmrpkt]) if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM): _target_status[_stream_id]['ACTIVE'] = False @@ -558,7 +562,7 @@ class routerOBP(OPENBRIDGE): # Final actions - Is this a voice terminator? if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM): self._targets = [] - call_duration = pkt_time - self.STATUS['START'] + call_duration = pkt_time - self.STATUS[_stream_id]['START'] 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) if CONFIG['REPORTS']['REPORT']: @@ -957,12 +961,14 @@ class routerHBP(HBSYSTEM): # Record the time of this packet so we can later identify a stale stream _target_status[_stream_id]['LAST'] = pkt_time # Clear the TS bit and follow propper OBP definition, unless "BOTH_SLOTS" is set. This only works for unit calls. - if not _target_system['BOTH_SLOTS']: + if _target_system['BOTH_SLOTS']: + _tmp_bits = _bits + else: _tmp_bits = _bits & ~(1 << 7) - # Assemble transmit HBP packet - _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) - _data = b''.join([_tmp_data, dmrpkt]) + # Assemble transmit HBP packet + _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) + _data = b''.join([_tmp_data, dmrpkt]) if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM): _target_status[_stream_id]['ACTIVE'] = False diff --git a/hblink-750.cfg b/hblink-750.cfg new file mode 100755 index 0000000..aecfff4 --- /dev/null +++ b/hblink-750.cfg @@ -0,0 +1,127 @@ +[GLOBAL] +PATH: ./ +PING_TIME: 5 +MAX_MISSED: 3 +USE_ACL: False +REG_ACL: DENY:1 +SUB_ACL: DENY:1 +TGID_TS1_ACL: PERMIT:ALL +TGID_TS2_ACL: PERMIT:ALL + +[REPORTS] +REPORT: False +REPORT_INTERVAL: 60 +REPORT_PORT: 4321 +REPORT_CLIENTS: 127.0.0.1 + +[LOGGER] +LOG_FILE: /tmp/hblink.log +LOG_HANDLERS: console-timed +LOG_LEVEL: INFO +LOG_NAME: 444.750 + +[ALIASES] +TRY_DOWNLOAD: False +PATH: ./ +PEER_FILE: peer_ids.json +SUBSCRIBER_FILE: subscriber_ids.json +TGID_FILE: talkgroup_ids.json +PEER_URL: https://www.radioid.net/static/rptrs.json +SUBSCRIBER_URL: https://www.radioid.net/static/users.json +STALE_DAYS: 7 + +[OBP] +MODE: OPENBRIDGE +ENABLED: True +IP: +PORT: 50100 +NETWORK_ID: 1 +PASSPHRASE: deadbeef +#TARGET_IP: olympic.k0usy.org +TARGET_IP: 127.0.0.1 +#TARGET_PORT: 50666 +TARGET_PORT: 50101 +BOTH_SLOTS: True +USE_ACL: False +SUB_ACL: DENY:1 +TGID_ACL: PERMIT:ALL + +[444.750] +MODE: MASTER +ENABLED: True +REPEAT: True +MAX_PEERS: 5 +EXPORT_AMBE: False +IP: +PORT: 50001 +PASSPHRASE: jimmy +GROUP_HANGTIME: 10 +USE_ACL: False +REG_ACL: DENY:1 +SUB_ACL: DENY:1 +TGID_TS1_ACL: DENY:8 +TGID_TS2_ACL: PERMIT:3120 + +[TWO] +MODE: MASTER +ENABLED: False +REPEAT: True +MAX_PEERS: 5 +EXPORT_AMBE: False +IP: +PORT:50002 +PASSPHRASE: jimmy +GROUP_HANGTIME: 10 +USE_ACL: False +REG_ACL: DENY:1 +SUB_ACL: DENY:1 +TGID_TS1_ACL: DENY:8 +TGID_TS2_ACL: PERMIT:3120 + +[THREE] +MODE: MASTER +ENABLED: False +REPEAT: True +MAX_PEERS: 5 +EXPORT_AMBE: False +IP: +PORT:50003 +PASSPHRASE: jimmy +GROUP_HANGTIME: 10 +USE_ACL: False +REG_ACL: DENY:1 +SUB_ACL: DENY:1 +TGID_TS1_ACL: DENY:8 +TGID_TS2_ACL: PERMIT:3120 + +[KS-DMR] +MODE: PEER +ENABLED: False +LOOSE: False +EXPORT_AMBE: False +IP: +PORT: 54001 +MASTER_IP: olympic.k0usy.org +MASTER_PORT: 62071 +PASSPHRASE: c0ffee +CALLSIGN: W1ABC +RADIO_ID: 312312 +RX_FREQ: 449000000 +TX_FREQ: 444000000 +TX_POWER: 25 +COLORCODE: 1 +SLOTS: 1 +LATITUDE: 38.0000 +LONGITUDE: -095.0000 +HEIGHT: 75 +LOCATION: Anywhere, USA +DESCRIPTION: This is a cool repeater +URL: www.w1abc.org +SOFTWARE_ID: 20170620 +PACKAGE_ID: MMDVM_HBlink +GROUP_HANGTIME: 5 +OPTIONS: +USE_ACL: True +SUB_ACL: DENY:1 +TGID_TS1_ACL: PERMIT:ALL +TGID_TS2_ACL: PERMIT:ALL diff --git a/hblink-800.cfg b/hblink-800.cfg new file mode 100755 index 0000000..0fe46db --- /dev/null +++ b/hblink-800.cfg @@ -0,0 +1,127 @@ +[GLOBAL] +PATH: ./ +PING_TIME: 5 +MAX_MISSED: 3 +USE_ACL: False +REG_ACL: DENY:1 +SUB_ACL: DENY:1 +TGID_TS1_ACL: PERMIT:ALL +TGID_TS2_ACL: PERMIT:ALL + +[REPORTS] +REPORT: False +REPORT_INTERVAL: 60 +REPORT_PORT: 4321 +REPORT_CLIENTS: 127.0.0.1 + +[LOGGER] +LOG_FILE: /tmp/hblink.log +LOG_HANDLERS: console-timed +LOG_LEVEL: INFO +LOG_NAME: 444.800 + +[ALIASES] +TRY_DOWNLOAD: False +PATH: ./ +PEER_FILE: peer_ids.json +SUBSCRIBER_FILE: subscriber_ids.json +TGID_FILE: talkgroup_ids.json +PEER_URL: https://www.radioid.net/static/rptrs.json +SUBSCRIBER_URL: https://www.radioid.net/static/users.json +STALE_DAYS: 7 + +[OBP] +MODE: OPENBRIDGE +ENABLED: True +IP: +PORT: 50101 +NETWORK_ID: 2 +PASSPHRASE: deadbeef +#TARGET_IP: olympic.k0usy.org +TARGET_IP: 127.0.0.1 +#TARGET_PORT: 50666 +TARGET_PORT: 50100 +BOTH_SLOTS: True +USE_ACL: False +SUB_ACL: DENY:1 +TGID_ACL: PERMIT:ALL + +[444.800] +MODE: MASTER +ENABLED: True +REPEAT: True +MAX_PEERS: 5 +EXPORT_AMBE: False +IP: +PORT: 50011 +PASSPHRASE: jimmy +GROUP_HANGTIME: 10 +USE_ACL: False +REG_ACL: DENY:1 +SUB_ACL: DENY:1 +TGID_TS1_ACL: DENY:8 +TGID_TS2_ACL: PERMIT:3120 + +[TWO] +MODE: MASTER +ENABLED: False +REPEAT: True +MAX_PEERS: 5 +EXPORT_AMBE: False +IP: +PORT:50012 +PASSPHRASE: jimmy +GROUP_HANGTIME: 10 +USE_ACL: False +REG_ACL: DENY:1 +SUB_ACL: DENY:1 +TGID_TS1_ACL: DENY:8 +TGID_TS2_ACL: PERMIT:3120 + +[THREE] +MODE: MASTER +ENABLED: False +REPEAT: True +MAX_PEERS: 5 +EXPORT_AMBE: False +IP: +PORT:50013 +PASSPHRASE: jimmy +GROUP_HANGTIME: 10 +USE_ACL: False +REG_ACL: DENY:1 +SUB_ACL: DENY:1 +TGID_TS1_ACL: DENY:8 +TGID_TS2_ACL: PERMIT:3120 + +[KS-DMR] +MODE: PEER +ENABLED: False +LOOSE: False +EXPORT_AMBE: False +IP: +PORT: 54011 +MASTER_IP: olympic.k0usy.org +MASTER_PORT: 62071 +PASSPHRASE: c0ffee +CALLSIGN: W1ABC +RADIO_ID: 312312 +RX_FREQ: 449000000 +TX_FREQ: 444000000 +TX_POWER: 25 +COLORCODE: 1 +SLOTS: 1 +LATITUDE: 38.0000 +LONGITUDE: -095.0000 +HEIGHT: 75 +LOCATION: Anywhere, USA +DESCRIPTION: This is a cool repeater +URL: www.w1abc.org +SOFTWARE_ID: 20170620 +PACKAGE_ID: MMDVM_HBlink +GROUP_HANGTIME: 5 +OPTIONS: +USE_ACL: True +SUB_ACL: DENY:1 +TGID_TS1_ACL: PERMIT:ALL +TGID_TS2_ACL: PERMIT:ALL diff --git a/rules-750.py b/rules-750.py new file mode 100755 index 0000000..b0c1b5f --- /dev/null +++ b/rules-750.py @@ -0,0 +1,16 @@ +BRIDGES = { + '1/2': [ + {'SYSTEM': '444.750', 'TS': 1, 'TGID': 2, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []}, + {'SYSTEM': 'OBP', 'TS': 1, 'TGID': 2, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []} + ], + 'KANSAS': [ + {'SYSTEM': '444.750', 'TS': 2, 'TGID': 3120, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []}, + {'SYSTEM': 'OBP', 'TS': 1, 'TGID': 3120, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []} + ] +} + +UNIT = ['444.750', 'OBP'] + +if __name__ == '__main__': + from pprint import pprint + pprint(BRIDGES) diff --git a/rules-800.py b/rules-800.py new file mode 100755 index 0000000..0d10f53 --- /dev/null +++ b/rules-800.py @@ -0,0 +1,16 @@ +BRIDGES = { + '1/2': [ + {'SYSTEM': '444.800', 'TS': 1, 'TGID': 2, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []}, + {'SYSTEM': 'OBP', 'TS': 1, 'TGID': 2, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []} + ], + 'KANSAS': [ + {'SYSTEM': '444.800', 'TS': 2, 'TGID': 3120, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []}, + {'SYSTEM': 'OBP', 'TS': 1, 'TGID': 3120, 'ACTIVE': True, 'TIMEOUT': 5,'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []} + ] +} + +UNIT = ["444.800", "OBP"] + +if __name__ == '__main__': + from pprint import pprint + pprint(BRIDGES)