1、freeswitch安裝
yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release yum install -y freeswitch-config-vanilla freeswitch-lang-* freeswitch-sounds-* systemctl enable freeswitch freeswitch
2、freeswitch配置
以上默認能撥通,但是沒聲音,30秒左右就自動斷線了,明顯跟freepbx一樣是NAT的故障
我偷懶用yun install安裝的freeswitch,配置文件在/etc/freeswitch目錄,安裝文件比較分散
/var/lib/yum/repos/x86_64/7/freeswitch
/var/lib/freeswitch
/var/cache/yum/x86_64/7/freeswitch
/var/log/freeswitch
/usr/lib64/freeswitch
/usr/share/freeswitch
/usr/bin/freeswitch
/run/freeswitch
/etc/sysconfig/freeswitch
/etc/freeswitch
需要打開的端口:
udp 16384:32768
udp 4569
udp 5060
tcp 5060
udp 5080
tcp 5080
tcp 8000
udp 8000
配置conf/autoload_configs/verto.conf.xml
<param name="ext-rtp-ip" data="外網ip">
配置conf/sip_profiles/internal.xml
<param name="aggressive-nat-detection" value="true"/>
<param name="multiple-registrations" value="true"/>
<param name="ext-rtp-ip" value="外網ip"/>
<param name="ext-sip-ip" value="外網ip"/>
<param name="NDLB-received-in-nat-reg-contact" value="true"/>
<param name="NDLB-force-rport" value="true"/>
<param name="NDLB-broken-auth-hash" value="true"/>
<param name="enable-timer" value="false"/>
<param name="auth-calls" value="true"/>
配置conf/sip_profiles/external.xml
<param name="aggressive-nat-detection" value="true"/>
<param name="ext-rtp-ip" value="外網ip"/>
<param name="ext-sip-ip" value="外網ip"/>
<param name="NDLB-force-rport" value="true"/>
配置conf/autoload_configs/switch.conf.xml
<param name="rtp-start-port" value="16384"/>
<param name="rtp-end-port" value="32768"/>
2) 關閉centos 7.2防火牆,先保持網絡通暢,調完了在配置防火牆端口。
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開機啟動
firewall-cmd --state #查看默認防火牆狀態(關閉后顯示notrunning,開啟后顯示running)
重啟freeswitch
freeswitch -stop
freeswitch
3、freeswitch測試
sample sipp scenarios for testing freeswitch
https://github.com/os11k/sipp2freeswitch
1) 更改文件invite-accounts.csv中的SIP Proxy配置
SEQUENTIAL
# Username: 1000-1009
# Password: 1234
# SIP Proxy: 182.61.56.247, Destination Number: 9196
1000;182.61.56.247;[authentication username=1000 password=1234];9196;
1001;182.61.56.247;[authentication username=1001 password=1234];9196;
1002;182.61.56.247;[authentication username=1002 password=1234];9196;
1003;182.61.56.247;[authentication username=1003 password=1234];9196;
1004;182.61.56.247;[authentication username=1004 password=1234];9196;
1005;182.61.56.247;[authentication username=1005 password=1234];9196;
1006;182.61.56.247;[authentication username=1006 password=1234];9196;
1007;182.61.56.247;[authentication username=1007 password=1234];9196;
1008;182.61.56.247;[authentication username=1008 password=1234];9196;
1009;182.61.56.247;[authentication username=1009 password=1234];9196;
2) 更改文件register-accounts.csv中的SIP Proxy配置
SEQUENTIAL
# Username: 1000-1009
# Password: 1234
# SIP Proxy: 182.61.56.247
1000;182.61.56.247;[authentication username=1000 password=1234]
1001;182.61.56.247;[authentication username=1001 password=1234]
1002;182.61.56.247;[authentication username=1002 password=1234]
1003;182.61.56.247;[authentication username=1003 password=1234]
1004;182.61.56.247;[authentication username=1004 password=1234]
1005;182.61.56.247;[authentication username=1005 password=1234]
1006;182.61.56.247;[authentication username=1006 password=1234]
1007;182.61.56.247;[authentication username=1007 password=1234]
1008;182.61.56.247;[authentication username=1008 password=1234]
1009;182.61.56.247;[authentication username=1009 password=1234]
3)注意invite-auth.xml文件中的g711a.pcap目錄
<exec play_pcap_audio="pcap/g711a.pcap"/>
4) 啟動測試
sipp -i 172.16.0.6 -sf register.xml -inf register-accounts.csv 182.61.56.247:5060 -r 1 -rp 1000 -aa -trace_err
sipp -i 172.16.0.6 -sf invite-auth.xml -inf invite-accounts.csv 182.61.56.247:5060 -r 1 -rp 1000 -trace_err
測試注冊,撥號,rtp數據都通了
4、FreeSwitch默認只支持音頻,為支持視頻,修改vars.xml如下:
<X-PRE-PROCESS cmd="set" data="global_codec_prefs=PCMU,PCMA,GSM,H264,H263-1998,H263"/>
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA,GSM,H264,H263-1998,H263"/>
5、杜金房的個人網站
https://github.com/os11k/sipp2freeswitch