Tip of the day...

Cort N0MJS <n0mjs@...>

Thought I’d share this with you guys in case anyone is interested.

The K0USY group doesn’t use “channel based” linking, we use “contact based”. This is where you talk on the same TGID all of the time, and only use the other TGIDs for in-band signaling to tell confbridge/hb_confbridge to turn things on and off, etc.

This requires a pretty big list of “off” TGIDs be listed in the BRIDGES section of the confbridge_rules file. One of the reasons I left the rules file a python file instead of an intermediate syntax is to allow using actual python code in it as well. Think of this like the SCOM analog controllers where nearly everything is built on macros, as opposed to the ACC style, where everything is an individual command.

To make things easier for myself, I defined a python list of all of the TGIDs that I use on the linked timeslot (I only use one timeslot for linking). One place to keep track of them all – that’s the first line in the paste below.

Then I wrote a function (that’s the block of code that starts with “def”) that takes two lists as arguments. The first list is the big list of TGIDs I just made, and the second is a list of TGIDs I want removed. Because the only TGID I do not want to turn off a linked TGID is the TGID used to turn it on, I put that in the 2nd list. For example:

MARC Worldwide uses TGID 1 to trigger it on. If any other TGID is used (other than 9, where we run voice traffic) I want it to turn back off - in other words, I want the entire list of TGIDs minus TGID 1 to be the turn-off list. With me so far?

Then in the actual BRIDGES data structure, instead of having to copy big long lists of TGIDs and take out the one TGID to turn that bridge on, I insert the function call instead. You see this below as:

'OFF': exclude(K0USY_LINKED, [1])

Instead of

‘OFF’: [2,3,13,91,310,311,3105,3120,3129,3131,3140,31201,31203,31207,98006]

The best part is, that this extra code only runs once when the rules file is imported, so it takes no extra processing at runtime. Well, there it is, tip of the day. I hope it helps someone out there manage their rules file more easily. It sure does help me!

0x49 DE N0MJS

–––-begin paste–––-
K0USY_LINKED = [1,2,3,13,91,310,311,3105,3120,3129,3131,3140,31201,31203,31207,98006]

def exclude(tglist, exlist):
returnlist = tglist
for tgid in exlist:
returnlist = [tg for tg in returnlist if tg != tgid]
return returnlist

'MARC: Worldwide': [
{'SYSTEM': 'K0USY RPTRS', 'TS': 1, 'TGID': 9, 'ACTIVE': False, 'TIMEOUT': LINK_TIME_K0USY, 'TO_TYPE': 'ON', 'ON': [1], 'OFF': exclude(K0USY_LINKED, [1]), 'RESET': [9]},
–––-end paste–––-

Cort Buffington

Join main@DVSwitch.groups.io to automatically receive all group messages.