本安裝在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