ASL-AsteriskNG

From "PTTLink Wiki"
Revision as of 22:53, 18 January 2021 by Kg7qin (talk | contribs) (→‎History)
Jump to navigation Jump to search

ASL-AsteriskNG is the next generation app_rpt client based on the KG7QIN's port to Asterisk 1.8.

You can find the official ASL-AsteriskNG repo at https://www.github.com/pttlink/ASL-AsteriskNG

Current Status

WIP. app_rpt does run. This is the code that powers the PTTLink phone portal and powered (powers?) the AllStarLink phone portal. Refer to the issues section in the repo and the README for more information.

Note: This code is very much ALPHA quality code and should be used only at your own risk.

Downloads

Github

You can download the source on GitHub at https://www.github.com/pttlink/ASL-AsteriskNG

Source files

Source files are also available on GitHub at this link https://github.com/pttlink/ASL-AsteriskNG/releases

Compiling

(From README.md)

This code has been successfully compiled on both Debian Stretch (9.4.0) and Ubuntu 16.04. For Ubuntu 16.04, you will only need to use libdev-ssl and not libdev1.0-ssl. The following commands below will download the files compile them and install them.

Using setup.sh script

To automatically build and install the port and all associated files:

# https://github.com/pttlink/ASL-AsteriskNG/raw/master/setup.sh
# sh setup.sh 

Compiling by hand

If you prefer to do all the steps yourself:

# Ensure that the necessary repos for Debian are added to sources.list
# echo "deb-src http://mirrors.kernel.org/debian/ stretch main" >> /etc/apt/sources.list 
# echo "deb-src http://mirrors.kernel.org/debian/ stretch-updates main" >> /etc/apt/sources.list 
# echo "deb-src http://security.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list

# Update and install the requirements needed to build the system
# apt-get update 
# apt-get install -y git build-essential linux-headers-$(uname -r) linux-source-4.9 libss7-dev wget apt-utils \
	dahdi-source dahdi-linux aptitude tcsh gawk libusb-dev doxygen

# Download the sources
# cd /usr/work 
# git clone https://github.com/pttlink/ASL-AsteriskNG.git 
# wget https://github.com/KG7QIN/AllStarLink/raw/master/dahdi/dahdi-linux-complete-2.10.2%2B2.10.2.tar.gz

# Run the Asterisk prereq install script
# mkdir /etc/vpb 
# cd /usr/work/ASL-AsteriskNG
# sh /usr/work/ASL-AsteriskNG/contrib/scripts/install_prereq install 

# Fix some dependencies that may have changed due to the prereq script running
# apt-get install -y libssl1.0-dev

# Extract, build and load the DAHDI modules
# cd /usr/work/ 
# tar -zxf dahdi-linux-complete-2.10.2+2.10.2.tar.gz 
# cd /usr/work/dahdi-linux-complete-2.10.2+2.10.2/tools/xpp/
# sed -i -e 's/inline /extern inline /g' echo_loader.c

# cd /usr/work/dahdi-linux-complete-2.10.2+2.10.2/
# sed -i -e 's/configure /configure CFLAGS=-Wno-error /g' Makefile
# cd tools/xpp 
# sed -i -e 's/-I. -Ixtalk -Wall -Werror/-I. -Ixtalk -Wno-error/g' Makefile 
# cd ../../ 
# make distclean 
# make 
# make install 
# make config

# Load DAHDI module
# modprobe dahdi

# Build ASL-AsteriskNG with ASL port
# By default debugging code is included in this build using the -g option below
# cd /usr/work/ASL-AsteriskNG/
# make distclean 
# ./configure LDFLAGS="-zmuldefs -lasound" CFLAGS="-Wno-unused -Wno-all -Wno-int-conversion -g" 
# make menuselect.makeopts
# menuselect/menuselect --enable app_rpt --enable chan_beagle --enable chan_tlb --enable chan_usrp --enable chan_rtpdir --enable chan_usbradio --enable chan_simpleusb --enable chan_echolink --enable app_gps --enable chan_voter --enable radio-tune-menu --enable simpleusb-tune-menu  menuselect.makeopts
# make
# make install
# make samples
# make progdocs

# Now run the post-setup script
# cd /usr/work/ASL-AsteriskNG
# sh ./post_ast_setup.sh

Using Docker to run

A Dockerfile has been created that will allow you to build this code as it currently is and run it. The base image is Debian Stretch (9.4.0).

To build:
Grab the Dockerfile from the Docker directory and place in directory by itself

# docker build -t asl1.8-test3 . 

To run:

# docker run -v /dev/dahdi:/dev/dahdi -v /dev/dsp:/dev/dsp  --privileged --net=host -d --name ASL -i -t asl1.8-test3

Note: You will need to have successfully built the DAHDI kernel modules with the AllStarLink patches and have this module loaded into your host OS's kernel.

Make sure that you connect to the container's shell and configure the node's rpt.conf and other required files under /etc/asterisk. Example files are included.

To connect to the Asterisk console:

# docker exec -it ASL sh /usr/sbin/asterisk -cvvvr

For just a shell prompts on the running container:
# docker exec -it ASL sh

When the container is started, it will automatically kick off running the /etc/asterisk/rc.updatenodelist file and asterisk as well.

You can cleanly shutdown Asterisk and stop the container by running from the Asterisk CLI "core stop gracefully" or "core stop now"

Once you configure the node you will need to either reload asterisk or stop and start the container again.

Congratulations! If all went well, you will have a complete install of Asterisk 1.8 with the AllStarLink app_rpt programs on your computer.

Note that these steps are purposely compiling Asterisk and modules with debugging info (-g). This is to make it easier to collect information about various problems while testing the port out.

Please test and abuse this and let us know what problems you find via the github repo.

Notes

There are also some changes that you will need to make to your extensions.conf file (or you an opt to convert it to either extensions.ael or extensions.lua).

One of these changes is how app_rpt is called.

Convert any of your lines that are similar to this: Rpt(${EXTEN:1}|Pv|${CALLERID(name)}-P)

To this:

Rpt(${EXTEN:1},Pv,${CALLERID(name)}-P)

Commas have replaced the | in Astersk 1.8's dialplan. Failure to update your extensions.conf will result in Asterisk not loading it correctly.

History

ASL-AsteriskNG is based upon the work done by Stacy Olivas (KG7QIN) to port app_rpt to a newer version of Asterisk.


From Stacy Olivas (KG7QIN) - 18 January 2021


The port was done at the beginning of October 2015. The initial porting took 1 1/2-2 weeks to complete during which I spent a fair amount of time on this (mostly in figuring out program flow and fixing differences in how Asterisk routines are called between the 1.4 and 1.8 code base). I chose this as a project for something to keep me busy as I was retiring after a 20 year career in the US Navy and had just started terminal leave (I had a lot of leave saved up and my official retirement date was 1 December 2015). Heck of a project too since I learned quite a bit about app_rpt and how it functions.

This started as me wanting to compile the then ACID code base on a 3.x+ Linux kernel and there were some issues out of the box at attempting to do this. After a fair amount of searching and research, I found that there was a really old version of the app_rpt code (0.100) sitting unmaintained in the Asterisk 1.8.32.3 distribution. I used this as a basis to figure out what I needed to do to port the newer client and it's significant additions to the Asterisk 1.8.32.3 code. Asterisk 1.8 brings a lot of new features to app_rpt, one of which is the ability to make sure app_rpt supports IPv6 addresses.

After the initial port was done, I reached out to several points of contact on the original AllStarLink website. Jim Dixon (WB6NIL) replied back to me and was excited and happy that I had done this to help keep app_rpt alive. This resulted in several long phone calls with Jim in which we discussed quite a bit about the history of app_rpt and the people and organizations around it and Asterisk.

With advice of and some help from Jim, I was able to successfully get app_rpt working within Asterisk 1.8 with some notable issues including: channel drivers were still in a bad state and were prone to crashing or didn't work at all.

The code then sat for a few months on my laptop's hard drive as other things became a priority. Since I didn't want to see the work I'd done go to waste, I opened up a GitHub Repo and made an announcement to the app_rpt-users mailing list about the port and availability of the source code. You can see this announcement here: http://lists.keekles.org/pipermail/app_rpt-users/2016-April/014958.html.

Since then I've done some updates to the app_rpt code and associated modules, mainly porting the changes between the version of app_rpt that I based the port off of and what the current version is/was. This code does work but it is very much alpha quality. I also added some extra tidbits to the code to aid with debugging that will need to be removed at some point. These are in the form of some additional C macros for printing debug information that were/are used to determine flow control as the code was being ported.

I am excited that this version of app_rpt is continuing to mature and become a viable client for use by the amateur radio community.