freeswitch+webrtc
起初 接到這任務 本以爲很簡單的事 因爲自己在書上見過只要小改就可以讓freeswitch支持webrtc 事與願違啊 蒼天弄人 啊
開始 修改freeswitch的配置 /conf/sip_profiles/internal.xml 將ws-binding 的註釋取消 也就是將端口號5066 打開 使其支持websocket
書上說的以後只要添加上需要的解碼器就可以使用 但是結果 壓根用不了 (人家5066是不需要sll的 但FS 老人家不讓你過 一定要SSl)
之後就是在一個勁的鼓搗 7443 端口號 也就是internal.xml文檔裏面的
<param name="tls-cert-dir" value="/usr/local/freeswitch/certs"/>
<param name="wss-binding" value=":7443"/>
完事之後 在/usr/local/freeswitch/certs 下將wss.pem 等文件拷貝進去就可以了
(還有一些參數的設置 不太清楚管不管用 先列出來 <X-PRE-PROCESS cmd="set" data="internal_auth_calls=true"/>
<X-PRE-PROCESS cmd="set" data="external_auth_calls=ture"/>
)
wss.pem等文件的生成可以參考網上的資料 (
Configure SSL for WebRTC
Create a Root tls key.
openssl genrsa -out rootCA.key 2048
Create a self signed cert using your key.
openssl req -x509 -new -nodes -key rootCA.key -days 1024 -out rootCA.pem
Fill out everything to the best of your ability. Make sure you include your fully qualified domain name. Create the directories Freeswitch will look for these keys.
mkdir /etc/freeswitch/certs
mkdir /etc/freeswitch/tls
Create wss.pem and dtls-srtp.crt files from your tls keys.
cat rootCA.pem rootCA.key > /etc/freeswitch/certs/wss.pem
cat rootCA.pem > /etc/freeswitch/tls/dtls-srtp.crt
Uncomment wss-binding and set the tls-cert-dir in your internal sip profile. These two lines should look like this in your /etc/freeswitch/sip_profiles/internal.xlm
nano /etc/freeswitch/sip_profiles/internal.xml
<param name="tls-cert-dir" value="/etc/freeswitch/certs"/>
<param name="wss-binding" value=":7443"/>
Change the default registration password to prevent the world from logging in and making calls on your server.
nano /etc/freeswitch/vars.xml
<X-PRE-PROCESS cmd="set" data="default_password=your_cool_new_password"/>
Reload the freeswitch settings by starting up the freeswitch console and executing reloadxml.
fs_cli
>reloadxml
>/exit
)
webrtc客戶端 我使用的是 jssip開源的一個demo https://tryit.jssip.net/
使用谷歌瀏覽器 將證書添加 打開 https://139.129.13.218:7443/ws
之後在頁面上輸入相應的信息 並且將advanced settings 裏面的session_timers取消
至此 客戶端可以使用了
但是本人PC 一直使用不了 查看LOG文件是因爲 AUDIO RTP REPORTS ERROR: [Remote Address Error!]
這個問題是因爲ipV6 使得地址識別不了 因此不能用 下面的方法可以將ipv6的問題解決
只需要使用以下3條命令把IPv6的接口關閉即可,在命令提示符窗口中輸入以下命令運行即可解決了關閉ipv6。
netsh interface teredo set state disable
netsh interface 6to4 set state disabled
netsh interface isatap set state disabled
或者 netsh interface IPV6 set global randomizeidentifier=disabled
netsh interface IPV6 set privacy state=disable
netsh interface ipv6 6to4 set state state=disabled
netsh interface ipv6 isatap set state state=disabled
netsh interface ipv6 set teredo=disable
好了 大功告成!!!!!!!!!!
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.