DMRGateway-4 by VE3RD( This file should be used for reference and installation instructions ONLY
Please install DMRGateway-5
Comments are welcome addressed to ve3zrd@gmai.com)
This software is for use on amateur radio networks only and is to be used for educational purposes only.
Its use on commercial networks is strictly prohibited.
Copyright(C) 2017-2020 by Jonathan Naylor, G4KLX and others
Network 6 added, and 8 digit isolation Code added by VE3RD
---------------------------------------------------------------------------------------
Note added 2023-03-07
DMRGateway-4 will not work on a duplex hotspot in duplex mode. It will work fine in simplex mode. TS1/TS2 can not be used to switch networks but will allow two tg's on the same network.
The primary reason for using DMRGateway-4 is network isolation. Once a network and tg is selected, only that network & tg will be heard.
The pi-star DMRGateway has no network isolation such that if you activate Network 1, 3 4 and 5 then they will compete for access to the radio and you will get mutiple channel switching whenever breaks are heard on the respective talk groups(ie network scanning). The most common solution is to use the 4000 disconnect or switch the network to an unused TG (TGIF 4000), before leaving the network.
Menu for the DMRGateway configuration script (GWConfig)
1 "Create/Edit the DMRGateway Password File"
2 "Install DMRGateway & Update /etc/dmrgateway - Basic Mode"
3 "Install DMRGateway & Update /etc/dmrgateway - 8 Digit Translation Mode"
4 "Install DMRGateway & Update /etc/dmrgateway - 7 Digit Translation Mode"
5 "Install DMRGateway NO Config File Update"
6 "Restore Original DMRGateway Binary File"
7 "Quit")
BASIC INSTRUCTIONS
Item 1:
This will create and/or edit a password file. (Required for a new Install)
This is used to enable desired networks and allow an off line repostory for
the Network security codes
Item 2, 3 and 4 Common:
This will overwrite the /etc/dmrgateway file with a default version and
will compile a new Binary if required and
will install the New Binary DMRGateway File
Item 2
will proceed with a limited configuration Using Basic Mode
In the Radio CPS use basic 31665 for 31665 on the Server
Key on Tg 9001 to 9006 to select Network 1 to 6
This will allow the use of 7 digit talk groups
Item 3
will proceed with a limited configuration Using 8 Digit Translation Mode
In the Radio CPS use 14031665 for TG 31665 on Network 4 etc.
This will allow the use of 7 digit talk groups.
Item 4
will proceed with a limited configuration Using 7 Digit Translation Mode
In the Radio CPS use 4031665 for TG 31665 on Network 4 etc.
This is the same as the default Pi-Star gateway but will not allow
the use of 7 digit talk groups
Item 5:
will Ignore the existing Configuration File and
will Compile a new Binary if Required and
will Install the Binary File
Item 6:
will Restore the Original DMRGateway from /usr/local/bin/DMRGateway.orig
( If it exists )
CAUTION: This script can not possibly handle all users special situations
Use nano /etc/dmrgateway to check and configure what the script misses
-------------------------------------------------------------------------------------
Note 2021-06-19The Pi-Star update dated June 17, 2021 overwrites the DMRGateway Binary file with a Pi-Star Default.
Re-Running the ./binupdate.sh script in the DMRGatewa-4 directory will re-install DMRGateway-4 Binary
I have added a script in the DMRGateway-4 directory called GWConfig.sh That will help to install the DMRGateway and
Configure it according to information found in /etc/mmdvmhost.
Follow the instruction indicated below titled INSTALLATION of DMRGateway-4
Log Into Pi-Star via putty and SSH, then issue the following 4 commands
rpi-rw
sudo su
cd DMRGateway-4
./GWConfig #
//Where # is a digit from 0 to 9 representing a hotspot number
You will see a basic instruction page. Press any key to get the actual Menu
BASIC INSTRUCTIONS
Item 1: This will create and/or edit a password file. (Required for a new Install)
Item 2: This will overwrite the /etc/dmrgateway file with a default version and will proceed with a limited configuration and
will compile a new Binary if required and will install the Binary DMRGateway File
Item 3: This will Ignore the existing Configuration File and will Compile a new Binary if Required and will Install the Binary File
--------------------------------------------------------------------------------------
NOTE: 2021-06-09 This DMRGateway has been completely rewritten. If you are using a previous version the you must update as follows
Log in pi-star via SSH and type the commands as follows
rpi-rw
sudo su
cd DMRGateway-4
make clean
git pull
make clean
make
./binupdate.sh
// Say No to update /etc /dmrgateway
reboot
-------------------------------------------------------------------------------------
The Pi-Star DMRGateway Rules are explained at
https://github.com/g4klx/DMRGateway/wiki/Rewrite-RulesNote 1: READ EVERYTHING BEFORE DOING ANYTHINGNote 2: Unless you have a duplex hotspot running in duplex mode, DO NOT use TS1 in any rules.
MMDVMHOST will change TS1 to TS2 and you WILL have conflicting rules.
Note 3: Start with the Bare Basics Mode. Get any 2 Networks working and expand it in small Steps
Note 4: 7 Digit mode WILL NOT handle 7 digit talk Groups. Raw Mode and 8 Digit will handle 7 digit Talk Groups. (see below for 8 Digit Rule Set)
Basic: Basic mode requires the control codes 9001-9006 to select Basic Mode and the desired Network.This mode does not translate the TG Numbers. Ie: 31665 in the radio is sent to the server as 31665 and the return to the radio is also on 31665. The network is selected by keying up on TG 9001 to 9006 where 9001 selects Network 1 and 9004 selects Network 4. Therefore, to use Network 4, TG31665. Key up on 9004 then switch to 31665 and key up. This works much the same as the profiles in the Openspot. This mode will handle the 7 digit regular and personal talk group numbers
TRANSLATION: Translation Mode is selected by assigning an eight digit TG Number in your Radio begining with 11 to 16 to select the Network. This mode uses 8 digit TG numbers in the radio and the ReWrite rules translate the the 8 digit TG to a regular or basic TG . Ie: 14031665 in the radio will be translated to 31665 on Network 4 and sent to the server associated with Network 4. The server will respond on 31665 Network 4 and the ReWrite rules will translate it back to 14031665 to the Radio. This mode will normally only handle up to and including 6 digit talk group numbers. 7 Digit talk groups are handled with the following rule. Note: The 14 in 14031665 locks the gateway in to Network 4 so that this rule will work with 7 digit talk groups as follows
TGRewrite1=2,1000001,2,1000001,5599999
Translates as follows
Rewrite RF: 2:TG1000001-TG6599999 -> 2:TG1000001-TG6599999
TGRewrite0=2,1,2,1,9999999 ## in Basic Mode becomes
TGRewrite1=2,14000001,2,1,999999 ## in 8 Digit Translation Mode
Rewrite RF: 2:TG14000001-TG14999999 -> 2:TG1-TG999999
Note 5: When running the DMRGateway DO NOT make changes in the Pi-Star Configuration Page. It will very likely wipe out /etc/dmrgateway and replace it with a generic version. ALWAYS maintain a copy of /etc/dmrgateway
Note 6: The main reason for creating this version of the DMRGateway was to create the isolation between networks. This version will NOT allow any data to go to the radio that is not on the selected Network. Only one network can be active at anytime unlike the stock pi-star gateway that will allow multiple networks to send RF data at any given time and the radio can switch networks in the middle of a conversation.
Note 7: Please avoid the use of Network 3 of the DMRGateway-3 unless you are using one of the DMR2xxx crossovers.
Note 8: The Pi-Star Configuration Script that runs when you hit Apply Changes currently has over 4718 lines of code. This script is looking for BM on Net 1, DMR+ on Net2, HBLink or DMR2xx Crossovers on Net3. Any other use of these first 3 networks is just begging for trouble.
Note 8: An interesting effect that was not really planned but works just fine. If you want to use Basic Mode, you have two options to switch networks. Say you want to select network 4, You can
a) Select TG 9004 and key-up the switch to your desired TG
b) Select ANY 8 digit translation Mode TG, key-up, then switch to your basic mode TG
Networks are switched with the application of any tg 9001-9006, or any 8 digit TG
Note 9: Unlike the previous update on DMRGateway-3, This version handles the Basic and Translation Modes on a single configuration file.
Note 10:These two modes can be used independently using the appropriate Rewrite rule below. These modes can be used together with the addition of a Receiver Group for the low TG Number added to the higher TG Channel. For Every 8 Digit TG you program into your radio, put the equivalent basic mode TG into a Receiver Group in the higher numbered TG of the pair. ie for 14031665, program a receiver group of 31665 and program it into the channel for 14031665
Note 11: Some times when you load the /etc/dmrgateway file into the nano editor, you may see a reference at the bottom that it is loading a DOS file. This file has hidden line feeds and will not work correctly. You can fix this issue as follows
Press CTRL-X to save the file. Answer Y to the prompt then
Press ALT-D and enter and the file will be save without the hidden formatting characters
Note 12: It is highly recommended that this Install should all be done in an ssh session using putty. Especially due to Note 11 and cut and paste from here using a windows machine.
Note 13 If you want to run Brandmeister and/or DMR+, Set them up in the Pi-Star Configuration page before installing the DMRGateway and set The DMR Master server to DMRGateway.
--------------------------------------------------------------------------------------------------
INSTALLATION of DMRGateway-4 (NEW INSTALL)1) Log into Pi-Star with an SSH Session, preferably putty.
2) Issue the following commands
rpi-rw
sudo su
git clone
https://github.com/ve3rd/DMRGateway-4 cd DMRGateway-4
make clean
make
3) make will compile all the components of the gateway and create a single binary file DMRGateway
4) Install the new Binary by running the following script. The ./ are important
./binupdate.sh
5) Say Yes to the prompt to update /etc/dmrgateway. This will copy the default ./DMRGateway.ini file into the working file /etc/dmrgateway
6) the binupdate.sh script will stop the DMRGateway and replace the binary file in /usr/local/bin/
7) Edit /etc/dmrgateway with your pertinent information
--------------------------------------------------------------------------------------------------
UPDATE: Check for and Update Your DMRGateway-4 Version1) Log into Pi-Star with an SSH Session, preferably putty.
2) Issue the following commands
rpi-rw
sudo su
cd DMRGateway-4
make clean
git pull
3) This last command will either tell you that you are up to date or will download the newer version
4) If a newer version is downloaded you MUST issue the following commands to install it, this will not re-install or modify your config files
make clean
make
./binupdate.sh
5) Say No to the prompt to update /etc/dmrgateway
--------------------------------------------------------------------------------------------------
BARE BASICSNote if this is a new install, most of this will have been done for you, All you need to do is modify the /etc/dmrgateway file with your parameters, ie:
Radio frequencies, digital Id's, passwords and personal information
If you are modifying a stock Pi-Star DMRGateway, then most of the following will need to be performed
1) Cut and paste the following into your etc/dmrgateway file
item 1) above is optional Optional - It may Not be required for DMRGateway-4 as the Installation script (binupdate.sh) will create the file with most of the default settings. You should only need to edit /etc/dmrgateway for RF Frequency, Digital ID, Passwords and Personal Information.
2) Replace the ****** code with your own parameters.
3) Remove the comment lines that are marked ####
[General]
RptAddress=127.0.0.1
RptPort=62032
LocalAddress=127.0.0.1
LocalPort=62031
RuleTrace=1
#### The following StartNet rule is NEW and sets the Network you want to be on when the DMRGateway starts
StartNet=4
#### The following NetMode rule is NEW and sets the Mode you wish to Start in(0,7,8)
NetMode=0
Daemon=1
Debug=1
RFTimeout=5
NetTimeout=5
[Log]
DisplayLevel=0
FileLevel=2
FilePath=/var/log/pi-star
FileRoot=DMRGateway
[Voice]
Enabled=0
Language=en_US
Directory=/usr/local/etc/DMR_Audio
[Info]
Latitude=****
Longitude=******
Location=******
Description="CA"
URL=https://www.qrz.com/db/****
RXFrequency=******
TXFrequency=*******
Enabled=1
Power=1
Height=0
[XLX Network]
Enabled=0
Id=*****
Startup=000
File=/usr/local/etc/XLXHosts.txt
Port=62030
Password=passw0rd
ReloadTime=60
Slot=2
TG=6
Base=64000
Relink=60
Debug=0
UserControl=1
[DMR Network 1]
Enabled=1
Name=****** Your Selected BM Server
Id=*******01
Address=****** Your selected BM Server IP Address
Password=******
# This TGRewrite0 handles all tg's up to and including 7 digit
(7x9's)TGRewrite0=2,1,2,1,9999999
# This TGRewrite1 handles the 8 Digit control code TG;s to switch to this network
(6x9's)TGRewrite1=2,11000001,2,1,999999
PCRewrite0=2,11009990,2,9990,1
PCRewrite1=2,9990,2,9990,1
SrcRewrite0=2,9990,2,****,1
## Where **** is the call sign in your Radio
Port=62031
Local=62035
Location=0
Debug=0
[DMR Network 2]
Enabled=0
Name=DMR+_IPSC2-CAN-TRBO
Id=**********
Address=209.226.17.178
Password="PASSWORD"
Port=55555
# Basic Mode - Seven Digit TG's = seven 9's
TGRewrite0=2,1,2,1,9999999
# This TGRewrite0 handles the 8 Digit control code TG;s to switch to this network Six 9's
TGRewrite1=2,12000001,2,1,999999
[DMR Network 3]
Enabled=0
Name=HBLink
[DMR Network 4]
Enabled=1
Name=TGIF_Network
Address=tgif.network
Port=62031
Local=62038
Id=*******04
Password=**********
# Basic Mode handles tg 1 to 9999999
Seven 9'sTGRewrite0=2,1,2,1,9999999
# This TGRewrite1 handles the 8 Digit control code TG;s to switch to this network and up to 6 digit tg"s 1-999999
(Six 9's)TGRewrite1=2,14000001,2,1,999999
TGRewrite2=2,1,2,1,9999999 ### Use this rule in 8digit mode to handle 7 digit tg's
PCRewrite0=2,9990,2,9990,1
PCRewrite1=2,14009990,2,9990,1
SrcRewrite0=2,9990,2,YourCall,1
Location=0
Debug=1
###### Leave This disabled until you get Network 1 and 4 Running
[DMR Network 5]
Enabled=0
Name=MNet_Network
Address=mnet.hopto.org
Port=62031
Local=62039
# Basic Mode -7 Digit TG;s Seven 9's
TGRewrite0=2,1,2,1,9999999
# This TGRewrite1 handles the 8 Digit control code TG;s to switch to this network (Six 9's)
TGRewrite1=2,15000001,2,1,999999
PCRewrite0=2,15009990,2,9990,1
SrcRewrite0=2,9990,2,YourCall,1
Password=*************
Id=*******05
Location=0
Debug=1
#### The following Network 6 is ONLY available in the DMRGateway-4 by VE3RD
[DMR Network 6]
Enabled=0
Name=TGIF_Network
Address=tgif.network
Port=62031
Local=62037
Id=302395444
#Basic Mode
Seven 9's This will handle up to 7 digit tg's from 1 to 9999999
TGRewrite0=2,1,2,1,9999999
#Translation Mode -
Six 9's This will only handle tg;s from 1 to approximately 77600 depending on your radio
#The maximum theoretical TG number is 2^24=16777216 but some radios's won't go quite this high
TGRewrite0=2,16000001,2,1,999999
PCRewrite0=2,9990,2,9990,1
PCRewrite0=2,16009990,2,9990,1
SrcRewrite0=2,9990,2,YourCall,1
Password=passw0rd
Location=0
Debug=1
[GPSD]
Enable=0
Address=127.0.0.1
Port=2947
[APRS]
Enable=1
Address=127.0.0.1
Port=8673
Description=APRS for DMRGateway
Suffix=DMR
[Dynamic TG Control]
Enabled=1
Port=3769
___________________________________________________________
Special Instructions to handle 7 digit talk groups from a radio that will NOT Handle 7 Digits Using Basic Mode
Some radio's will not allow you to use 7 digit talk groups. ie: TYT MD420
In basic Mode use something like this to access a seven digit tg like 3023954
TGRewrite0=2,4354,2,3023954,1
This rule will translate TG4354 in the radio to 3023954 at the server and the response on 3023954 will come back to TG4354 in the radio.
This use of TG 4354 is strictly between your radio and hotspot, it will not affect any real world tg on 4354.
Just make sure that you do not use a number that corresponds to a real TG that you may plan to use in the future.
Check the server list and find a number that is not used
------------------------------------------------------------------------------------
PARROT ( May Not be Implemented Yet on the New TGIF Server )The call to the parrot on TGIF will be any of the following
Private or Group Call to 9990.
Private or Group Call to 31000
If you use a private call, make sure that is registered as a private call in your Contact List
If you use Translation mode the full 8 digit tg must be registered as a private call
The DMRGateway (Translation Mode) will convert the Radio Private Call on 14009990 to a Private Call on 9990 and send it to the server
The SrcRewrite Rule will trap the Private Call coming from the Server on 9990 send it to the radio via the call sign or digital ID assigned in the Radio
This works in both modes
On MNET, the Parrot uses a Group Call to 9999-----------------------------------------------------------------------------------------
INSTRUCTION to Restart the Gateway After Configuration changesIf for any reason you need to modify the /etc/dmrgateway configuration file for the DMRGateway you must issue the following command
sudo dmrgateway.service restart ; mmdvmhost.service restart
You can watch the log file as it starts up with the following command.
tail -f -n 100 /var/log/pi-star/DMRGateway-2021-04-27.log This is a date named file name that changes at midnight UTC. Replace the date with the current date file,
You can exit the log file with a ctrl-c
------------------------------------------------------------------------------------------
Contact Information
Phil VE3RD
ve3zrd@gmail.com
--------------------------------------------------------------------------------------------
If you have just read this file for the FIRST Time, READ IT AGAIN