在 Debian 11/Debian 10 上安装 Asterisk 18 LTS在 Debian 11/Debian 10 上安装 Asterisk 18 LTS在 Debian 11/Debian 10 上安装 Asterisk 18 LTS在 Debian 11/Debian 10 上安装 Asterisk 18 LTS
  • 业务
  • 目标
  • 支持
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容

在 Debian 11/Debian 10 上安装 Asterisk 18 LTS

发表 admin at 2025年2月28日
类别
  • 未分类
标签

你好,我们的好人们!在本指南中,我们将重点介绍在 Debian 11/Debian 10 上安装 Asterisk 18 LTS。Asterisk 是一个开源且免费使用的 PBX 系统,具有许多有用的功能,这些功能大多在商业 PBX 系统中提供。 Asterisk 被世界各地不同类型的组织使用。以下是 Asterisk PBX 系统附带的标准功能:

  • 电话会议
  • 通话监控
  • 通话录音
  • 分布式通用号码发现
  • 短信
  • 集群
  • 转码
  • 语音信箱
  • 呼叫等待中的来电显示
  • 直接向内系统访问
  • 呼叫停车
  • 保留音乐
  • 转移音乐
  • 来电显示拦截
  • 数据库存储/检索
  • 直接向内系统访问
  • 自动服务员
  • 黑名单
  • 通话详细记录
  • 遇忙呼叫转移
  • 无应答时呼叫转移
  • 呼叫转移变量
  • 呼叫监听
  • 在许多其他功能中

我们将通过从源代码构建软件来在 Debian 11/Debian 10 上安装 Asterisk 18 LTS。操作系统上游存储库中可用的星号包的默认版本有点旧,通过运行以下命令可以看出:

$ sudo apt update
$ apt policy asterisk
# Debian 11
asterisk:
  Installed: (none)
  Candidate: 1:16.16.1~dfsg-1+deb11u1
  Version table:
     1:16.16.1~dfsg-1+deb11u1 500
        500 http://security.debian.org/debian-security bullseye-security/main amd64 Packages
     1:16.16.1~dfsg-1 500
        500 http://deb.debian.org/debian bullseye/main amd64 Packages

# Debian 10
$ apt policy asterisk
asterisk:
  Installed: (none)
  Candidate: 1:16.2.1~dfsg-1+deb10u2
  Version table:
     1:16.2.1~dfsg-1+deb10u2 500
        500 http://deb.debian.org/debian buster/main amd64 Packages

从输出中可以看出,Debian 10 上的 Asterisk 版本低于 Debian 11 中的版本。

第1步:更新系统包

确保系统中的所有软件包均已更新,然后才能在 Debian 11/Debian 10 上安装 Asterisk 18 LTS。

sudo apt update
sudo apt full-upgrade -y

如果需要,您可以在成功升级后执行系统电源循环。

[ -f /var/run/reboot-required ] && sudo reboot -f

步骤 2:安装 Asterisk 18 LTS 构建依赖项

既然我们正在建设

sudo apt -y install build-essential git curl wget libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev libjansson-dev libxml2-dev uuid-dev default-libmysqlclient-dev

验证 GCC 和 CMAKE 是否已安装并在我们的本地系统上运行

$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
debian@debian-bullseye-01:~$
debian@debian-bullseye-01:~$ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

第 3 步:下载 Asterisk 18 LTS tarball

下载最新版本

cd /usr/src/
sudo curl -O http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz

下载后解压 Asterisk 18 tarball:

sudo tar xvf asterisk-18-current.tar.gz
cd asterisk-18*/

通过运行以下命令将 mp3 解码器库下载到源代码树中:

$ sudo contrib/scripts/get_mp3_source.sh
A    addons/mp3
A    addons/mp3/MPGLIB_README
A    addons/mp3/common.c
A    addons/mp3/huffman.h
A    addons/mp3/tabinit.c
A    addons/mp3/Makefile
A    addons/mp3/README
A    addons/mp3/decode_i386.c
A    addons/mp3/dct64_i386.c
A    addons/mp3/MPGLIB_TODO
A    addons/mp3/mpg123.h
A    addons/mp3/layer3.c
A    addons/mp3/mpglib.h
A    addons/mp3/decode_ntom.c
A    addons/mp3/interface.c
Exported revision 202.

使用 install_prereq 脚本确认所有依赖项均已安装。

sudo contrib/scripts/install_prereq install

安装成功的消息输出:

....
Setting up odbcinst (2.3.6-0.1+b1) ...
Setting up odbcinst1debian2:amd64 (2.3.6-0.1+b1) ...
Setting up unixodbc-dev:amd64 (2.3.6-0.1+b1) ...
Processing triggers for initramfs-tools (0.140) ...
update-initramfs: Generating /boot/initrd.img-5.10.0-8-amd64
Processing triggers for libglib2.0-0:amd64 (2.66.8-1) ...
No schema files found: doing nothing.
Processing triggers for libc-bin (2.31-13) ...
Processing triggers for man-db (2.9.4-2) ...
Setting up libgmime-3.0-dev:amd64 (3.2.7-1) ...

#############################################
## install completed successfully
#############################################

步骤 4:在 Debian 11/Debian 10 上构建并安装 Asterisk 18 LTS

安装依赖项后,我们就可以开始构建和安装

运行配置脚本以满足构建依赖关系。

sudo ./configure

成功执行的输出示例:

.....
configure: creating ./config.status
config.status: creating makeopts
config.status: creating autoconfig.h
configure: Menuselect build configuration successfully completed

               .$$$$$$$$$$$$$$$=..
            .$7$7..          .7$$7:.
          .$$:.                 ,$7.7
        .$7.     7$$$$           .$$77
     ..$$.       $$$$$            .$$$7
    ..7$   .?.   $$$$$   .?.       7$$$.
   $.$.   .$$$7. $$$$7 .7$$$.      .$$$.
 .777.   .$$$$$$77$$$77$$$$$7.      $$$,
 $$$~      .7$$$$$$$$$$$$$7.       .$$$.
.$$7          .7$$$$$$$7:          ?$$$.
$$$          ?7$$$$$$$$$$I        .$$$7
$$$       .7$$$$$$$$$$$$$$$$      :$$$.
$$$       $$$$$$7$$$$$$$$$$$$    .$$$.
$$$        $$$   7$$$7  .$$$    .$$$.
$$$$             $$$$7         .$$$.
7$$$7            7$$$$        7$$$
 $$$$$                        $$$
  $$$$7.                       $$  (TM)
   $$$$$$$.           .7$$$$$$  $$
     $$$$$$$$$$$$7$$$$$$$$$.$$$$$$
       $$$$$$$$$$$$$$$$.

configure: Package configured for:
configure: OS type  : linux-gnu
configure: Host CPU : x86_64
configure: build-cpu:vendor:os: x86_64 : pc : linux-gnu :
configure: host-cpu:vendor:os: x86_64 : pc : linux-gnu :

使用菜单选项自定义您的 Asterisk 安装。

sudo make menuselect

使用键盘上的箭头键浏览菜单,然后使用Enter键进行选择。

选择要在 Asterisk 18 中安装的附加组件示例:

添加额外的核心声音包来构建的示例。

对于音乐保留,选择以下最小模块

在额外声音包上选择如下所示:

在应用程序菜单下启用app_macro。

您可以随意启用或禁用您认为合适的任何模块。完成所有配置后,使用“保存并退出”按钮进行更新。

要在 Debian 11/Debian 10 上构建 Asterisk 18 LTS,请运行以下命令:

sudo make

构建过程应在接下来的几分钟或几秒钟内完成,具体取决于您的计算能力:

.....
   [LD] res_pjsip_publish_asterisk.o -> res_pjsip_publish_asterisk.so
   [CC] res_calendar_exchange.c -> res_calendar_exchange.o
   [LD] res_calendar_exchange.o -> res_calendar_exchange.so
   [CC] res_pjsip_registrar.c -> res_pjsip_registrar.o
   [LD] res_pjsip_registrar.o -> res_pjsip_registrar.so
Building Documentation For: third-party channels pbx apps codecs formats cdr cel bridges funcs tests main res addons
 +--------- Asterisk Build Complete ---------+
 + Asterisk has successfully been built, and +
 + can be installed by running:              +
 +                                           +
 +                make install               +
 +-------------------------------------------+

最后一步是使用 make install 命令在 Debian 上安装 Asterisk:

sudo make install

步骤 5:安装后配置 Asterisk 18 LTS

安装成功后,可以安装Asterisk文档:

sudo make progdocs

安装 Asterisk 和示例的默认配置。

sudo make samples
sudo make config
sudo ldconfig

创建星号用户

创建单独的用户和组来运行星号服务,并分配正确的权限:

sudo groupadd asterisk
sudo useradd -r -d /var/lib/asterisk -g asterisk asterisk
sudo usermod -aG audio,dialout asterisk
sudo chown -R asterisk.asterisk /etc/asterisk
sudo chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk
sudo chown -R asterisk.asterisk /usr/lib/asterisk

让我们确认一下 Asterisk 用户的 id:

$ id asterisk
uid=997(asterisk) gid=1001(asterisk) groups=1001(asterisk),20(dialout),29(audio)

设置 asterisk 服务运行的用户和组

$ sudo vim /etc/default/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk"

asterisk使用的默认配置文件是/etc/asterisk/asterisk.conf。您可以打开该文件并查看是否需要进行任何更改。

$ sudo vim /etc/asterisk/asterisk.conf
runuser = asterisk              ; The user to run as.
rungroup = asterisk             ; The group to run as.

更改后重新启动 asterisk 服务:

sudo systemctl restart asterisk

还要使该服务随系统启动而启动

$ systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
     Loaded: loaded (/etc/init.d/asterisk; generated)
     Active: active (running) since Wed 2021-12-08 11:20:08 UTC; 1min 24s ago
       Docs: man:systemd-sysv-generator(8)
      Tasks: 70 (limit: 2340)
     Memory: 46.0M
        CPU: 1.635s
     CGroup: /system.slice/asterisk.service
             └─48369 /usr/sbin/asterisk -U asterisk -G asterisk

Dec 08 11:20:08 debian-bullseye-01 systemd[1]: Starting LSB: Asterisk PBX...
Dec 08 11:20:08 debian-bullseye-01 asterisk[48355]: Starting Asterisk PBX: asterisk.
Dec 08 11:20:08 debian-bullseye-01 systemd[1]: Started LSB: Asterisk PBX.

要使用 Asterisk CLI,请运行:

$ sudo asterisk -rvv
Asterisk 18.11.1, Copyright (C) 1999 - 2021, Sangoma Technologies Corporation and others.
Created by Mark Spencer <[email >
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 18.11.1 currently running on debian-bullseye-01 (pid = 48369)
debian-bullseye-01*CLI>

运行一些星号命令来测试功能。

debian-bullseye-01*CLI> core show  uptime
System uptime: 16 minutes, 29 seconds
Last reload: 16 minutes, 29 seconds

debian-bullseye-01*CLI> core show  sysinfo

System Statistics
-----------------
  System Uptime:             18 hours
  Total RAM:                 2030244 KiB
  Free RAM:                  160672 KiB
  Buffer RAM:                58964 KiB
  Total Swap Space:          0 KiB
  Free Swap Space:           0 KiB

  Number of Processes:       172

debian-bullseye-01*CLI> exit
Asterisk cleanly ending (0).
Executing last minute cleanups

我们现在已经在 Debian 11/Debian 10 Linux 机器上安装并配置了 Asterisk 18 LTS。 Asterisk 官方网站上提供了详细的配置指南和完整的文档。

©2015-2025 Norria support@norria.com