User triggering of rules on/off being added

This would be PTT or UA for you c-Bridge dorks. It’s not done yet, but
it’s close. YOU MUST UPDATE YOUR BRIDGE RULES FILE IF YOU USE THIS
VERSION!!!
This commit is contained in:
Cort Buffington 2016-04-26 18:56:45 -05:00
parent 418757cfcd
commit 5010d9a5b7
2 changed files with 24 additions and 6 deletions

View File

@ -77,8 +77,10 @@ for _ipsc in RULES_FILE:
for _rule in RULES_FILE[_ipsc]['GROUP_VOICE']:
_rule['SRC_GROUP'] = hex_str_3(_rule['SRC_GROUP'])
_rule['DST_GROUP'] = hex_str_3(_rule['DST_GROUP'])
_rule['SRC_TS'] = _rule['SRC_TS'] - 1
_rule['DST_TS'] = _rule['DST_TS'] - 1
_rule['ON'] = hex_str_3(_rule['ON'])
_rule['OFF'] = hex_str_3(_rule['OFF'])
_rule['SRC_TS'] = _rule['SRC_TS'] - 1
_rule['DST_TS'] = _rule['DST_TS'] - 1
if _ipsc not in NETWORK:
sys.exit('ERROR: Bridge rules found for an IPSC network not configured in main configuration')
for _ipsc in NETWORK:
@ -156,6 +158,19 @@ class bridgeIPSC(IPSC):
elif _ts == 1:
_TS = 'TS2'
# Activate/Deactivate rules based on group voice activity -- PTT or UA for you c-Bridge dorks.
# This will ONLY work for symmetrical rules!!!
if _burst_data_type == BURST_DATA_TYPE['VOICE_TERM']: # Action happens on un-key
for rule in RULES[_network]['GROUP_VOICE']:
if _dst_group == rule['ON']:
rule['ACTIVE'] = True
#RULES[(rule[DST_NET])]['GROUP_VOICE'][_network]['ACTIVE'] = True
logger.info('(%s) Bridge Rule \"%s\" changed to state: %s', _network, rule['NAME'], rule['ACTIVE'])
if _dst_group == rule['OFF']:
rule['ACTIVE'] = False
#RULES[(rule[DST_NET])]['GROUP_VOICE'][_network]['ACTIVE'] = False
logger.info('(%s) Bridge Rule \"%s\" changed to state: %s', _network, rule['NAME'], rule['ACTIVE'])
now = time() # Mark packet arrival time -- we'll need this for call contention handling
for rule in RULES[_network]['GROUP_VOICE']:
@ -165,7 +180,7 @@ class bridgeIPSC(IPSC):
# Matching for rules is against the Destination Group in the SOURCE packet (SRC_GROUP)
#if rule['SRC_GROUP'] == _dst_group and rule['SRC_TS'] == _ts:
#if BRIDGES:
if (rule['SRC_GROUP'] == _dst_group and rule['SRC_TS'] == _ts) and (self.BRIDGE == True or networks[_target].BRIDGE == True):
if (rule['SRC_GROUP'] == _dst_group and rule['SRC_TS'] == _ts and rule['ACTIVE'] == True) and (self.BRIDGE == True or networks[_target].BRIDGE == True):
if RULES[_network]['TRUNK'] == False:
if ((rule['DST_GROUP'] != _status[_TS]['RX_GROUP']) and ((now - _status[_TS]['RX_TIME']) < RULES[_network]['GROUP_HANGTIME'])):
if _burst_data_type == BURST_DATA_TYPE['VOICE_HEAD']:

View File

@ -23,6 +23,10 @@ NOTES:
* TRUNK is a boolean set to True only for DMRlink to DMRlink IPSCs that need to move
multiple packet streams that may match the same TS - this essentially makes the
source,timeslot,talkgroup ID a tuple to indentify an arbitrary number of streams
* NAME is any name you want, but it MUST MATCH like group names in different groups
* ACTIVE should be set to True if you want the rule active by default
* ON and OFF are group IDs used to trigger this rule off and on. A reciprocal rule by
the same NAME will be enabled/disabled in the rules for DST_NET
'''
RULES = {
@ -30,10 +34,9 @@ RULES = {
'TRUNK': False,
'GROUP_HANGTIME': 5,
'GROUP_VOICE': [
{'SRC_TS': 1, 'SRC_GROUP': 1, 'DST_NET': 'IPSC_BAR', 'DST_TS': 2, 'DST_GROUP': 2},
{'NAME': 'STATEWIDE', 'ACTIVE': False, 'ON': 8, 'OFF': 9, 'SRC_TS': 1, 'SRC_GROUP': 1, 'DST_NET': 'IPSC_BAR', 'DST_TS': 2, 'DST_GROUP': 2},
# Send the IPSC_FOO network Time Slice 1, Talk Group 1 to the IPSC_BAR network on Time Slice 2 Talk Group 2
# Repeat the above line for as many rules for this IPSC network as you want.
],
'PRIVATE_VOICE': [
]
@ -42,7 +45,7 @@ RULES = {
'TRUNK': False,
'GROUP_HANGTIME': 5,
'GROUP_VOICE': [
{'SRC_TS': 2, 'SRC_GROUP': 2, 'DST_NET': 'IPSC_FOO', 'DST_TS': 1, 'DST_GROUP': 1},
{'NAME': 'STATEWIDE', 'ACTIVE': False, 'ON': 8, 'OFF': 9, 'SRC_TS': 2, 'SRC_GROUP': 2, 'DST_NET': 'IPSC_FOO', 'DST_TS': 1, 'DST_GROUP': 1},
# Send the IPSC_BAR network Time Slice 2, Talk Group 2 to the IPSC_FOO network on Time Slice 1 Talk Group 1
# Repeat the above line for as many rules for this IPSC network as you want.
],