安裝FreeSwitch
主要命令如下:
git clone -b v1.2.stable git://git.freeswitch.org/freeswitch.git
cd freeswitch/
./bootstrap.sh && ./configure && make && make install && make hd-sounds-install && make hd-moh-install && make samples
最後一個命令大約執行20分鐘
缺省安裝目錄:/usr/local/freeswitch/
FreeSwitch所需的端口列表(需在防火牆設置裏打開):http://wiki.freeswitch.org/wiki/Firewall
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"/>
檢驗是否安裝成功
FreeSwitch安裝後缺省用戶是1000~1020,密碼均爲1234。用任意sip客戶端(boghe, linphone, x-lite等等)登錄,撥9664應該可以聽到等待音樂,說明安裝成功了。還有一些功能號碼,總結如下:
------------------
號碼 | 說明
----------------------
9664 | 保持音樂
9196 | echo,迴音測試
9195 | echo,迴音測試,延遲5秒
9197 | milliwatte extension,鈴音生成
9198 | TGML 鈴音生成示例
5000 | 示例IVR
4000 | 聽取語音信箱
33xx | 電話會議,48K(其中xx可爲00-99,下同)
32xx | 電話會議,32K
31xx | 電話會議,16K
30xx | 電話會議,8K
2000-2002 | 呼叫組
1000-1019 | 默認分機號
曾遇到過一個問題,接通9664後立刻被自動掛斷,接上攝像頭後問題消失。
配置電信/聯通雙線
複製internal.xml爲internal2.xml,修改internal2.xml裏第一行的name爲internal2,再將sip-ip和rtp-ip改爲與internal裏不同的那個公網ip,重啓freeswitch即可。(用sofia status命令應該可以看到新建的internal2生效)
要使用智能域名解析,將vars.xml裏的domain改爲域名即可。
防掉線
在profile文件裏修改nat-options-ping屬性爲true,大約每30秒FreeSwitch會發一個options包給客戶端以保持連接。
http://wiki.freeswitch.org/wiki/Sofia.conf.xml#nat-options-ping
中文語音
中文語音包下載和使用方法:https://groups.google.com/forum/#!topic/freeswitch-cn/gYXmAv7sGKU
參考資料
http://www.dujinfang.com/2010/04/14/freeswitch-chu-bu.html