mirror of
https://github.com/ShaYmez/hblink3.git
synced 2024-11-21 15:41:49 -05:00
Fixed Private Call Bridging when BOTH_SLOTS selected
This is the problem where bridge.py is told to send private calls marked with EITHER timeslot over openbridge. Packets weren't assembled correctly when the BOTH_SLOTS option was set True in the hblink configuraiton file. d: # modified: bridge.py # modified: hblink.py # # Changes not staged for commit: # modified: .gitattributes # modified: Dockerfile # modified: voice_lib.py #
This commit is contained in:
parent
24dca2e6ad
commit
ccfd862a0a
26
bridge.py
26
bridge.py
@ -457,12 +457,14 @@ class routerOBP(OPENBRIDGE):
|
|||||||
|
|
||||||
|
|
||||||
# This is a new call stream, so log & report
|
# 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', \
|
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)
|
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']:
|
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'))
|
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:
|
for _target in self._targets:
|
||||||
_target_status = systems[_target].STATUS
|
_target_status = systems[_target].STATUS
|
||||||
_target_system = self._CONFIG['SYSTEMS'][_target]
|
_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
|
# Record the time of this packet so we can later identify a stale stream
|
||||||
_target_status[_stream_id]['LAST'] = pkt_time
|
_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.
|
# 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)
|
_tmp_bits = _bits & ~(1 << 7)
|
||||||
|
|
||||||
# Assemble transmit HBP packet
|
# Assemble transmit HBP packet
|
||||||
_tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]])
|
_tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]])
|
||||||
_data = b''.join([_tmp_data, dmrpkt])
|
_data = b''.join([_tmp_data, dmrpkt])
|
||||||
|
|
||||||
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM):
|
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM):
|
||||||
_target_status[_stream_id]['ACTIVE'] = False
|
_target_status[_stream_id]['ACTIVE'] = False
|
||||||
@ -558,7 +562,7 @@ class routerOBP(OPENBRIDGE):
|
|||||||
# Final actions - Is this a voice terminator?
|
# Final actions - Is this a voice terminator?
|
||||||
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM):
|
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM):
|
||||||
self._targets = []
|
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', \
|
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)
|
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']:
|
||||||
@ -957,12 +961,14 @@ class routerHBP(HBSYSTEM):
|
|||||||
# Record the time of this packet so we can later identify a stale stream
|
# Record the time of this packet so we can later identify a stale stream
|
||||||
_target_status[_stream_id]['LAST'] = pkt_time
|
_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.
|
# 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)
|
_tmp_bits = _bits & ~(1 << 7)
|
||||||
|
|
||||||
# Assemble transmit HBP packet
|
# Assemble transmit HBP packet
|
||||||
_tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]])
|
_tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]])
|
||||||
_data = b''.join([_tmp_data, dmrpkt])
|
_data = b''.join([_tmp_data, dmrpkt])
|
||||||
|
|
||||||
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM):
|
if (_frame_type == HBPF_DATA_SYNC) and (_dtype_vseq == HBPF_SLT_VTERM):
|
||||||
_target_status[_stream_id]['ACTIVE'] = False
|
_target_status[_stream_id]['ACTIVE'] = False
|
||||||
|
127
hblink-750.cfg
Executable file
127
hblink-750.cfg
Executable file
@ -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
|
127
hblink-800.cfg
Executable file
127
hblink-800.cfg
Executable file
@ -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
|
16
rules-750.py
Executable file
16
rules-750.py
Executable file
@ -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)
|
16
rules-800.py
Executable file
16
rules-800.py
Executable file
@ -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)
|
Loading…
Reference in New Issue
Block a user