Asterisk是一个强大的开源通信平台,它彻底改变了组织管理其电话系统的方式。通过在可靠且社区驱动的Rocky Linux 9上设置带有Asterisk的专用交换机(PBX)系统,企业可以简化通信,降低成本并提高整体效率。
在 Rocky Linux 9 上安装 Asterisk
第 1 步。第一步是将系统更新到最新版本的软件包列表。为此,请运行以下命令:
<span class="pln">sudo dnf update</span>
第 2 步。安装所需的依赖项。
为了支持Asterisk的功能,你需要安装特定的软件包和库:
<span class="pln">sudo dnf install epel</span><span class="pun">-</span><span class="pln">release sudo dnf groupinstall </span><span class="str">"Development Tools"</span><span class="pln"> sudo dnf install wget openssl</span><span class="pun">-</span><span class="pln">devel ncurses</span><span class="pun">-</span><span class="pln">devel newt</span><span class="pun">-</span><span class="pln">devel libxml2</span><span class="pun">-</span><span class="pln">devel kernel</span><span class="pun">-</span><span class="pln">devel sqlite</span><span class="pun">-</span><span class="pln">devel libuuid</span><span class="pun">-</span><span class="pln">devel gtk2</span><span class="pun">-</span><span class="pln">devel jansson</span><span class="pun">-</span><span class="pln">devel binutils</span><span class="pun">-</span><span class="pln">devel</span>
第 3 步。在 Rocky Linux 9 上安装 Asterisk。
准备好系统后,是时候从源代码下载和编译Asterisk了:
<span class="pln">http</span><span class="pun">:</span><span class="com">//downloads.asterisk.org/pub/telephony/asterisk/asterisk-20-current.tar.gz</span>
使用以下命令解压缩下载的压缩包:
<span class="pln">tar </span><span class="pun">-</span><span class="pln">zxvf asterisk</span><span class="pun">-</span><span class="lit">20</span><span class="pun">-</span><span class="pln">current</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">gz cd asterisk</span><span class="pun">-</span><span class="lit">20.</span><span class="pun">*/</span>
要根据您的需要优化Asterisk,请运行配置脚本并选择适当的选项:
<span class="pun">./</span><span class="pln">configure</span>
配置完成后,使用以下命令编译星号:
<span class="pln">make sudo make install</span>
第 4 步。设置基本 PBX。
现在Asterisk已经安装好了,让我们设置一个基本的PBX系统来演示它的功能:
<span class="pln">sudo nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">asterisk</span><span class="pun">/</span><span class="pln">sip</span><span class="pun">.</span><span class="pln">conf</span>
在此文件中,您可以定义 SIP 用户、密码和其他参数,以便设备通过 SIP 进行通信。
接下来,编辑分机配置文件 () 以创建分机和拨号计划:extensions.conf
<span class="pln">sudo nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">asterisk</span><span class="pun">/</span><span class="pln">extensions</span><span class="pun">.</span><span class="pln">conf</span>
在此文件中,您将定义拨号计划,包括应如何根据分机路由传入和传出呼叫。
要测试基本的 PBX 功能,请在您的计算机或移动设备上使用 SIP 软件电话应用程序。使用 中定义的 SIP 用户凭据配置软件电话,并对其他 SIP 用户/分机进行测试呼叫。sip.conf
第5步。保护星号
安全的 PBX 对于保护敏感的通信和数据至关重要。以下是增强Asterisk安全性的方法:
- 防火墙设置:
配置防火墙(例如 firewalld)以控制传入和传出网络流量:
<span class="pln">sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="kwd">add</span><span class="pun">-</span><span class="pln">port</span><span class="pun">=</span><span class="lit">5060</span><span class="pun">/</span><span class="pln">udp </span><span class="pun">--</span><span class="pln">permanent sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">reload</span>
- 失败2禁止集成:
通过集成 Fail2Ban,保护您的 PBX 免受暴力攻击:
<span class="pln">sudo dnf install fail2ban sudo cp </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">fail2ban</span><span class="pun">/</span><span class="pln">jail</span><span class="pun">.</span><span class="pln">conf </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">fail2ban</span><span class="pun">/</span><span class="pln">jail</span><span class="pun">.</span><span class="kwd">local</span><span class="pln"> sudo nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">fail2ban</span><span class="pun">/</span><span class="pln">jail</span><span class="pun">.</span><span class="kwd">local</span>
在文件中,配置特定于星号的设置以禁止恶意 IP。jail.local
感谢您使用本教程在您的 Rocky Linux 9 系统上安装 Asterisk。有关其他帮助或有用信息,我们建议您查看Asterisk官方网站。