Multiple - See Extended

Move bridge.py's config information to a separate file.
Provide a sample file for bridge.py (bridge_rules_SAMPLE.py)
Tell peers we're a 3rd party app and repeater monitor.
This commit is contained in:
Cort Buffington 2013-11-17 18:13:59 -06:00
parent 2c826f76ed
commit 7a0cedb7cb
4 changed files with 52 additions and 42 deletions

1
.gitignore vendored
View File

@ -3,4 +3,5 @@
Icon
dmrlink.cfg
pub*
bridge_rules.py
*.pyc

View File

@ -21,44 +21,13 @@ from dmrlink import IPSC, UnauthIPSC, NETWORK, networks, int_id, send_to_ipsc, d
# RPT_WAKE_UP = b'\x85' + NETWORK[_network]['LOCAL']['RADIO_ID] + b'\x00\x00\x00\x01' + b'\x01' + b'\x01'
# TS1 = 0, TS2 = 1
RULES = {
'K0USY': {
'GROUP_VOICE': [
{'SRC_GROUP': b'\x00\x0C\x30', 'SRC_TS': 1, 'DST_NET': 'LAWRENCE', 'DST_GROUP': b'\x00\x0C\x30', 'SRC_TS': 1},
{'SRC_GROUP': b'\x00\x0C\x30', 'SRC_TS': 1, 'DST_NET': 'TEST', 'DST_GROUP': b'\x00\x00\xD2', 'SRC_TS': 1}
],
'PRIVATE_VOICE': [
],
'GROUP_DATA': [
],
'PRIVATE_DATA': [
]
},
'LAWRENCE': {
'GROUP_VOICE': [
{'SRC_GROUP': b'\x00\x0C\x30', 'SRC_TS': 1, 'DST_NET': 'K0USY', 'DST_GROUP': b'\x00\x0C\x30', 'SRC_TS': 1},
{'SRC_GROUP': b'\x00\x0C\x30', 'SRC_TS': 1, 'DST_NET': 'TEST', 'DST_GROUP': b'\x00\x00\xD2', 'SRC_TS': 1}
],
'PRIVATE_VOICE': [
],
'GROUP_DATA': [
],
'PRIVATE_DATA': [
]
},
'TEST': {
'GROUP_VOICE': [
{'SRC_GROUP': b'\x00\x00\xD2', 'SRC_TS': 1, 'DST_NET': 'K0USY', 'DST_GROUP': b'\x00\x0C\x30', 'SRC_TS': 1},
{'SRC_GROUP': b'\x00\x00\xD2', 'SRC_TS': 1, 'DST_NET': 'LAWRENCE', 'DST_GROUP': b'\x00\x0C\x30', 'SRC_TS': 1}
],
'PRIVATE_VOICE': [
],
'GROUP_DATA': [
],
'PRIVATE_DATA': [
]
}
}
# Import Bridging rules
#
try:
from bridge_rules import RULES
except ImportError:
sys.exit('Bridging rules file not found or invalid')
class bridgeIPSC(IPSC):

40
bridge_rules_SAMPLE.py Normal file
View File

@ -0,0 +1,40 @@
'''
The following is an example for your bridge_rules file. Note, all bridging is ONE-WAY!
Rules for an IPSC network indicate destination IPSC network for the Group ID specified
(allowing transcoding of the Group ID to a different value). Group IDs are specified
as hex strings.
The IPSC name must match an IPSC name from dmrlink.cfg.
The example below cross-patches TGID 1 on an IPSC network named "IPSC_FOO" with TGID 2
on an IPSC network named "IPSC_BAR".
THIS EXAMPLE WILL NOT WORK AS IT IS - YOU MUST SPECIFY NAMES AND GROUP IDS!!!
'''
RULES = {
'IPSC_FOO': {
'GROUP_VOICE': [
{'SRC_GROUP': b'\x00\x00\x01', 'DST_NET': 'IPSC_BAR', 'DST_GROUP': b'\x00\x00\x02'},
# Repeat the above line for as many rules for this IPSC network as you want.
],
'PRIVATE_VOICE': [
],
'GROUP_DATA': [
],
'PRIVATE_DATA': [
]
},
'IPSC_BAR:' {
'GROUP_VOICE': [
{'SRC_GROUP': b'\x00\x00\x02', 'DST_NET': 'IPSC_FOO', 'DST_GROUP': b'\x00\x00\x01'},
# Repeat the above line for as many rules for this IPSC network as you want.
],
'PRIVATE_VOICE': [
],
'GROUP_DATA': [
],
'PRIVATE_DATA': [
]
}
}

View File

@ -134,11 +134,11 @@ try:
})
if NETWORK[section]['LOCAL']['AUTH_ENABLED']:
# 0x1C - Voice and Data calls only, 0xDC - Voice, Data and XCMP/XNL
NETWORK[section]['LOCAL']['FLAGS'] = '\x00\x00\x00\x1C'
#NETWORK[section]['LOCAL']['FLAGS'] = '\x00\x00\x00\xDC'
#0x60 - 3rd Party App & Repeater Monitoring, 0x1C - Voice and Data calls only, 0xDC - Voice, Data and XCMP/XNL
NETWORK[section]['LOCAL']['FLAGS'] = '\x00\x00\x60\x1C'
#NETWORK[section]['LOCAL']['FLAGS'] = '\x00\x00\x60\xDC'
else:
NETWORK[section]['LOCAL']['FLAGS'] = '\x00\x00\x00\x0C'
NETWORK[section]['LOCAL']['FLAGS'] = '\x00\x00\x60\x0C'
if not NETWORK[section]['LOCAL']['TS1_LINK'] and not NETWORK[section]['LOCAL']['TS2_LINK']:
NETWORK[section]['LOCAL']['MODE'] = '\x65'