本文提供一个OpenSIPS的一键安装包,OpenSIPs 可以作为FreeSwitch 的前端代理,实现多个FreeSwitch 负载均衡处理呼叫流量。以opensips-2.1.2.tar.gz 为例
安装环境CentOS 6.x 64 bit
Step 1 Download
下载数据库配置文件 修改数据库信息
wget https://hk-area1-file.oss-cn-hongkong.aliyuncs.com/fsgui/init.conf
下载安装脚本
wget https://hk-area1-file.oss-cn-hongkong.aliyuncs.com/fsgui/opensips_install.sh
安装命令
sh opensips_install.sh
安装完成 opensips 自定启动
Step 2 启动
/usr/local/sbin/opensipsctl start
停止
/usr/local/sbin/opensipsctl stop
Step 3 常用命令
/usr/local/sbin/opensipsctl start
ps -ef|grep opensips
/usr/local/sbin/opensipsctl stop
ps aux | grep opensips(查看进程)
netstat -ulpn|grep opensips(查看UDP链接状态)
netstat -utpn|grep opensips(查看TCP链接状态)
/usr/local/sbin/opensips -c 检查配置是否正确
增加freeswitch 后端服务器
opensipsctl dispatcher show
dispatcher addgw [description]
*Examples: dispatcher addgw 1sip:1.2.3.1:5050 '' 0 50 'og1' 'Outbound Gateway1'
* dispatcher addgw 2sip:1.2.3.4:5050 '' 0 50 'og2' 'Outbound Gateway2'
* dispatcher rmgw 4
opensipsctl dispatcher addgw 1 sip:47.91.133.205:5099 "" 0 50 'us1' 'cs.wdjbp.com'
opensipsctl dispatcher addgw 1sip:47.89.33.209:5099 "" 0 50 'us2' 'wandan.wdjbp.com'
insert into load_balancer(group_id,dst_uri,resources,description) values(1,'sip:47.91.133.205:5099','pstn=100','hk1');
insert into load_balancer(group_id,dst_uri,resources,description) values(1,'sip:47.89.33.209:5099','pstn=100','hk2');
opensipsctl fifo lb_reload
dispatcher show ..................... showdispatcher gateways
dispatcher reload ...................reload dispatcher gateways
dispatcher dump ..................... showin memory dispatcher gateways
dispatcher addgw [description]
.......................... addgateway
dispatcher rmgw ................delete gateway
增加freeswitch 后端服务器
opensipsctl dispatcher show
dispatcher gateways
opensipsctl dispatcher addgw 1sip:182.92.158.206 "" 0 50 'hk1' 'hk1.wdjbp.com'
opensipsctl dispatcher addgw 1 sip:47.88.86.32 "" 0 50 'hk1' 'hk2.wdjbp.com'