文档说明:只记录关键地方;
试验环境: linux debian 11
安装asterisk
#!/bin/bash
set -eux
set -o pipefail
# https://www.ruanyifeng.com/blog/2017/11/bash-set.html
__DIR__=$(cd "$(dirname "$0")";pwd)
cd ${__DIR__} &&
apt install -y bzip2 wget pigz cmake make gcc g++ gcc git autoconf automake libtool file
test -f asterisk-19-current.tar.gz || wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-19-current.tar.gz
test -f libpri-1.6.0.tar.gz || wget https://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.6.0.tar.gz
test -f dahdi-linux-complete-3.1.0.tar.gz || wget https://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-3.1.0-rc1+3.1.0-rc1.tar.gz
test -f asterisk-19-current.tar.gz && mkdir -p asterisk-19-current && tar -zxvf asterisk-19-current.tar.gz -C ./asterisk-19-current --strip-components 1
test -f libpri-1.6.0.tar.gz && tar -zxvf libpri-1.6.0.tar.gz
# 路径里包含 + ;去除
test -f "dahdi-linux-complete-3.1.0-rc1+3.1.0-rc1.tar.gz" && mv "dahdi-linux-complete-3.1.0-rc1+3.1.0-rc1.tar.gz" dahdi-linux-complete-3.1.0.tar.gz
test -f dahdi-linux-complete-3.1.0.tar.gz && tar -zxvf dahdi-linux-complete-3.1.0.tar.gz
test -d dahdi-linux-complete-3.1.0 && rm -rf dahdi-linux-complete-3.1.0
test -d 'dahdi-linux-complete-3.1.0-rc1+3.1.0-rc1' && mv 'dahdi-linux-complete-3.1.0-rc1+3.1.0-rc1' dahdi-linux-complete-3.1.0
# cpu 核数 make -j 需要 并行编译
cpu_nums=`grep "processor" /proc/cpuinfo | sort -u | wc -l`
cd ${__DIR__}/soft/dahdi-linux-complete-3.1.0
# make all -j $cpu_nums && make install && make config
cd ${__DIR__}/soft/libpri-1.6.0
make && make install -j $cpu_nums
cd ${__DIR__}/soft/asterisk-19-current
ls -lha .
./contrib/scripts/install_prereq install
./configure --with-jansson-bundled --with-pjproject-bundled
make install -j $cpu_nums
make samples
make config
make install-logrotate
make basic-pbx
asterisk -cvvvvv