Using pyUC to access ASL


Mike Zingman - N4IRR
 

Been doing a quick hack to Analog_Bridge to let you use it like the other digital modes from a client like pyUC.  Rather than add IAX2 to the python code, I cheated and created a shim to allow me to control the ASL node right from pyUC.  Setup looks like this:

ASL <---> AB <---> pyUC

With this setup I can move between ASL and other digital modes right from the pyUC mode selection menu.  I can add any number of nodes to my menu and have 2way conversations with other on the system.  I can run the pyUC app on Windows, Mac or Linux.  The node is running on my Raspberry Pi.

Since I use a Mac most of the time, the web transceiver or the Windows iaxRpt apps were not really a good option for me, but this works well enough and lets me get back on Allstar when I want.

Mike N4IRR


Steve N4IRS
 

Folks,
Understand what this can mean for a ASL node. pyUC (the client) runs on Linux, Windows OSX (and maybe others supporting Python3 and a GUI) with the addition of Analog_Bridge to the ASL node, you now have desktop access to your ASL node.

Steve N4IRS

On 5/5/20 10:01 PM, Mike Zingman - N4IRR wrote:
Been doing a quick hack to Analog_Bridge to let you use it like the other digital modes from a client like pyUC.  Rather than add IAX2 to the python code, I cheated and created a shim to allow me to control the ASL node right from pyUC.  Setup looks like this:

ASL <---> AB <---> pyUC

With this setup I can move between ASL and other digital modes right from the pyUC mode selection menu.  I can add any number of nodes to my menu and have 2way conversations with other on the system.  I can run the pyUC app on Windows, Mac or Linux.  The node is running on my Raspberry Pi.

Since I use a Mac most of the time, the web transceiver or the Windows iaxRpt apps were not really a good option for me, but this works well enough and lets me get back on Allstar when I want.

Mike N4IRR


Mike Webb [WG5EEK]
 

Please share how?  And can you set it up to control dvswitch and then asl running on another pi? 


Steve N4IRS
 

The basics are to add Analog_Bridge to your existing ASL node. it would look like this:

pyUC <-> Analog_Bridge <-> ASL Node (chan_usrp)

pyUC would be running on your Desktop computer. Analog_Bridge and ASL would be running on a a Linux machine.

Hope this helps.

73, Steve N4IRS

On 5/5/20 10:18 PM, Mike Webb [WG5EEK] wrote:
Please share how?  And can you set it up to control dvswitch and then asl running on another pi? 


Mike Webb [WG5EEK]
 

I have asl and mmdvm bridge running on one pi that I setup manually to use to bridge a public ASL node to DMR or to talk on DMR only. a
And I have the full dv switch system builder setup running on another pi, as I didn't want to mess up my existing setup as many people rely on it to talk to our local repeater via RF.

On the ALS pi, I have node #1999 to analog_bridge to mmdvm that I can there link to my public facing node.

But I don't know how to tell the pyUC app to connect to the ASL analog_bridge or node number.  I'm ok at following guides but I'm not so good at figuring how to do what you guys are doing to make pyUC talk to a specific ASL node number.  But I am trying to learn as much as I can.


Mike Zingman - N4IRR
 

- Grab the latest Analog_Bridge for your platform
- Edit the configuration file (Analog_Bridge.ini) and set the server, RXPort and TXPort in the [AMBE_AUDIO] section to point to your ASL chan_usrp address and ports
- Edit the configuration file (Analog_Bridge.ini) and set the server, RXPort and TXPort in the [USRP] section to point to your desktop computer pyUC address and ports
- Edit the configuration file (Analog_Bridge.ini) and add a macro in the [MACROS] section called dial.  If you have installed AB on the same machine as ASL then:
var NODE=xxxxx
dial="asterisk -rx \"rpt fun $NODE *%s\""

If you have installed AB on a different machine, then use this template:
ar NODE=xxxxx
var ASL_USER=xxxxx
var ASL_IP=xx.xx.xx.xx
dial=ssh ${ASL_USER}@${ASL_IP} "asterisk -rx \"rpt fun $NODE *%s\""

Since ssh can not have a password on the command line you would create a public/private key pair:
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub | ssh user@... "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"

Now install pyUC from github
git clone https://github.com/DVSwitch/USRP_Client.git

- Edit the pyUC.ini file and add an [ASL] section with stuff like:
[ASL]
Disconnect = 10
70 Telemetry = 70
2000 ALBACORE HUB = 32000
2100 N4IRS =  32100
2135 WAN = 32135
2560 WINSystem = 22560
2600 DVSWITCH = 32600

There is so much more you could do (macros, more nodes, set audio levels and AGC, etc), but this is the minimum to get you going.
If you want to run digital and ASL from the same UI, make sure your macros in AB.ini have good definitions for each digital mode (probably pointing at dvswitch.sh)


Mike Webb [WG5EEK]
 

Wow awesome!

All that makes sense.

My only question now is in the ssh part. 

"
ssh user@..." Would tbe user@... Be for example user@ipaddress_pyUC_computer and is it actually user or the user login name I connect to the pi with?

And then how do I use that key pair? I've never done that before.


Mike Webb [WG5EEK]
 

Ok I got the ssh part figured out I think.  Genratated the ssh key pair on the DV Switch PI, then told it to copy it to the ALS Pi.  That seemed to work.
Then Analog_Bridge.ini on the DV Switch PI with the macro pointing to the Node, user name, and ip address then added the port in the ssh that i needed with -p port#.  Saved.  
Added the ASL stanza and talk groups above to the pyUC.ini file and that shows when I run the program.  However, I'm having issues where the program keeps returning me to the last used digital mode and talkgroup.  So i'm not sure where the problem lies there.  And when I click on ASL it just tunes to 4000 and says link not linked and again moves me off of the ASL dropdown.


Mike Zingman - N4IRR
 

Mike,

The ssh keys are to make it so you do not need to enter a password to access the ASL machine. Glad you got that sorted. 
Are you using the latest version of Analog_Bridge?  The AB log would help you debug the problem. Go ahead and delete the log file, start AB, connect pyUC, tune. Attach the log and let's see what is going on. 

Mike


Mike Webb [WG5EEK]
 

Mike, 

Thank you for your help.  I guess i'm a bit behind on the analog_bridge version as i'm showing it as 1.1 on the ASL Pi and 1.4.2 on the newly built DV Switch Pi.  I'll update and try again and report.  Unfortunately it won't be today as we are having a zoom/youtube net soon.  
But you've given me a place to start and I really appreciate it.

On Wed, May 6, 2020 at 4:56 PM Mike Zingman - N4IRR <mike.zingman@...> wrote:
Mike,

The ssh keys are to make it so you do not need to enter a password to access the ASL machine. Glad you got that sorted. 
Are you using the latest version of Analog_Bridge?  The AB log would help you debug the problem. Go ahead and delete the log file, start AB, connect pyUC, tune. Attach the log and let's see what is going on. 

Mike


Mike Webb [WG5EEK]
 

Ok, after replacing the Analog_Bridge file and making sure it's on 1.4.2 and started, and after rebooting the DV Switch Pi and attempting again, I have the same issue.  I've attached both logs.
I noticed that when trying to switch to ASL in pyUC, it throws out an error of: Macro *ASL was not found, being ignored.

I can attach my analog_bridge.ini file on the DV Switch PI with the node, username, ip, etc in the [MACROS] stanza and my pyUC.ini file on my PC as well if you need them.


Tom Corcoran
 

Hello Mike,
If I want to just connect to one node, is there a simpler way? Can I make changes to pyUC.ini or do I also have to make changes in AB.ini as you outline earlier?
--
tnx … Tom VE3NY


Mike Zingman - N4IRR
 

I forgot to add that you should enable the usrp channel driver and set up the rpt.conf to point to the same IP, tx and rx ports your AB instance is set up to communicate on.  As an example I am using:
 
[1999]
rxchannel = usrp/192.168.1.109:34001:32001
duplex = 0
scheduler=scheduler
functions = functions-repeater
hangtime=0
authlevel = 0
holdofftelem=1
telemdefault=1
nounkeyct=1


Mike Webb [WG5EEK]
 

Mike,

Were you able to look at my log files?  I already have those settings in rpt.conf.  Thanks.

On Fri, May 8, 2020 at 4:09 PM Mike Zingman - N4IRR <mike.zingman@...> wrote:
I forgot to add that you should enable the usrp channel driver and set up the rpt.conf to point to the same IP, tx and rx ports your AB instance is set up to communicate on.  As an example I am using:
 
[1999]
rxchannel = usrp/192.168.1.109:34001:32001
duplex = 0
scheduler=scheduler
functions = functions-repeater
hangtime=0
authlevel = 0
holdofftelem=1
telemdefault=1
nounkeyct=1


Mike Zingman - N4IRR
 

I see this in your AB log:

M: 2020-05-07 15:48:36.573 Setting [AMBE_AUDIO] ambeMode -> DMR

And:
I: 2020-05-07 15:51:10.153 Macro *ASL was not found, being ignored

1) In my instructions I FORGOT to tell you to set the ambeMode = ASL
2) Actually, what you should do is have a macro ASL which does something like this:
SOMEPATH/dvswitch.sh ambeMode ASL


On Mon, May 11, 2020 at 11:55 AM Mike Webb [WG5EEK] <michael.af.webb@...> wrote:
Mike,

Were you able to look at my log files?  I already have those settings in rpt.conf.  Thanks.

On Fri, May 8, 2020 at 4:09 PM Mike Zingman - N4IRR <mike.zingman@...> wrote:
I forgot to add that you should enable the usrp channel driver and set up the rpt.conf to point to the same IP, tx and rx ports your AB instance is set up to communicate on.  As an example I am using:
 
[1999]
rxchannel = usrp/192.168.1.109:34001:32001
duplex = 0
scheduler=scheduler
functions = functions-repeater
hangtime=0
authlevel = 0
holdofftelem=1
telemdefault=1
nounkeyct=1


Mike Webb [WG5EEK]
 

Here is my dvsm.macro file:

; dvsm.macro
; This is a macro include file for Analog_Bridge(AB)
; The purpose of this file is to provide macro commands for use by DVSwitch Mobile(DVSM)
; These macros execute scripts when a DVSM user requests a mode change.
 
 
[MACROS]
; Example: When a DVSM user selects the DMR mode, AB will look for the mode below and execute the script and pass the parameter.
; In this case, AB will execute the script "/opt/Analog_Bridge/dvswitch.sh" and pass the prarmeters of "mode DMR" to the script. 
 
ASL =   /opt/Analog_Bridge/dvswitch.sh mode ASL
DMR =   /opt/Analog_Bridge/dvswitch.sh mode DMR
DSTAR = /opt/Analog_Bridge/dvswitch.sh mode DSTAR
NXDN =  /opt/Analog_Bridge/dvswitch.sh mode NXDN
P25 =   /opt/Analog_Bridge/dvswitch.sh mode P25
YSF =   /opt/Analog_Bridge/dvswitch.sh mode YSF
 
 
; Ask AB to pull fresh data files and send to DVSM/UC
dbupdate = /opt/Analog_Bridge/dvswitch.sh collectProcessPushDataFiles
 
; Example TG / Reflector Macro
9876 =  /opt/Analog_Bridge/parrot.sh



And now in the analog_bridge.log I get this when trying to switch to ASL:

I: 2020-05-13 04:10:29.301 USRP server ip change from 192.168.0.176 to new ip 192.168.0.176
I: 2020-05-13 04:10:29.357 INFO packet sent to USRP client
I: 2020-05-13 04:10:32.046 Tune macro: *DMR will invoke "/opt/Analog_Bridge/dvswitch.sh mode DMR"
I: 2020-05-13 04:10:32.210 rxport=: 30000
M: 2020-05-13 04:10:32.210 TLV rx socket reopened for 127.0.0.1:30000
I: 2020-05-13 04:10:33.420 MESSAGE packet sent to USRP client
I: 2020-05-13 04:10:33.461 ambeMode = DMR, size = 72
M: 2020-05-13 04:10:33.461 Connecting to DV3000 hardware......
M: 2020-05-13 04:10:33.521 Begin DV3000 decode
I: 2020-05-13 04:10:33.521 txport=: 31103
I: 2020-05-13 04:10:33.542 rxport=: 31100
M: 2020-05-13 04:10:33.543 TLV rx socket reopened for 127.0.0.1:31100
I: 2020-05-13 04:10:34.690 INFO packet sent to USRP client
I: 2020-05-13 04:10:34.695 Macro result was 0
I: 2020-05-13 04:10:34.696 INFO packet sent to USRP client
I: 2020-05-13 04:10:44.507 Tune macro: *DSTAR will invoke "/opt/Analog_Bridge/dvswitch.sh mode DSTAR"
I: 2020-05-13 04:10:44.680 rxport=: 30000
M: 2020-05-13 04:10:44.681 TLV rx socket reopened for 127.0.0.1:30000
I: 2020-05-13 04:10:45.905 MESSAGE packet sent to USRP client
I: 2020-05-13 04:10:45.946 ambeMode = DSTAR, size = 48
M: 2020-05-13 04:10:45.946 Connecting to DV3000 hardware......
M: 2020-05-13 04:10:46.006 Begin DV3000 decode
I: 2020-05-13 04:10:46.006 txport=: 32103
I: 2020-05-13 04:10:46.028 rxport=: 32100
M: 2020-05-13 04:10:46.029 TLV rx socket reopened for 127.0.0.1:32100
I: 2020-05-13 04:10:47.171 INFO packet sent to USRP client
I: 2020-05-13 04:10:47.177 Macro result was 0
I: 2020-05-13 04:10:47.178 INFO packet sent to USRP client
I: 2020-05-13 04:10:48.656 REMOTE: <tgs=       U>
I: 2020-05-13 04:10:48.656 txTg=: 0
I: 2020-05-13 04:10:50.675 USRP unregister client
I: 2020-05-13 04:13:40.956 USRP server ip change from 192.168.0.176 to new ip 192.168.0.176
I: 2020-05-13 04:13:41.043 INFO packet sent to USRP client
I: 2020-05-13 04:13:44.055 REMOTE: <tgs=       U>
I: 2020-05-13 04:13:44.056 txTg=: 0
I: 2020-05-13 04:13:45.820 Tune macro: *ASL will invoke "/opt/Analog_Bridge/dvswitch.sh mode ASL"
I: 2020-05-13 04:13:45.949 Macro result was 65024
I: 2020-05-13 04:13:45.950 INFO packet sent to USRP client
I: 2020-05-13 04:14:10.871 REMOTE: <tgs=       U>
I: 2020-05-13 04:14:10.871 txTg=: 0
I: 2020-05-13 04:14:12.905 USRP unregister client



So it gives a "Macro result was 65024" response and then goes right back to the last selected mode, which in this case was DSTAR.

I even tried editing the pyUC.ini file and deleteing all of the other stanzas for the modes, and then it would actually show the ASL Nodes in the selection window, however, it still would not let me transmit to anything even though it would show connected to "node number" at the bottom like it does for the other modes.