OpenSIPS 一鍵安裝腳本-及 OpenSIPs+N個FreeSWITCH 實戰技巧

本文提供一個OpenSIPS的一鍵安裝包,OpenSIPs 能夠做爲FreeSwitch 的前端代理,實現多個FreeSwitch 負載均衡處理呼叫流量。html

以 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.shgit

安裝完成 opensips 自定啓動
OpenSIPS  一鍵安裝腳本-及 OpenSIPs+N個FreeSWITCH 實戰技巧數據庫

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 <setid> <destination> <socket> <state> <weight> <attrs> [description]負載均衡

  • Examples: dispatcher addgw 1 sip:1.2.3.1:5050 '' 0 50 'og1' 'Outbound Gateway1'
  • dispatcher addgw 2 sip: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 1 sip:47.89.33.209:5099 "" 0 50 'us2' 'wandan.wdjbp.com'dom

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');socket

opensipsctl fifo lb_reloadide

dispatcher show ..................... show dispatcher gateways
dispatcher reload ................... reload dispatcher gateways
dispatcher dump ..................... show in memory dispatcher gateways
dispatcher addgw <setid> <destination> <socket> <state> <weight> <attrs> [description]
.......................... add gateway
dispatcher rmgw <id> ................ delete gateway

增長freeswitch 後端服務器
opensipsctl dispatcher show
dispatcher gateways
OpenSIPS  一鍵安裝腳本-及 OpenSIPs+N個FreeSWITCH 實戰技巧

opensipsctl dispatcher addgw 1 sip: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'

SIP帳號登錄前 先確保
vi /usr/local/freeswitch/conf/vars.xml

修改了vars.xml中的 domain 參數
<X-PRE-PROCESS cmd="set" data="domain=2224{local_ip_v4}"/>
改成
<X-PRE-PROCESS cmd="set" data="domain=h5.wdjbp.com"/>

FS節點須要在ACL裏面把 opensips 所在IP 加入白名單

測試驗證:
OpenSIPS  一鍵安裝腳本-及 OpenSIPs+N個FreeSWITCH 實戰技巧
OpenSIPS  一鍵安裝腳本-及 OpenSIPs+N個FreeSWITCH 實戰技巧
OpenSIPS  一鍵安裝腳本-及 OpenSIPs+N個FreeSWITCH 實戰技巧

文檔介紹:http://zengqf.gitee.io/ifreeswitchgui/docs/index.html詳細瞭解:qizhikefu2

相關文章
相關標籤/搜索