How to Install Asterisk on Ubuntu 20.04

How to install Asterisk on Ubuntu 20.04

Sangoma may have built Asterisk, a free and open-source VoIP server. It’s used to set up a VoIP telephony infrastructure for businesses of all sizes. VoIP is a Voice Over Internet Protocol used to make a call using the TCP/IP stack. With VoIP, you’ll make a call from your mobile device or computer to other devices with none cost. It runs on Unix and Linux based operating systems and ready to connect any traditional global telephony network. It offers a set of features including call distribution, conference call, voice mail and IVR.

Install Asterisk on Ubuntu

Installation Steps

Download Asterisk, LibPRI and DAHDI

cd /usr/local/src/
wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-17-current.tar.gz
wget https://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-3.1.0+3.1.0.tar.gz
wget https://downloads.asterisk.org/pub/telephony/libpri/libpri-1.6.0.tar.gz
#Clone "next" branch of dahdi-tools and dahdi-linux (next branch contains new changes not yet merged into production/stable because sangoma engineers have not yet tested them)
#Dahdi Tools (userspace tools like dahdhi_hardware, dahdi_cfg, etc)
git clone -b next https://github.com/asterisk/dahdi-tools dahdi-tools
#Dahdi Linux Drivers
git clone -b next https://github.com/asterisk/dahdi-linux dahdi-linux

DAHDI Installation

#Asterisk Dependencies
apt -y install git curl wget libnewt-dev libssl-dev libncurses5-dev subversion  libsqlite3-dev build-essential libjansson-dev libxml2-dev  uuid-dev autoconf libedit-dev
#install libtool (required to compile dahdi-tools package)
apt install -y libtool
cd /usr/local/src/
tar -zxvf dahdi-linux-complete-3.1.0+3.1.0.tar.gz
#Copy firmwares from previously extracted dahdi-linux-complete package(To avoid downloading again from digium.com which is not listed in our proxy access)
cp dahdi-linux-complete-3.1.0+3.1.0/linux/drivers/dahdi/firmware/dahdi-fw*.tar.gz dahdi-linux/drivers/dahdi/firmware/
cd dahdi-linux
make
make install
cd dahdi-tools
./bootstrap.sh
libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf
./configure
make
make install
cd dahdi-linux-complete-3.1.0+3.1.0
make install-config
#check dahdi driver is loaded
lsmod |grep dahdi
#If driver is not loaded/shown
modprobe wct4xxp
#Now Dahdi driver should be displayed in following command
lsmod |grep dahdi
#enable dahdi
systemctl enable dahdi
systemctl start dahdi
systemctl status dahdi
dahdi_genconf -vv
dahdi_cfg -vv

E1 Card Configuration

Create channels file in dahdi `/etc/dahdi/system.conf`

span=1,1,0,ccs,hdb3,crc4
# termtype: te
bchan=1-15,17-31
dchan=16
echocanceller=mg2,1-15,17-31
# Span 2: WCTE4/0/2 "WCTE43X (PCI) Card 0 Span 2"
span=2,2,0,ccs,hdb3,crc4
# termtype: te
bchan=32-46,48-62
dchan=47
echocanceller=mg2,32-46,48-62
# Span 3: WCTE4/0/3 "WCTE43X (PCI) Card 0 Span 3"
span=3,3,0,ccs,hdb3,crc4
# termtype: te
bchan=63-77,79-93
dchan=78
echocanceller=mg2,63-77,79-93
# Span 4: WCTE4/0/4 "WCTE43X (PCI) Card 0 Span 4"
span=4,4,0,ccs,hdb3,crc4
# termtype: te
bchan=94-108,110-124
dchan=109
echocanceller=mg2,94-108,110-124

Create channels file in Asterisk

`/etc/asterisk/chan_dahdi.conf`

[trunkgroups]
[channels]
context=public
usecallerid=yes
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
canpark=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=yes
group=1
callgroup=1
pickupgroup=1
; Span 1: WCTE4/0/1 "WCTE43X (PCI) Card 0 Span 1" (MASTER)
context=from-pstn
switchtype = euroisdn
signalling = pri_cpe
channel => 1-15,17-31
context = default
group = 63
; Span 2: WCTE4/0/2 "WCTE43X (PCI) Card 0 Span 2"
group=0,12
context=from-pstn
switchtype = euroisdn
signalling = pri_cpe
channel => 32-46,48-62
context = default
group = 63
; Span 3: WCTE4/0/3 "WCTE43X (PCI) Card 0 Span 3"
group=0,13
context=from-pstn
switchtype = euroisdn
signalling = pri_cpe
channel => 63-77,79-93
context = default
group = 63
; Span 4: WCTE4/0/4 "WCTE43X (PCI) Card 0 Span 4"
group=0,14
context=from-pstn
switchtype = euroisdn
signalling = pri_cpe
channel => 94-108,110-124
context = default
group = 63

 

Add dahdi line mode

in  `/etc/modprobe.d/dahdi.conf` for auto load e1 mode on reboot

options wcte43x default_linemode=e1

**Note:** _run command modprobe |grep dahdi for ensure dahdi driver in loaded and_ wcte43x _is shown. If the E1 card driver is shown then add card driver in modules file._

Add E1 card driver name only

In `/etc/dahdi/modules`

wcte43x

LibPRI Installation

cd /usr/local/src/
tar -zxvf libpri-1.6.0.tar.gz
cd libpri-1.6.0
make
make install

Asterisk Installation

cd /usr/local/src/
tar -zxvf asterisk-17-current.tar.gz
cd asterisk-17.6.0/
./configure --with-jansson-bundled=yes --with-noisy_build=yes
make
make install
make samples

Open in your favorite editor `/etc/systemd/system/asterisk.service`

[Unit]
Description=Asterisk PBX and telephony daemon.
After=network.target
[Service]
Type=simple
Environment=HOME=/var/lib/asterisk
WorkingDirectory=/var/lib/asterisk
User=root
Group=root
ExecStart=/usr/sbin/asterisk -mqf -C /etc/asterisk/asterisk.conf
ExecReload=/usr/sbin/asterisk -rx 'core reload'
#Nice=0
#UMask=0002
LimitCORE=infinity
#LimitNOFILE=
Restart=always
RestartSec=4
<h3><strong>Prevent duplication of logs</strong> </h3>

With color codes to /var/log/messages
StandardOutput=null
PrivateTmp=true
[Install]
WantedBy=multi-user.target

 

# Asterisk Daemon Reload
systemctl daemon-reload
# Enable Asterisk
systemctl enable asterisk
# Check Status Asterisk
systemctl status asterisk
# Start Asterisk
asterisk
# Connect Asterisk Console
asterisk -rvc

Follow us TwitterFacebookLinkedIn

Open Source Listing

Previous Post
Next Post

Comments

Best Open Source PBX Software of 2022 - Open Source Listing

[…] Asterisk is an open-source communication platform […]

Leave a Reply