Topics

Tip of the day...

Cort 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

BRIDGES = {
'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
785-865-7206

JJ Cummings
 

Cort - Nice example that got me thinking!  Here is another example of what one might do to manage larger TG lists if you still want things done per TG etc.... Note that this is a simple example and does _NOT_ account for different TO_TYPE values but could be trivially modified to do such dynamically through the BuildBridges function or just define the custom values by updating the dict later on, like in the below example.

----BEGIN SNIP----

TS1_TGS = [310815,31088,31087]
SYSTEMS = ['MMDVM', 'MOTOTRBO', 'BRANDMEISTER']

def BuildBridges(ts,tgids,systems):
    BRIDGE = {}
    for tgid in tgids:
        export_dict = []
        for system in systems:
            export_dict.append({'SYSTEM': system, 'TS': ts, 'TGID': tgid, 'ACTIVE': True, 'TIMEOUT': {}, 'TO_TYPE': 'NONE',  'ON': [], 'OFF': [], 'RESET': []})
        TMPBRIDGE = {tgid:export_dict}
        BRIDGE.update(TMPBRIDGE)
    return BRIDGE

BRIDGES = BuildBridges(1,TS1_TGS,SYSTEMS)
BRIDGES.update(BuildBridges(2,[311,310,3100,3108],SYSTEMS))
BRIDGES.update({'BM-TAC312': [
           {'SYSTEM': 'BRANDMEISTER',    'TS': 2, 'TGID': 312, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [], 'OFF': [1312], 'RESET': []},
            {'SYSTEM': 'MMDVM',    'TS': 2, 'TGID': 312, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [], 'OFF': [1312], 'RESET': []},
            {'SYSTEM': 'IPSC_TS2',    'TS': 2, 'TGID': 312, 'ACTIVE': True, 'TIMEOUT': 5, 'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []}
        ]})

if __name__ == '__main__':
    from pprint import pprint
    pprint(BRIDGES)

----END SNIP----


On Thu, Nov 29, 2018 at 2:02 PM Cort N0MJS via Groups.Io <n0mjs=me.com@groups.io> wrote:
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

BRIDGES = {
    '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
785-865-7206




JJ Cummings
 

I also had a thing that I didn't need in there:

Remove the TMPBRIDGE and change BRIDGE to:
        BRIDGE.update({tgid:export_dict})

in the BuildBridges function


On Fri, Nov 30, 2018 at 12:12 PM JJ Cummings via Groups.Io <cummingsj=gmail.com@groups.io> wrote:
Cort - Nice example that got me thinking!  Here is another example of what one might do to manage larger TG lists if you still want things done per TG etc.... Note that this is a simple example and does _NOT_ account for different TO_TYPE values but could be trivially modified to do such dynamically through the BuildBridges function or just define the custom values by updating the dict later on, like in the below example.

----BEGIN SNIP----

TS1_TGS = [310815,31088,31087]
SYSTEMS = ['MMDVM', 'MOTOTRBO', 'BRANDMEISTER']

def BuildBridges(ts,tgids,systems):
    BRIDGE = {}
    for tgid in tgids:
        export_dict = []
        for system in systems:
            export_dict.append({'SYSTEM': system, 'TS': ts, 'TGID': tgid, 'ACTIVE': True, 'TIMEOUT': {}, 'TO_TYPE': 'NONE',  'ON': [], 'OFF': [], 'RESET': []})
        TMPBRIDGE = {tgid:export_dict}
        BRIDGE.update(TMPBRIDGE)
    return BRIDGE

BRIDGES = BuildBridges(1,TS1_TGS,SYSTEMS)
BRIDGES.update(BuildBridges(2,[311,310,3100,3108],SYSTEMS))
BRIDGES.update({'BM-TAC312': [
           {'SYSTEM': 'BRANDMEISTER',    'TS': 2, 'TGID': 312, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [], 'OFF': [1312], 'RESET': []},
            {'SYSTEM': 'MMDVM',    'TS': 2, 'TGID': 312, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [], 'OFF': [1312], 'RESET': []},
            {'SYSTEM': 'IPSC_TS2',    'TS': 2, 'TGID': 312, 'ACTIVE': True, 'TIMEOUT': 5, 'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []}
        ]})

if __name__ == '__main__':
    from pprint import pprint
    pprint(BRIDGES)

----END SNIP----

On Thu, Nov 29, 2018 at 2:02 PM Cort N0MJS via Groups.Io <n0mjs=me.com@groups.io> wrote:
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

BRIDGES = {
    '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
785-865-7206




Cort N0MJS
 

You got it!

So the next question someone is going to have is “why didn’t you just do something cool like JJ did and not make us write python”? Because a lot of different systems will work differently. I never came up with a reasonable configuration parser that captured all of the possibilities of that file format without being equally difficult to manage. The only solution would have been to pick a subset of possible paradigms and then force users to pick one. That’s the exact opposite of my goals with these programs.

Thanks for looking at what I posted and coming up with your own solution JJ, that’s what this is all about!

0x49 DE N0MJS

On Nov 30, 2018, at 1:12 PM, JJ Cummings <cummingsj@...> wrote:

Cort - Nice example that got me thinking!  Here is another example of what one might do to manage larger TG lists if you still want things done per TG etc.... Note that this is a simple example and does _NOT_ account for different TO_TYPE values but could be trivially modified to do such dynamically through the BuildBridges function or just define the custom values by updating the dict later on, like in the below example.

----BEGIN SNIP----

TS1_TGS = [310815,31088,31087]
SYSTEMS = ['MMDVM', 'MOTOTRBO', 'BRANDMEISTER']

def BuildBridges(ts,tgids,systems):
    BRIDGE = {}
    for tgid in tgids:
        export_dict = []
        for system in systems:
            export_dict.append({'SYSTEM': system, 'TS': ts, 'TGID': tgid, 'ACTIVE': True, 'TIMEOUT': {}, 'TO_TYPE': 'NONE',  'ON': [], 'OFF': [], 'RESET': []})
        TMPBRIDGE = {tgid:export_dict}
        BRIDGE.update(TMPBRIDGE)
    return BRIDGE

BRIDGES = BuildBridges(1,TS1_TGS,SYSTEMS)
BRIDGES.update(BuildBridges(2,[311,310,3100,3108],SYSTEMS))
BRIDGES.update({'BM-TAC312': [
           {'SYSTEM': 'BRANDMEISTER',    'TS': 2, 'TGID': 312, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [], 'OFF': [1312], 'RESET': []},
            {'SYSTEM': 'MMDVM',    'TS': 2, 'TGID': 312, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [], 'OFF': [1312], 'RESET': []},
            {'SYSTEM': 'IPSC_TS2',    'TS': 2, 'TGID': 312, 'ACTIVE': True, 'TIMEOUT': 5, 'TO_TYPE': 'NONE', 'ON': [], 'OFF': [], 'RESET': []}
        ]})

if __name__ == '__main__':
    from pprint import pprint
    pprint(BRIDGES)

----END SNIP----

On Thu, Nov 29, 2018 at 2:02 PM Cort N0MJS via Groups.Io <n0mjs=me.com@groups.io> wrote:
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

BRIDGES = {
    '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
785-865-7206





Cort Buffington
785-865-7206