、如果是centos 7安装则使用yum 命令。
-
添加库地址
注意系统类型,选择对应的系统类型和版本
curl https://apt.opensips.org/opensips-org.gpg -o /usr/share/keyrings/opensips-org.gpg
echo "deb [signed-by=/usr/share/keyrings/opensips-org.gpg] https://apt.opensips.org bionic 3.4-releases" >/etc/apt/sources.list.d/opensips.list
echo "deb [signed-by=/usr/share/keyrings/opensips-org.gpg] https://apt.opensips.org bionic cli-nightly" >/etc/apt/sources.list.d/opensips-cli.list
2.安装opensips
apt install opensips
3.安装模块:
apt install opensips-http-modules opensips-mysql-module opensips-json-module opensips-wss-module opensips-tls-module
注:如果直接使用apt install opensips-* 容易报错不易安装。常用的就是httpd和wss,直接安装相关模块即可。
安装opensips-cli
1:添加库地址
![](https://i-blog.csdnimg.cn/blog_migrate/b8a19e87d0d3b419839ad5c2500ea89b.png)
执行安装命令
apt install opensips-cli
配置数据库
1:opensips配置
socket=udp:127.0.0.1:5060 # CUSTOMIZE ME
socket=ws:172.24.42.85:5060#ws module
loadmodule "proto_ws.so"
#loadmodule "proto_webrtc.so"
#http module
loadmodule "httpd.so"
modparam("httpd","ip","172.24.42.85")
modparam("httpd","port",8888)
loadmodule "mi_http.so"
配置完毕opensip.cfg以后,输入命令重启服务:service opensips restart
2:opensips-cli配置
[default]
log_level: INFO
prompt_name: opensips-cli
database_admin_url: mysql://root:密码@127.0.0.1databse_modules: ALL
database_force_drop: true
输入创建数据库命令执行自动执行创建数据库
opensips-cli -x database create
注:需要将防火墙端口打开放行
测试http服务是否已经能够正常连接,注意Content-Type的类型为:application/json-rpc
具体的接口参数等查看官方手册
openSIPS | Documentation / OpenSIPS Manual - 3.4