DMR Rewrite Rules
Contents:
- Introduction
- What are Rewrite Rules?
- The dmrgateway file
- DMR Network 1 Stanza
- The 2,9,2,9,1 Rule
- The Simplex Hotspot
- Example One - Accessing VKDMR via FreeDMR Server
- Example Two - More use of Statics
- References
[Top][Home]
Introduction
This is a discussion about Rewrite Rules as it applies to FreeDMR. It is a key part
of the DMRGateway which is only a part of a much larger subject on configuration of the
Multi Mode Digital Voice Modem (MMDVM) application. The MMDVM firmware was developed by
Jonthan Naylor G4KLX. A history of the MMDVM's development by Glenn VK4NGA can be found
here: The MMDVM Story
I place considerable importance on open system. The source code for the MMDVM firmware can be found
here: https://github.com/g4klx. This is the firmware code that
runs on the MMDVM board that sits on top of the Raspberry Pi and talks to it through the GPIO's via a
simple serial port. Most interface to this board via Pi-Star or similar applications running on the
Raspbery Pi or other ARM processor.
[Top][FreeDMR]
What are Rewrite Rules?
Are you confused about TG and TS and how they magically swap around? If you watch the FreeDMR dashboard you
will see that while you are transmitting on TS 2, some stations will receive you on TS2 while others on TS 1.
Even TG can magically swap. You can transmit on TG9 and come out on TG5050 on the network and therefore other
repeaters, but still be on TG9 on your local repeater.
All this is done, transparently by the Rewrite Rules. They are condigured on Hotspots, MMDVM Repeaters,
and Servers.
Here is a description of Rewrite Rules in Jonthan Naylor's own words:
"This software [DMR Gateway] works by use of powerful rewriting rules which allow for changes in the slot,
talk group, the type, and even the destination, of the messages. Without a rewrite rule, even if it does
no actual rewriting, traffic will not be passed through from that defined network to the MMDVM and back again."
Source:https://github.com/g4klx/DMRGateway#readme
Rewrire Rules are defined thus:
TGRewrite=fromSlot,fromTG,toSlot,toTG,range
TypeRewrite=fromSlot,fromId,toSlot,toId
The Rewrite Rules can be found in Pi-Star applicatio in the /etc/dmrgateway file.
A full explaination of Rewrite Rules can be fornd here:
https://github.com/g4klx/DMRGateway/wiki/Rewrite-Rules
[Top][FreeDMR]
The dmrgateway file
The /etc/dmrgateway and can be accessed directly on the Raspbery Pi or via the Pi-Star menu:
Configuration-->Expert mode-->full edit DMG GW
Select the menu under the full editor as the
top line menu is in GUI form, where as the full editor show in textual form.
As an example, this is a copy of the dmrgateway from my simplex hotspot:
It contains eleven stanzas. Of particular interest are the three DMR Network stanzas.
[Top][FreeDMR]
DMR Network 1 Stanza
[DMR Network 1]
Parameter | value | Function | Comment |
Enabled | 1 | Enabled for use | |
Address | 87.117.229.173 | ldp see Label_Distribution_Protocol | |
Port | 62031 | Port in use | |
TGRewrite0 | 2,9,2,9,1 | fromSlot,fromTG,toSlot,toTG,range | Translates one talk group ID to another, and to alter the time slot |
PCRewrite0 | 2,94000,2,4000,1001 | fromSlot,fromID,toSlot,toID,range | Same as TGRewrite but only operates on private calls |
TypeRewrite0 | 2,9990,2,9990 | fromSlot,fromID,toSlot,toID | Maps a group call to a private call. |
SrcRewrite0 | 2,4000,2,9,1001 | fromSlot,fromID,toSlot,toTG,range | Rewrite the source/from Talk Group ID to another ID |
PassAllPC0 | 1 | PassAllPC=Slot | Passes all private calls without rules |
PassAllTG0 | 1 | PassAllTG=Slot | Passes all talk groups without rules |
PassAllPC1 | 2 | ditto | |
PassAllTG1 | 2 | ditto | |
Password | "passw1rd" | Password to access this network | |
Debug | 0 | Set the Debug Level | |
Location | 1 | |
[Top][FreeDMR]
The 2,9,2,9,1 Rule
Why have a rules that says On TS2 TG9 send my traffic to TS2 TG9?
The reason is thhat NO traffic is sent without a rule.
[Top][FreeDMR]
The Simplex Hotspot
Rewrite Rules are essencial to the operation of the simplex hotspot as
as a simplex hotspot only one transmitter dedicated TS2. There is no TS1.
The hotspot only sends TS2. Assignment of talk groups to time slots is
something done at the repeater/hotspot level and does not propagate beyond that
level (just as "color code" is only used between your radio and the
hotspot/repeater).
Only the talk group number has meaning to the master servers. ---- IS THIS TRUE?
[Top][FreeDMR]
Example One - Accessing VKDMR via FreeDMR Server
In this example a "Rewrite Rules" using FreeDMR directly and not though DMRGateway.
All VKDMR talkgroups are entered as static.
Color Code:
- Magenta is the default for Dial a Talkgroup from UK and seems to work fine testing about 10 WW talkgroups
- Blue is to let Group Call 9990 Echo Pass
- Yellow shows what is static on slot 1
- Green shows what the default Dial a TG is set as
# DMR+_IPSC2-Australia, VKDMR Network
[DMR Network 2]
Enabled=1
Address=103.93.139.189
Port=55555
TGRewrite=2,8,2,9,1
TGRewrite=2,505,2,505,1
TGRewrite=1,3801,1,3801,9
TGRewrite=2,9990,2,9990,1
TGRewrite=1,3809,1,3809,1
TGRewrite=1,3810,1,3810,1
TGRewrite=1,1,1,1,1
TGRewrite=1,3,1,3,1
TGRewrite=1,8,1,8,1
TGRewrite=1,5,1,5,1
TGRewrite=1,13,1,13,1
TGRewrite=1,113,1,113,1
TGRewrite=1,123,1,123,1
TGRewrite=1,310,1,310,1
TGRewrite=1,133,1,133,1
TGRewrite=1,153,1,153,1
Password=PASSWORD
Debug=0
Id=505xxx
Name=DMR+_IPSC2-Australia
Options="TS2_1=505"
# Australia-3 ID-5053 Open Bridge Server, VK4RDB, Mt Cotton, Brisbane
[DMR Network 3]
Enabled=1
Name=FreeDMR Australia
Address=hot.vkfreedmr.org
Port=62031
TypeRewrite=2,80,2,80,9909
TypeRewrite=2,9991,2,9991,16767223
TGRewrite=2,9,2,9,1
TGRewrite=1,9990,1,9990,1
TGRewrite=1,505,1,505,1 # Radios should add as channel on Slot 1
TGReWrite=1,5050,1,5050,1
PassAllPC=1
PassAllPC=2
Password=passw0rd
Debug=0
Id=505xxx
# Options=”TS1=505,5050;DIAL=530;TIMER=10;VOICE=0;”
Location=0
[Top][Home]
Example Two - More use of Statics
# DMR+_IPSC2-Australia, VKDMR Network
[DMR Network 2]
Enabled=1
Address=43.245.72.66
Port=55555
TGRewrite=2,8,2,9,1
TGRewrite=1,3801,1,3801,1
TGRewrite=1,3802,1,3802,1
TGRewrite=1,3803,1,3803,1
TGRewrite=1,3804,1,3804,1
TGRewrite=1,3805,1,3805,1
TGRewrite=1,3806,1,3806,1
TGRewrite=1,3807,1,3807,1
TGRewrite=1,3808,1,3808,1
TGRewrite=1,3809,1,3809,1
TGRewrite=1,3810,1,3810,1
TGRewrite=1,1,1,1,1
TGRewrite=1,3,1,3,1
TGRewrite=1,5,1,5,1
TGRewrite=1,8,1,8,1
TGRewrite=1,13,1,13,1
TGRewrite=1,30,1,30,1
TGRewrite=1,53,1,53,1
TGRewrite=1,80,1,80,1
TGRewrite=1,113,1,113,1
TGRewrite=1,123,1,123,1
TGRewrite=1,133,1,133,1
TGRewrite=1,143,1,143,1
TGRewrite=1,153,1,153,1
TGRewrite=1,310,1,310,1
TGRewrite=1,320,1,320,1
TGRewrite=1,321,1,321,1
TGRewrite=2,505,2,505,1
TGRewrite=1,530,1,530,1
TGRewrite=1,1911,1,1911,1
TGRewrite=1,2351,1,2351,1
TGRewrite=1,3117,1,3117,1
TGRewrite=1,3155,1,3155,1
TGRewrite=1,3167,1,3167,1
TGRewrite=1,3191,1,3191,1
TGRewrite=1,3199,1,3199,1
TGRewrite=1,8406,1,8406,1
TGRewrite=1,8409,1,8409,1
TGRewrite=1,8454,1,8454,1
TGRewrite=1,8509,1,8509,1
TGRewrite=1,8540,1,8540,1
TGRewrite=1,8555,1,8555,1
Password="PASSWORD"
Debug=0
Id=505xxx
Location=0
Name=DMR+_IPSC2-Australia
Options="StartRef=4000;RelinkTime=15;UserLink=1;TS1_1=9;TS2_1=505;"
# Australia-3 ID-5053 Open Bridge Server, VK4RDB, Mt Cotton, Brisbane
[DMR Network 3]
Enabled=1
Name=FreeDMR Australia
Address=hot.vkfreedmr.org
Port=62031
TypeRewrite=2,80,2,80,9909
TypeRewrite=2,9991,2,9991,16767223
TGRewrite=2,9,2,9,1
TGRewrite=1,9990,1,9990,1
TGRewrite=2,9990,2,9990,1
TGRewrite=1,302,1,302,1
TGRewrite=1,505,1,505,1
TGRewrite=1,913,1,913,1
TGRewrite=1,969,1,969,1
TGRewrite=1,970,1,970,1
TGRewrite=1,973,1,973,1
TGRewrite=1,2350,1,2350,1
TGRewrite=1,3100,1,3100,1
TGRewrite=1,5050,1,5050,1
TGRewrite=1,5052,1,5052,1
TGRewrite=1,5055,1,5055,1
TGRewrite=1,5056,1,5056,1
TGRewrite=1,50599,1,50599,1
TGRewrite=1,50510,1,50510,1
TGRewrite=1,50595,1,50595,1
TGRewrite=1,50556,1,50556,1
PassAllPC=1
PassAllPC=2
Password=passw0rd
Debug=0
Id=505xxx
Options=”TS1=505,5050;DIAL=530;TIMER=10;VOICE=0;”
Location=0
[Top][FreeDMR]
References
https://tgifnetwork.createaforum.com/new-board/the-pi-star-gateway-function-demystified/
https://forum.pistar.uk/viewtopic.php?f=5&t=2287#p11311https://forum.pistar.uk/viewtopic.php?f=5&t=2730
https://forum.pistar.uk/viewtopic.php?f=5&t=2730
[Top][FreeDMR]
Glenn Lyons VK4PK
glenn@LyonsComputer.com.au
Ver:gnl20230310 - pre published v0.9