Bridging Now Works
This commit is contained in:
parent
25c9ce23d2
commit
10f73545ad
@ -13,7 +13,7 @@ from twisted.internet import task
|
||||
|
||||
import binascii
|
||||
import dmrlink
|
||||
from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, int_id, send_to_ipsc
|
||||
from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, int_id, send_to_ipsc, dmr_nat
|
||||
|
||||
RULES = {
|
||||
'K0USY': {
|
||||
@ -56,12 +56,12 @@ class bridgeIPSC(IPSC):
|
||||
_data = _data.replace(_peerid, NETWORK[_target]['LOCAL']['RADIO_ID'])
|
||||
# Re-Write the destinaion Group ID
|
||||
_data = _data.replace(_dst_sub, source['DST_GROUP'])
|
||||
_data = dmr_nat(_data, '\x00\x0C\x30')
|
||||
# Calculate and append the authentication hash for the target network... if necessary
|
||||
if NETWORK[_target]['LOCAL']['AUTH_KEY'] == True:
|
||||
_data = hashed_packet(NETWORK[_target]['LOCAL']['AUTH_KEY'], _data)
|
||||
if NETWORK[_target]['LOCAL']['AUTH_ENABLED'] == True:
|
||||
_data = self.hashed_packet(NETWORK[_target]['LOCAL']['AUTH_KEY'], _data)
|
||||
# Send the packet to all peers in the target IPSC
|
||||
send_to_ipsc(_target, _data)
|
||||
print(_target, binascii.b2a_hex(_data))
|
||||
|
||||
def private_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data):
|
||||
pass
|
||||
|
@ -228,11 +228,8 @@ def valid_master(_network, _peerid):
|
||||
# Accept a complete packet, ready to be sent, and send it to all active peers + master in an IPSC
|
||||
#
|
||||
def send_to_ipsc(_target, _packet):
|
||||
# _log = logger.debug
|
||||
# Send to the Master
|
||||
# _log('Sending %s to:', binascii.b2a_hex(_packet)
|
||||
networks[_target].transport.write(_packet, (NETWORK[_target]['MASTER']['IP'], NETWORK[_target]['MASTER']['PORT']))
|
||||
# _log(' Master: %s', binascii.b2a_hex(NETWORK[_target]['MASTER']['RADIO_ID']))
|
||||
# Send to each connected Peer
|
||||
for peer in NETWORK[_target]['PEERS']:
|
||||
if peer['STATUS']['CONNECTED'] == True:
|
||||
|
Loading…
Reference in New Issue
Block a user