Draft DVSwitch Install notes



CETTE PROCEDURE A ETE CHANGE PARLE SCRIPT DVSwitch-System-Builder disponnible dans le git repository .



Seulement a ajouter Hblink avec la commande pour obtenir un Gateway DMR ( BM) a Allstar



git clone -b HB_Bridge https://github.com/n0mjs710/HBlink.git


faire les tests et la configuration


RA 2018-09-19





DVSwitch is a collection of software and hardware modules to connect AllStarLink to a DMR network via IPSC. DVSwitch (DVS) can connect to a c-Bridge based network (DMR-MARC, DCI) or a BrandMeister Network. The basic configuration of DVS is contained in the document DVSwitchDiagram.pdf. ( http://dvswitch.org/files/DVSwitch/) DVS uses software and hardware from DVSwitch (DVS), DMRlink(DMRl), NWDigital (NWD) Hblink ( HBL)and AllStarLink (ASL). Each module is configured and operates separately. UDP data is used for communication between modules. This does allow the modules to be spread across multiple hosts. That type of configuration is outside the scope of this document. We will configure each module and verify proper operation of each module before moving on to the next. I am using a HP T610 with 16 gB SSD to test the system. . If you are not comfortable operating in a Linux environment, stop now. This is not for you. We will be using DIAL Installation of AllStarLink . All the scripts and downloaded programs are in the /srv directory. Some will be copied to other directories during installation. . You can download the image at http://tinyurl.com/x86-DIAL and use the procedure at https://github.com/N4IRS/AllStar/wiki/Debian-Installation-(for)-Allstar-Link-DIAL

If the install does not work try installing Debian Jessie stand alone . Then install git with the command apt-get install git . Then download Asterisk and install from source with the command git clone https://github.com/AllStarLink/DIAL.git then follow the instructions in README.md


I will start with the hardware. For this document we are going to use a HP T610 Flexible Thin Client
and a DV3000u (DV) from NWD. The DV is a Vocoder. It's job is to take AMBE data and convert it to analog (PCM) and PCM to AMBE. The DV we will use is a USB device. It simply plugs into a USB port on the Pi. Communications from the Pi to the DV is serial. Our first task is to connect the DV to the Pi and ensure proper communications. I will use Python scripts from NWD to test communications to and from the DV.

Install and test the DV3000

1: Make sure your installation of ALLStarLink is complete and up to date.
2: Execute
apt-get update and apt-get upgrade -y . should not make any change
3: I usually reboot after a upgrade, just habit on a new system. Execute
reboot
4: Plug the DV into a USB port on the PC.
5: Verify the DV has been recognized by the PC. You should have a device in /dev. The device is ttyUSBx. You can verify this by executing
ls /dev/ttyUSB* before and after plugging in the DV. If you already have something else using ttyUSB0, the DV will become ttyUSB1.
 6: We now need the python test scripts from NWD. There is a the test script AMBEtest4.py
in the to the Analog_Bridge repository.
 7: Checkout Analog_Bridge
from github. Execute cd /srv Then execute git clone https://github.com/N4IRS/Analog_Bridge.git
 8: The python test script needs one additional python module to run. Execute
apt-get install python-serial to install the python-serial module. And execute apt-get install git to install git
 9: Go to the /srv/Analog_Bridge/DV3000 directory. Execute
cd  /srv/Analog_Bridge/DV3000 . Executing a ls will show you the test script, AMBEtest4.py.
10: Execute
python AMBEtest4.py -v -n -s /dev/ttyUSB0





Your output should look like this. Important data is in bold.

=====================================================================

# python AMBEtest4.py -v -n -s /dev/ttyUSB0
Setting ...
/dev/ttyUSB0
d
8
N
1
False
False
False


Followed by all the test scrolling fast and ending with


Testing Encode PCM

Test result: Success (61000b010148dfe7a27577147c87bb)

Error count = 0

#
=====================================================================
If you do not receive the data in bold, STOP !!! Without communications to and from the DV, you can go no further. Leave the DV connected, we will need it for the next module.
This concludes testing communications with the DV.











Install and test Analog_Bridge

Analog_Bridge receives AMBE data from HB_Bridge, formats the AMBE and sends it to the DV. The DV "converts" the AMBE to PCM and returns it to Analog_Bridge. The PCM is then sent to ASL. The same is true in the other direction.
 
  1: Analog_Bridge is a program specific to the platform (processor) you are running. We are running a PC so we need the the x32 version of Analog_Bridge.

  2: Execute cd /srv/Analog_Bridge
  3: Create the destination directory by executing mkdir -p /opt/Analog_Bridge
  4: Copy the proper version of Analog_Bridge to the destination directory. Execute cp Analog_Bridge.x32 /opt/Analog_Bridge/ Analog_Bridge
  5: Copy the Analog_Bridge configuration file to the destination directory. Execute cp Analog_Bridge.ini /opt/Analog_Bridge
  6: Change directory to the Analog_Bridge directory. Execute cd /opt/Analog_Bridge
  7: Execute ls to see the 2 files are in the Analog_Bridge directory
  8: Edit
Analog_Bridge.ini Add ; ( Comments) in front of the following lines


In the [AMBE_AUDIO] section

Change ambesize to 72

Change the TG and TS to what you will be using

I am using TG9 TS1 for the bridge from MMDVm to ASL

Also change the gatewayDmrId and the repeaterID to your DMRID

in the [DV3000] section add ; ( Comment ) to the lines

server = 127.0.0.1 becomes ; server = 127.0.0.1

port = 2460 becomes ; port= 2460

remove the ; (comment) in front of the following lines

;server = /dev/ttyUSB0 becomes server = /dev/ttyUSB0

;port = 460800 becomes port = 460800

;serial = true . become serial = true

DO NOT LEAVE space in front of any lines


  9: Run Analog_Bridge
in the foreground by executing ./Analog_Bridge Analog_Bridge.ini

Your output should look like this. Important data is in
bold.

=====================================================================


# ./ Analog_Bridge
Analog_Bridge.ini
Analog_Bridge - Version 20170607

Setting [GENERAL] logLevel -> 2

Setting [GENERAL] outputAudioDevice -> /dev/null

Setting [GENERAL] inputAudioDevice -> /dev/null

Setting [GENERAL] decoderFallBack -> false

Setting [GENERAL] useMicrophone -> false

Setting [GENERAL] useVox -> false

Setting [GENERAL] voxDecay -> 2

Setting [GENERAL] voxTrigger -> 200

Setting [AMBE_AUDIO] server -> 127.0.0.1

Setting [AMBE_AUDIO] fromDMRPort -> 31000

Setting [AMBE_AUDIO] toDMRPort -> 31003

Setting [AMBE_AUDIO] ambeSize -> 72

Setting [AMBE_AUDIO] minTxTimeMS -> 200

Setting [AMBE_AUDIO] gatewayDmrId -> 3022387

Setting [AMBE_AUDIO] repeaterID -> 302236

Setting [AMBE_AUDIO] txTg -> 9

Setting [AMBE_AUDIO] txTs -> 1

Setting [AMBE_AUDIO] colorCode -> 1

Setting [USRP] server -> 127.0.0.1

Setting [USRP] toASLPort -> 32001

Setting [USRP] fromASLPort -> 34001

Setting [USRP] aslAudio -> AUDIO_USE_AGC

Setting [USRP] agcGain -> -20

Setting [USRP] dmrAudio -> AUDIO_UNITY

Setting [USRP] DVSain -> 0.35

Setting [DV3000] server -> /dev/ttyUSB0

Setting [DV3000] port -> 460800

Setting [DV3000] serial -> true

ioctl reset error

ioctl speed error

ioctl stereo error

ioctl setfmt error

Audio In/Out Device: /dev/null

Open UDP listener on 127.0.0.1:31000

Open USRP on 127.0.0.1:32001

Connecting to DV3000 hardware......

Begin DV3000 decode

Using hardware AMBE decoder

Starting Analog_Bridge --> USRP thread

Open UDP listener on 127.0.0.1:34001

Starting USRP --> HB_Bridge thread


=====================================================================
If you do not receive the data in
bold, STOP !!!  Analog_Bridge is not communicating with the DV, you can go no further.

These lines tell you how Analog_Bridge
is communicating with the DV.
Setting [DV3000] server -> /dev/ttyUSB0 <--- USB Device name
Setting [DV3000] port -> 460800 <--- baud rate
Setting [DV3000] serial -> true <--- We are communicating serial

This concludes testing Analog_Bridge.



























Install and test hbink / HB_Bridge

The two python programs, hblink.py and HB_Bridge.py are used to communicate with the HB network. In simple terms, hblink.py connects to the master and passes AMBE data to HB_Bridge.py (Don't shoot me Cort!)
You need both programs, but they can be tested separately. This makes troubleshooting much easier.

   1: Checkout DMRlink from github. Execute cd /srv Then execute git clone https://github.com/n0mjs710/DMRlink.git These steps are needed to install all the working guts of the IPSC and hblink programs

   2: Execute cd /srv/DMRlink
  
3: DMRL includes a install script that will install required Python modules, create the destination directory in /opt and copy the needed files.
   4: Execute
cd /srv/DMRlink
   5: Execute
./mk-dmrlink
  
6: Execute the following command to install hblink and HB_Bridge

Execute cd /srv

Execute git clone -b HB_Bridge https://github.com/n0mjs710/HBlink.git


   7: Change to the /srv/HBlink
directory. Execute cd /srv/HBlink
   8: We need a configuration file for hblink.py Execute
cp hblink-SAMPLE.cfg hblink.cfg
 
  9: For testing purposes, we want to log output to go to the console (screen)
 10: Edit the following lines in hblink.cfg
 11: In the [MASTER1] section Change PORT to 62031
 12: In the [MASTER1] section Change PASSPHRASE to passw0rd

 13: Save your work
 14 Execute
python hblink.py

Your output should look like this.

=====================================================================


# python hblink.py
root@repeater:/srv/HBlink# python hblink.py

DEBUG 2017-06-29 22:18:50,552 Logging system started, anything from here on gets logged

INFO 2017-06-29 22:18:50,552 HBlink 'HBlink.py' (c) 2016 N0MJS & the K0USY Group - SYSTEM STARTING...

DEBUG 2017-06-29 22:18:50,553 (MASTER-1) Master maintenance loop started

DEBUG 2017-06-29 22:18:50,554 MASTER instance created: MASTER-1, <__main__.HBSYSTEM instance at 0xb653e56c>

DEBUG 2017-06-29 22:18:55,555 (MASTER-1) Master maintenance loop started

DEBUG 2017-06-29 22:19:00,558 (MASTER-1) Master maintenance loop started


Press
Control C to exit hblink.py

=====================================================================
If you do not receive the output above, STOP !!! Something is wrong with the hblink install, or the configuration file is damaged.



We will now add valid configuration data to hblink.cfg so we can test further we are going to connect to your mmdvm repeater for this part of the test.
 15: Edit th mmdvm.ini of your repeater
 16: In section [DMR Network]
Change Address to point to the HB_Bridge PC address
 17  In section [DMR Network]
Change Port to 62031
 18  In section [DMR Network]
Change Password to passw0rd
 19: Save your work Start your mmdvm repeater
 20 Execute
python hblink.py

Your output should look like this. Important data is in bold.

=====================================================================



root@repeater:/srv/HBlink# python hblink.py

DEBUG 2017-06-29 22:18:50,552 Logging system started, anything from here on gets logged

INFO 2017-06-29 22:18:50,552 HBlink 'HBlink.py' (c) 2016 N0MJS & the K0USY Group - SYSTEM STARTING...

DEBUG 2017-06-29 22:18:50,553 (MASTER-1) Master maintenance loop started

DEBUG 2017-06-29 22:18:50,554 MASTER instance created: MASTER-1, <__main__.HBSYSTEM instance at 0xb653e56c>

INFO 2017-06-29 22:18:53,319 (MASTER-1) Repeater Logging in with Radio ID: 302236, 192.168.2.13:48449

INFO 2017-06-29 22:18:53,320 (MASTER-1) Sent Challenge Response to 302236 for login: 1828349741

INFO 2017-06-29 22:18:53,324 (MASTER-1) Client 302236 has completed the login exchange successfully

INFO 2017-06-29 22:18:53,329 (MASTER-1) Client VE2RVL (302236) has sent repeater configuration

DEBUG 2017-06-29 22:18:55,555 (MASTER-1) Master maintenance loop started

DEBUG 2017-06-29 22:19:00,558 (MASTER-1) Master maintenance loop started

DEBUG 2017-06-29 22:19:03,346 (MASTER-1) Received and answered RPTPING from client VE2RVL (302236)

DEBUG 2017-06-29 22:19:05,555 (MASTER-1) Master maintenance loop started

=====================================================================
If you do not receive the connection from your repeater ( not mine !!!!), STOP !!! Something is wrong with the hblink install, or the configuration file is damaged.

Press Control C to exit hblink.py

























Now we will do initial testing of HB_Bridge.py For the first part of the test, we will not edit the configuration file.


 1: Edit
HB_Bridge.cfg

Add a comment (#) infront of all the entry inth [RULES] Section

Execute the following command python HB_Bridge.py

Your output should look like this. Important data is in bold.

=====================================================================


root@repeater:/srv/HBlink# python HB_Bridge.py

load config file config.file

DEBUG 2017-06-29 22:30:39,877 Logging system started, anything from here on gets logged

INFO 2017-06-29 22:30:39,877 ID ALIAS MAPPER: 'peer_ids.csv' is current, not downloaded

INFO 2017-06-29 22:30:39,877 ID ALIAS MAPPER: 'subscriber_ids.csv' is current, not downloaded

INFO 2017-06-29 22:30:39,915 ID ALIAS MAPPER: peer_ids dictionary is available

INFO 2017-06-29 22:30:40,238 ID ALIAS MAPPER: subscriber_ids dictionary is available

INFO 2017-06-29 22:30:40,238 HBlink 'HB_Bridge.py' (c) 2017 Mike Zingman N4IRR, N0MJS - SYSTEM STARTING...

INFO 2017-06-29 22:30:40,239 Version 20170620

DEBUG 2017-06-29 22:30:40,242 (MASTER-1) Master maintenance loop started

DEBUG 2017-06-29 22:30:40,242 MASTER instance created: MASTER-1, <__main__.HB_BRIDGE instance at 0xb65c960c>

DEBUG 2017-06-29 22:30:45,246 (MASTER-1) Master maintenance loop started

INFO 2017-06-29 22:30:46,200 (MASTER-1) Repeater Logging in with Radio ID: 302236, 192.168.2.13:54428

INFO 2017-06-29 22:30:46,201 (MASTER-1) Sent Challenge Response to 302236 for login: 2925742343

INFO 2017-06-29 22:30:46,206 (MASTER-1) Client 302236 has completed the login exchange successfully

INFO 2017-06-29 22:30:46,211 (MASTER-1) Client VE2RVL (302236) has sent repeater configuration

DEBUG 2017-06-29 22:30:50,246 (MASTER-1) Master maintenance loop started

DEBUG 2017-06-29 22:30:55,247 (MASTER-1) Master maintenance loop started

DEBUG 2017-06-29 22:30:56,214 (MASTER-1) Received and answered RPTPING from client VE2RVL (302236)

=====================================================================

If you do not receive connection from your repeater , STOP !!! Something is wrong with the HB_Bridge.py install, or the configuration file is damaged. HB_Bridge needs hblink
to properly connect to the repeater.











So, lets recap. You PC is properly communicating with the DV 3000. You have installed Analog_Bridge in /opt/Analog_Bridge and it can communicate with the DV3000. You have installed hblink /srv/hblink. hblink.py can serve as a MASTER for a mmdvm repeater HB_Bridge.py is using hblink.py to communicate with mmdvm repeater. This concludes the installation phase of Analog_Bridge. From here, we will move on to configuring the modules needed to configure DVSwitch to route the proper TG/TS to Brandmeister / IPSC Network or to the Analog_Bridge ….


Copy /srv/HBlink directory 3 times , to /opt/HBlink , to /opt/HBlink2 and to /opt/HBlink3



To install MMDVMHost on the PC follow these instructions

cd /srv

git clone https://github.com/g4klx/MMDVMHost.git

cd MMDVMHost

make

Edit MMDVM.ini to your preferences …



To install MMDVCal on the PC Follow these instructions

cd /srv

git clone https://github.com/g4klx/MMDVCal.git

cd MMDVMHost

make





Here is a drawing of the configuration used for our gateway



To auto start all the required modules . Create the required services using the following instructions



Adapted freely from Steve N4IRS DMRGateway Install notes by Richard VE2DJE