Author Topic: 2021-05-02 - Brand New DMRGateway-4 Ready Now  (Read 600 times)

0 Members and 0 Guests are viewing this topic.

Offline VE3RD

  • Newbie
  • *
  • Posts: 36
  • Referrals: 0
2021-05-02 - Brand New DMRGateway-4 Ready Now
« on: May 01, 2021, 02:48:34 pm »

DMRGateway-4 by VE3RD

( This file will be edited/modified periodically as issues are identified... Comments are welcome addressed to ve3rd@rac.va)

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 2021-06-19
The 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.

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-Rules

Note 1: READ EVERYTHING BEFORE DOING ANYTHING

Note 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: This DMRGateway-4 Requires ONLY One Configuration File, to handle both Basic and Translation Mode

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 only handle up to and including 6 digit talk group numbers

TGRewrite0=2,1,2,1,9999999      ## in Basic Mode becomes
TGRewrite1=2,14000001,2,1,999999     ## in Translation Mode

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 Version
1) 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 BASICS

Note 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
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's
TGRewrite0=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
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-3 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 changes

If 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
ve3rd@rac.ca

--------------------------------------------------------------------------------------------
If you have just read this file for the FIRST Time,   READ IT AGAIN
« Last Edit: June 19, 2021, 06:02:43 pm by VE3RD »

Share on Facebook Share on Twitter


Offline KK4VOB

  • Newbie
  • *
  • Posts: 1
  • Referrals: 0
  • Call Sign: KK4VOB
Re: 2021-05-02 - Brand New DMRGateway-4 Ready Now
« Reply #1 on: May 04, 2021, 08:31:28 pm »
So far so good, It appears to be working fantastically! Thanks for this. :)

Offline Curt-KU8L

  • Newbie
  • *
  • Posts: 3
  • Referrals: 0
  • Call Sign: KU8L
Re: 2021-05-02 - Brand New DMRGateway-4 Ready Now
« Reply #2 on: May 06, 2021, 10:38:05 am »
Took a couple of reads because I don't use Linux often enough.  Got it all entered and it worked perfectly so far.  There is so much stale or plain incorrect info out there regarding the gateway, none of the samples worked for me--continued getting routine disconnects.  I am convinced it was all because the samples I used contained mismatched port assignments on 127.0.0.1 and they all had TS1 translation lines.  All seems to be good now....thanks Phil.


Offline Curt-KU8L

  • Newbie
  • *
  • Posts: 3
  • Referrals: 0
  • Call Sign: KU8L
Re: 2021-05-02 - Brand New DMRGateway-4 Ready Now
« Reply #3 on: May 06, 2021, 10:41:22 am »
Newbie question for Phil.

What drove the decision to use two digit Network assignment numbers (11-16) versus the (apparent common)  single digit (1-6) method?

Just curious..

TU

Offline VE3RD

  • Newbie
  • *
  • Posts: 36
  • Referrals: 0
Re: 2021-05-02 - Brand New DMRGateway-4 Ready Now
« Reply #4 on: May 06, 2021, 04:59:39 pm »
The trigger to go two digit numbers was the use of 7 digit talk groups on tgif. Example I needed to differentiate between a 7 digit tg 3023954 used on Net4 vs 3023954 which was tg 23954 on network 3 14031665 is not used as a TG and 3023954 is caught by the rewrite rule with 9999999 as a 7 digit TG

Offline Curt-KU8L

  • Newbie
  • *
  • Posts: 3
  • Referrals: 0
  • Call Sign: KU8L
Re: 2021-05-02 - Brand New DMRGateway-4 Ready Now
« Reply #5 on: May 06, 2021, 09:02:08 pm »
Thanks Phil..I see
Realized I wasn't quite good to go yet.  As long as I used Translation it seems to work on the simple test I made.

I really need to get the Basic method going since it seems easier for a large number of different TG's across two Networks.

I cannot get the HS to switch networks. 

I noticed a difference in the Net 1 and Net 4 config lines between what was created via the SSH install that I followed and the list posted for cut and paste above.  Much differences in the translation lines.  Perhaps something did not work properly for the SSH install.

So I cut and pasted just the two paragraphs for Network 1 and Network 4 where the differences were.  (the file from the ssh instal did not have the conversions for the 9xxx control inputs.

This is still no go.  I can see the radio sending the expected info but the HS wont switch.

Is there a config that needs to be in the pi-star Remote file to make this work???  Also should the 9xxx be group or private calls?   Running a Simplex HS Pi-star v 4.1.4 with latest updates.

If I force the system to switch to BM or TGIF, It seems to OK and I can see and talk with other stations.  The networks are never dropped like before.

Sorry for the perhaps basic questions....it seems so close to working.or your

Thanks Again for your work and help.

Curt  KU8L

Offline n0svc

  • Newbie
  • *
  • Posts: 3
  • Referrals: 0
  • Call Sign: n0svc
Re: 2021-05-02 - Brand New DMRGateway-4 Ready Now
« Reply #6 on: May 16, 2021, 02:17:56 pm »
Could I get a little clarification? I'm probably missing it your info.

Ok, for an example, my home hotspot is normally connected to 3 BM tg (not very active) on Net 1 and tgif on net 4. I keep my radio in promiscuous mode so I can listen to what ever is active. Sometimes I disconnect tgif so it doesn't interrupt a net on the a BM tg. With your system I could just key up tg 9001 and that would lockout the others. Ok, I think I got that so far. Now, how do I open it up to all networks again, whatever is active?

And kind of in the same area, if I key up an 8 digit tg, ie. 14031665, will that put it on net 4 only? or will that just switch net 4 to 31665 leaving the rest (other nets) active?

Offline N5UNB

  • Newbie
  • *
  • Posts: 3
  • Referrals: 0
  • Call Sign: N5UNB
Re: 2021-05-02 - Brand New DMRGateway-4 Ready Now
« Reply #7 on: May 27, 2021, 07:48:47 pm »
Eureka!!   With shrewd assistance from Phil, this now works on my TGIF 3.5" Hotspot!

The critical step I missed as a newby with DMR was the need to FIRST use the Pi-Star configuration page to set DMRGateway as the DMR Master!  Both TGIF and BM need to show at the bottom of the Pi-Star Dashboard page before all the programming Phil wrote can work.

I needed to do this BEFORE going into Putty and installing the DMRGateway-4 program and configuration files with the commands Phil provided.

Rookie error on my part. 

If you are struggling to get this to work, make sure you have DMRGateway setup as the DMR Master.  Along with your preferred BM Master, also on the Pi-Star configuration page.

Then don't make any changes on the Pi-Star Configuration page after you install DMRGateway-4.

Cheers.  And THANK YOU, Phil!

Offline ve3ny

  • Newbie
  • *
  • Posts: 2
  • Referrals: 0
Re: 2021-05-02 - Brand New DMRGateway-4 Ready Now
« Reply #8 on: May 29, 2021, 08:46:33 am »
Hello Phil,

Is this the right syntax for the DMR2YSF crossover stanza? I just cut and pasted the stanza from the standard DMRGateway.ini.

Tom VE3NY


[DMR Network 3]
Enabled=0
Name=DMR2YSF_Cross-over
Id=302328403
Address=127.0.0.1
Port=62033
Local=62034
TGRewrite0=2,7000001,2,1,999998
SrcRewrite0=2,1,2,7000001,999998
PCRewrite0=2,7000001,2,1,999998
Password="PASSWORD"
Location=0
Debug=0

Offline VE3RD

  • Newbie
  • *
  • Posts: 36
  • Referrals: 0
Re: 2021-05-02 - Brand New DMRGateway-4 Ready Now
« Reply #9 on: June 08, 2021, 08:43:54 am »
That looks like the default stanza created by Pi-Star when you set the DMR2YSF Mode
This WILL NOT work with my DMRGateway-4
Try This

[DMR Network 3]
Enabled=1
Name=DMR2YSF_Cross-over
Id=?????????
Address=127.0.0.1
Port=62033
Local=62034
##Translation Mode
TGRewrite0=2,13000001,2,1,999998
Password="PASSWORD"
Location=0
Debug=0

or
##Basic Mode
TGRewrite0=2,1,2,1,999998

« Last Edit: June 08, 2021, 08:55:45 am by VE3RD »

 

Related Topics

  Subject / Started by Replies Last post
14 Replies
622 Views
Last post February 07, 2019, 03:35:12 pm
by VE3RD
3 Replies
173 Views
Last post March 09, 2019, 05:47:22 pm
by NR1X
2 Replies
85 Views
Last post November 23, 2020, 06:54:15 am
by N1JWW
3 Replies
165 Views
Last post May 25, 2021, 04:32:55 pm
by N5UNB
0 Replies
69 Views
Last post June 07, 2021, 10:19:50 am
by VE3RD