OpenSIPS is an Open Source SIP proxy/server for voice, video, IM, presence and any other SIP extensions.OpenSIPS is a multi-functional, multi-purpose signaling SIP server used by carriers, telecoms or ITSPs for solutions like Class4/5 Residential Platforms, Trunking / Wholesale, Enterprise / Virtual PBX Solutions, Session Border Controllers, Application Servers, Front-End Load Balancers, IMS Platforms, Call Centers, and many others – see the full Set of Features.
搜索一下网上安装opensips的文章基本都是源码安装的,虽然从源码安装并不是十分困难,但是在安装过程中需要处理各种依赖库。并且在某些系统上会出现编译不过的问题,在阿里云的服务器上很容易就通过源码安装好了opensips。但是由于阿里云的ecs没有经典网络,所以无法在公网ip绑定服务,导致客户端无法正常连接。如果有在阿里云部署服务的,那么可能会在这个地方失败。
在内网尝试部署的时候出现了另外一个问题,那就是源码编译不过去。搜索了一下发现其实可以通过ubuntu的apt命令进行安装,不过官方的apt源限定了linux的发行版本。所以在安装之前最好先确认一下,建议使用ubuntu18.04.
OpenSIPS Releases:
OpenSIPS related packages:
Supported Platforms:
Supported Architectures:
官方apt连接地址:https://apt.opensips.org
1.添加opensips apt源:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 049AD65B
echo "deb https://apt.opensips.org bionic 3.1-releases" >/etc/apt/sources.list.d/opensips.list
echo "deb https://apt.opensips.org bionic cli-nightly" >/etc/apt/sources.list.d/opensips-cli.list
2.安装opensips
sudo apt install opensips
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 049AD65B
echo "deb https://apt.opensips.org bionic cli-nightly" >/etc/apt/sources.list.d/opensips-cli.list
4.安装opensips-cli
apt install opensips-console
5.安装mysql server,配置数据库连接
apt install mysql-server
sudo mysql_secure_installation
6.修改配置文件:
# vi /usr/local/etc/opensips/opensips.cfg
listen=udp:192.168.1.124:5060 # CUSTOMIZE ME
# vi /usr/local/etc/opensips/opensipsctlrc
DBENGINE=MYSQL
DBPORT=3306
DBHOST=127.0.0.1
DBNAME=opensips
DBRWUSER=opensips
DBRWPW="opensipsrw"
DBROOTUSER="root"
到目前安装部分就完成了,不过如果这时候执行opensipsdbctrl create可能会出现下面的错误信息:
# opensipsdbctl create
ERROR: could not load the script in /usr/local//lib64/opensips/opensipsctl/opensipsdbctl.mysql for database engine MYSQL
ERROR: database engine not loaded - tried 'MYSQL'
这是由于安装的时候缺少mysql文件导致的,缺少的文件从源代码中找。我整理了一份,可以直接将这个文件解压后放入opensipsctl目录下。
下载链接:https://obaby.lanzous.com/io04cnakwwh
然后再次创建数据库即可,通过以下命令添加用户:
# opensipsctl add 10001 123456
ERROR: domain unknown: use usernames with domain or set default domain in SIP_DOMAIN
# 如果出现上面的错误信息,修改opensipsctlrc将SIP_DOMAIN的注释去掉,填写自己的域名或者IP地址
# opensipsctl add 10001@testtest.com.cn 123456
new user '10001@testtest.com.cn' added
然后就可以通过客户端链接了,例如linphone(windows版本下载链接:https://www.linphone.org/releases/windows/app/Linphone-4.2.5-win32.exe,下载页面链接:https://new.linphone.org/technical-corner/linphone?qt-technical_corner=2#qt-technical_corner):
在服务器可以通过 opensipsctl ul show命令查看连接的客户端:
☆文章版权声明☆
* 网站名称:obaby@mars
* 网址:https://h4ck.org.cn/
* 本文标题: 《ubuntu 18.04 安装opensips 3.1》
* 本文链接:https://h4ck.org.cn/2021/03/ubuntu-18-04-%e5%ae%89%e8%a3%85opensips-3-1/
* 转载文章请标明文章来源,原文标题以及原文链接。请遵从 《署名-非商业性使用-相同方式共享 2.5 中国大陆 (CC BY-NC-SA 2.5 CN) 》许可协议。
分享文章: