Re: ASL to DMR Bridge...changing talkgroups

Michael Weaver - AC2VK

I didn't get Mike Z's code working out of the box and haven't had time to troubleshoot his yet.  My setup allows you to enter *8711 and then the talkgroup number you want to connect to.  the extenstions.conf will strip off the leading 1 and pass the variable into  The python script will read the ini, update txTg, write the ini file(side effect of removing all comments), and restart the analog bridge.  Backup your ini file first!

871 = autopatchup,context=command_radio,noct=1,farenddisconnect=1,dialtime=20000,quiet=1

exten => _1X.,1,SayDigits(${EXTEN:1})
exten => _1X.,n,System(/scripts/ ${EXTEN:1})
exten => _1X.,n,Wait(2)
exten => _1X.,n,Hangup()
#!/usr/bin/env python
import sys
import socket
import struct
import os

#import parser
from ConfigParser import SafeConfigParser

#store cmd line arg
new_txTg = sys.argv[1]

#strip off first character
#new_txTg = new_txTg[1:]

#read config file
parser = SafeConfigParser()'/opt/Analog_Bridge/Analog_Bridge.ini')
print "Existing talkgroup is: " + parser.get('AMBE_AUDIO', 'txTg')
print "Desired talkgroup is: " + new_txTg
#set config file
parser.set('AMBE_AUDIO', 'txTg', new_txTg)
#writing our configuration file to
with open('/opt/Analog_Bridge/Analog_Bridge.ini', 'wb') as configfile:

print "New talkgroup is: " + parser.get('AMBE_AUDIO', 'txTg')

#restart bridge
os.system('systemctl restart analog_bridge')

Join to automatically receive all group messages.