All Star Link: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
mNo edit summary
 
Line 13: Line 13:
  sudo apt-get autoremove
  sudo apt-get autoremove
Removing apache2 breaks allmon3 which might change my mind on that, but I'd prefer to run it on nginx if it comes to that.
Removing apache2 breaks allmon3 which might change my mind on that, but I'd prefer to run it on nginx if it comes to that.
Old notes
AllStarLink ([https://allstarlink.org/ https://allstarlink.org]) is a fork of [[Asterisk]] Henceforth "ASL".
The [https://github.com/allstarlink ASL github repo] says ASL-Asterisk is based on Asterisk 1.4.23pre, making it [https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions ludicrously outdated], EOL 2012, ten years ago.
For TARRA we will be running ASL at each repeater and linking them over Internet connections via cellular modems. Brian has to learn repeaters and Mick has to learn Asterisk.
I am setting up ASL here at my house with a Pi 3 ([[Violet]]) and a handheld.
I downloaded the complete Pi image v 1.0.1. I could not install it because the IMG file was the wrong size. I downloaded beta 6 of version 2. It installed. It boots. I have it on Ethernet right now. HDMI does not work, so I unplugged the monitor and keyboard. Checked Wenda to see what the IP address it pulled is. Log in as repeater/allstarlink and run asl-menu. ssh [/cdn-cgi/l/email-protection [email protected]] -- works -- fancy!
===Network settings===
Edited /etc/wpa_supplicant.conf file to enabled WiFi, just in case I need it later.
(From asl-menu) I set the machine to be violet.w6gkd.radio, and left it on DHCP (the address is fixed in the DHCP server on [[Wenda]]).
I set the timezone.
===Echolink===
On page 2, I need to set up echolink. According to the Echolink page, you get a node number assigned automatically so I don't know why they have this?
For echolink I had to open firewall ports 5198-5199 on my EdgeRouter and set forwarding  to the Pi.
I had to validate the connection at https://echolink.org/validation
===AllMon2===
AllMon2 is the web site, you have to set up a password to use it.
ssh violet
/var/www/html/allmon
sudo htpasswd -cB .htpasswd admin
===USB sound===
[https://www.newegg.com/startech-com-icusbaudio7/p/N82E16829128007?Item=9SIA2F89142628 Startech sound card] from Newegg. I paid $24, now they want $30, pretty sure I already overpaid so I don't think I'd get another one of these.
I have it plugged in already and it shows up in lsusb as
Bus 001 Device 004: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
From Mick, a Syba UAUD. These can be converted for use with svxlink per this description, https://www.repeater-builder.com/projects/fob/syba-small-fob.html but we use GPIO pins.
====Set card as default====
Make sure your sound card shows up as "1" when you do
cat /proc/asound/cards
Turn off the internal sound system by editing /boot/config.txt. Look for dtparam=audio=on
Edit /usr/share/alsa/alsa.conf to change 0 to 1 in these lines.
defaults.ctl.card 1
defaults.pcm.card 1
After reboot, if you use alsamixer you should be able to see the USB card and adjust it.
Once I had changed the defaults, Asterisk grabbed my sound card as soon as I set it as default! I had to stop it so I could test the sound card. I guess this answers the question of whether I can use ASL to generate sounds?
sudo systemctl stop asterisk.service
You should be able to play a sound file, for example, these commands work.
play /usr/share/sounds/alsa/Front_Center.wav
speaker-test -c2 -t wav
====Speech synthesis====
I used to use Festival because it was the only option, now there is also espeak-ng. I installed it, "sudo apt install espeak-ng", and then I can just send text to the sound board,
espeak-ng "Alexa,,,,, please tell me a joke."
There are better voices including female ones but the mbrola package is non-free so it is missing from Raspbian? I guess. Make one and install it then press on,
wget http://steinerdatenbank.de/software/mbrola3.0.1h_armhf.deb
sudo dpkg -i mbrola3.0.1h_armhf.deb
sudo apt install mbrola-us1 mbrola-us2 mbrola-us3
espeak-ng -v mb-us1 "Hello. This is a test of the MBROLA voice." -p 60
The mbrola-us1 (female) voice is probably the most intelligible.
Espeak is only integrated with Asterisk 1.16+ and ASL is based on 1.14, so it won't work directly. This means I can either go back to using Festival or I can hack around it? Can I send text to an external service and get a WAV file back? Do I even care? Do I just like hearing robots talk? Testing with festival, so I can compare,
sudo apt install festival festvox-us1
Test it
  festival
  (SayText "Hello, Brian!")
  (voice_us1_mbrola)
  (SayText "Hello, Brian!")
I want it to run as a service, for now I am just going to issue the command.
  festival --server &
Edit /usr/share/festival/festival.scm and add this at the end, above the last line.
(define (tts_textasterisk string mode)
(let ((wholeutt (utt.synth (eval (list 'Utterance 'Text string)))))
(utt.wave.resample wholeutt 8000)
(utt.wave.rescale wholeutt 5)
(utt.send.wave.client wholeutt)))
Then I can tell Asterisk that Festival is available. I create a festival.conf file and load the module in modules.conf. For me I just needed all the defaults in festival.conf, something like this works,
[general]
host=localhost
port=1314
I can tell Asterisk to say something by creating an extension in custom/extensions.conf. This actually does not use the festival or server module at all.
exten => 110,1,Answer()
exten => 110,n,System(echo "We are now doing Festival Test" | /usr/bin/text2wave -scale 1.5 -F 8000 -o /tmp/test.wav)
exten => 110,n,Playback(/tmp/test)
exten => 110,n,System(rm -f /tmp/test.wav)
exten => 110,n,Hangup()
Then I can restart Asterisk and try it.
  sudo systemctl start asterisk.service
Or I can use espeak and a shell command, since I can use a System command,<pre>
exten => 111,1,Answer()
exten => 111,n,System(echo "We are now doing Festival Test with espeak." | /usr/bin/espeak-ng -v mb-us1 -p 60 -w /tmp/test.wav)
exten => 111,n,Playback(/tmp/test)
exten => 111,n,System(rm -f /tmp/test.wav)
exten => 111,n,Hangup()
exten => 112,1,Answer()
exten => 112,n,System(echo "We are now doing Festival Test with espeak." | /usr/bin/espeak-ng -v mb-us3 -p 60 -w /tmp/test.wav)
exten => 112,n,Playback(/tmp/test)
exten => 112,n,System(rm -f /tmp/test.wav)
exten => 112,n,Hangup()
</pre>There is also Flite and Asterisk-Flite but I am done testing all this for now, I think Festival is good enough for now.
===SIP phones===
First I need to make sure SIP is enabled in Asterisk.
sudo asterisk -r
module show
and... it's not.
module load chan_sip
I can set it to load it at start up by editing /etc/asterisk/modules.conf. I enabled chan_sip. chan_sip is deprecated but this is ASL not a PBX. chan_sip was very easy to set up compared to chan_pjsip.
I don't have any SIP phones right now but I have several Android smartphones. Supposedly the Android phone app can do SIP, but not on ''my'' phones. See https://wiki.ezuce.com/display/sipXcom/Android+Integrated+SIP+Calling
I installed the Grandstream app, "GS Wave".
I set up two phones, two extensions in Asterisk, and I can dial from one to the other over Wifi.
[[Category:Radio]]
[[Category:Radio]]
[[Category:Telephones]]
[[Category:Telephones]]
[[Category:Network]]
[[Category:Network]]

Latest revision as of 03:56, 11 July 2024

ASL 3 just came out and it's based on Asterisk 20. Wow, that's a big leap forward for that project. I rejected ASL because it was based on an antique version of Asterisk.

Notes on initial setup

I'm using a new Pi 5 which I have named "ASL", I put a reservation for its addresses (asl.local and asl-wifi.local) into pihole on Bellman.

I moved basic setup to Pi 5, go there then return here.

Remove cockpit, I have no use for it, it requires apache2 and apache2 burns up memory and opens up more attack surface.

sudo apt-get remove cockpit apache2
sudo apt-get autoremove

Removing apache2 breaks allmon3 which might change my mind on that, but I'd prefer to run it on nginx if it comes to that.


Old notes


AllStarLink (https://allstarlink.org) is a fork of Asterisk Henceforth "ASL".

The ASL github repo says ASL-Asterisk is based on Asterisk 1.4.23pre, making it ludicrously outdated, EOL 2012, ten years ago.

For TARRA we will be running ASL at each repeater and linking them over Internet connections via cellular modems. Brian has to learn repeaters and Mick has to learn Asterisk.

I am setting up ASL here at my house with a Pi 3 (Violet) and a handheld.

I downloaded the complete Pi image v 1.0.1. I could not install it because the IMG file was the wrong size. I downloaded beta 6 of version 2. It installed. It boots. I have it on Ethernet right now. HDMI does not work, so I unplugged the monitor and keyboard. Checked Wenda to see what the IP address it pulled is. Log in as repeater/allstarlink and run asl-menu. ssh [/cdn-cgi/l/email-protection [email protected]] -- works -- fancy!

Network settings

Edited /etc/wpa_supplicant.conf file to enabled WiFi, just in case I need it later.

(From asl-menu) I set the machine to be violet.w6gkd.radio, and left it on DHCP (the address is fixed in the DHCP server on Wenda).

I set the timezone.

Echolink

On page 2, I need to set up echolink. According to the Echolink page, you get a node number assigned automatically so I don't know why they have this?

For echolink I had to open firewall ports 5198-5199 on my EdgeRouter and set forwarding to the Pi.

I had to validate the connection at https://echolink.org/validation

AllMon2

AllMon2 is the web site, you have to set up a password to use it.

ssh violet
/var/www/html/allmon
sudo htpasswd -cB .htpasswd admin

USB sound

Startech sound card from Newegg. I paid $24, now they want $30, pretty sure I already overpaid so I don't think I'd get another one of these.

I have it plugged in already and it shows up in lsusb as

Bus 001 Device 004: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter

From Mick, a Syba UAUD. These can be converted for use with svxlink per this description, https://www.repeater-builder.com/projects/fob/syba-small-fob.html but we use GPIO pins.

Set card as default

Make sure your sound card shows up as "1" when you do

cat /proc/asound/cards

Turn off the internal sound system by editing /boot/config.txt. Look for dtparam=audio=on

Edit /usr/share/alsa/alsa.conf to change 0 to 1 in these lines.

defaults.ctl.card 1
defaults.pcm.card 1

After reboot, if you use alsamixer you should be able to see the USB card and adjust it.

Once I had changed the defaults, Asterisk grabbed my sound card as soon as I set it as default! I had to stop it so I could test the sound card. I guess this answers the question of whether I can use ASL to generate sounds?

sudo systemctl stop asterisk.service

You should be able to play a sound file, for example, these commands work.

play /usr/share/sounds/alsa/Front_Center.wav
speaker-test -c2 -t wav

Speech synthesis

I used to use Festival because it was the only option, now there is also espeak-ng. I installed it, "sudo apt install espeak-ng", and then I can just send text to the sound board,

espeak-ng "Alexa,,,,, please tell me a joke."

There are better voices including female ones but the mbrola package is non-free so it is missing from Raspbian? I guess. Make one and install it then press on,

wget http://steinerdatenbank.de/software/mbrola3.0.1h_armhf.deb
sudo dpkg -i mbrola3.0.1h_armhf.deb
sudo apt install mbrola-us1 mbrola-us2 mbrola-us3
espeak-ng -v mb-us1 "Hello. This is a test of the MBROLA voice." -p 60

The mbrola-us1 (female) voice is probably the most intelligible.

Espeak is only integrated with Asterisk 1.16+ and ASL is based on 1.14, so it won't work directly. This means I can either go back to using Festival or I can hack around it? Can I send text to an external service and get a WAV file back? Do I even care? Do I just like hearing robots talk? Testing with festival, so I can compare,

sudo apt install festival festvox-us1

Test it

 festival
 (SayText "Hello, Brian!")
 (voice_us1_mbrola)
 (SayText "Hello, Brian!")

I want it to run as a service, for now I am just going to issue the command.

 festival --server &

Edit /usr/share/festival/festival.scm and add this at the end, above the last line.

(define (tts_textasterisk string mode)
(let ((wholeutt (utt.synth (eval (list 'Utterance 'Text string)))))
(utt.wave.resample wholeutt 8000)
(utt.wave.rescale wholeutt 5)
(utt.send.wave.client wholeutt)))

Then I can tell Asterisk that Festival is available. I create a festival.conf file and load the module in modules.conf. For me I just needed all the defaults in festival.conf, something like this works,

[general]
host=localhost
port=1314

I can tell Asterisk to say something by creating an extension in custom/extensions.conf. This actually does not use the festival or server module at all.

exten => 110,1,Answer()
exten => 110,n,System(echo "We are now doing Festival Test" | /usr/bin/text2wave -scale 1.5 -F 8000 -o /tmp/test.wav)
exten => 110,n,Playback(/tmp/test)
exten => 110,n,System(rm -f /tmp/test.wav)
exten => 110,n,Hangup()

Then I can restart Asterisk and try it.

 sudo systemctl start asterisk.service

Or I can use espeak and a shell command, since I can use a System command,

exten => 111,1,Answer()
exten => 111,n,System(echo "We are now doing Festival Test with espeak." | /usr/bin/espeak-ng -v mb-us1 -p 60 -w /tmp/test.wav)
exten => 111,n,Playback(/tmp/test)
exten => 111,n,System(rm -f /tmp/test.wav)
exten => 111,n,Hangup()

exten => 112,1,Answer()
exten => 112,n,System(echo "We are now doing Festival Test with espeak." | /usr/bin/espeak-ng -v mb-us3 -p 60 -w /tmp/test.wav)
exten => 112,n,Playback(/tmp/test)
exten => 112,n,System(rm -f /tmp/test.wav)
exten => 112,n,Hangup()

There is also Flite and Asterisk-Flite but I am done testing all this for now, I think Festival is good enough for now.

SIP phones

First I need to make sure SIP is enabled in Asterisk.

sudo asterisk -r
module show

and... it's not.

module load chan_sip

I can set it to load it at start up by editing /etc/asterisk/modules.conf. I enabled chan_sip. chan_sip is deprecated but this is ASL not a PBX. chan_sip was very easy to set up compared to chan_pjsip.

I don't have any SIP phones right now but I have several Android smartphones. Supposedly the Android phone app can do SIP, but not on my phones. See https://wiki.ezuce.com/display/sipXcom/Android+Integrated+SIP+Calling

I installed the Grandstream app, "GS Wave".

I set up two phones, two extensions in Asterisk, and I can dial from one to the other over Wifi.