本安装在cenos7 上测试使用
环境配置
yum install -y gcc gcc-c++
yum install -y ncurses-devel
yum install -y flex
yum install -y bison
开启防火墙5060端口
firewall-cmd --zone=public --add-port=5060/udp --permanent
firewall-cmd --reload
下载源码并选择模块
wget https://opensips.org/pub/opensips/2.4.6/opensips-2.4.6.tar.gz
tar -zxvf opensips-2.4.6.tar.gz
cd opensips-2.4.6
make all
make menuconfig
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4ZFm24NY-1572707198498)(en-resource://database/17996:1)]
左右键进入返回,空格键选中,回车键确定
Configure Compile Options,选中db_mysql保存
选择Compile And Install OpenSIPS编译安装
完成后会回到这个界面,保存退出
修改配置
cd /usr/local/etc/opensips/
ls
vim opensipsctlrc
vi opensips.cfg
创建数据库
cd /usr/local/sbin
opensipsdbctl create
.............
MySQL password for root:
INFO: test server charset
INFO: creating database sip ...
INFO: Using table engine MyISAM.
INFO: Core OpenSIPS tables successfully created.
Install presence related tables? (Y/n): y
INFO: creating presence tables into sip ...
INFO: Presence tables successfully created.
Install tables for
b2b
cachedb_sql
call_center
carrierroute
cpl
domainpolicy
emergency
fraud_detection
freeswitch_scripting
imc
registrant
siptrace
userblacklist
? (Y/n): y
INFO: creating extra tables into sip ...
INFO: Extra tables successfully created.
启动
opensipsctl start
... ...
[root@MiWiFi-R1D-srv sbin]# opensipsctl start
INFO: Starting OpenSIPS :
INFO: started (pid: 60957)
重新启动
opensipsctl restart
查看opensips进程
ps -aux | grep opensips
......
[root@MiWiFi-R1D-srv sbin]# ps -aux | grep opensips
root 60957 0.0 0.1 70544 4436 ? S 04:24 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
root 60958 0.0 0.0 70544 688 ? S 04:24 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
root 60959 0.2 0.0 70544 476 ? S 04:24 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
root 60960 0.0 0.0 70544 688 ? S 04:24 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
root 60961 0.0 0.0 70544 928 ? S 04:24 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
root 60962 0.0 0.0 70544 928 ? S 04:24 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
root 60963 0.0 0.0 70544 928 ? S 04:24 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
root 60964 0.0 0.0 70544 928 ? S 04:24 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
root 60965 0.0 0.0 70544 928 ? S 04:24 0:00 /usr/local/sbin/opensips -P /var/run/opensips.pid
root 61013 0.0 0.0 112712 964 pts/0 S+ 04:25 0:00 grep --color=auto opensips
注册用户格式 opensipsctl 用户名 密码
opensipsctl add 1001 1001
opensipsctl add 1002 1002
opensipsctl add 1003 1003
opensipsctl add 1004 1004
查询本地IP地址
ip route get 8.8.8.8 | head -n +1 | tr -s " " | cut -d " " -f 7