1. 程式人生 > >使用Resiprocate 部署 WebRTC IM 視訊通話平臺

使用Resiprocate 部署 WebRTC IM 視訊通話平臺

為什麼選用SIP協議來部署WebRTC 通訊系統?

1,互通性,基於sip 協議有大量的軟硬體裝置,例如: ip 話機,軟電話,ip攝像頭等等,MCU 裝置等。

2,穩定性,sip 協議歷史悠久,且大量的公司使用它開發ip 通訊系統,文件豐富,功能強大。

3,支援與電話系統互通,我們可以通過webrtc + sip,來完成與電話系統的對接,例如ippbx,呼叫中心,企業內線電話。

resiprocate 簡介

ReSIProcate由SIPFoundry開發,ReSIProcate最開始起源於Vocal,由於Vocal開始只支援rfc3254,為了支援最新的rfc3261,ReSIProcate誕生了,但現在,ReSIProcate已經成為一個獨立SIP協議棧了,它十分穩定,並且很多商業程式都在使用

準備環境:

CentOS 6.X 64 位系統

安裝GCC G++, automake,autoconf  等開發環境

yum -y install gcc gcc-c++ automake autoconf libtool openssl-devel db4-devel

1,下載resiprocate 1.9.2版

wget https://www.resiprocate.org/files/pub/reSIProcate/releases/resiprocate-1.9.2.tar.gz

下載編譯依賴

wget https://www.resiprocate.org/files/pub/reSIProcate/releases/resiprocate-contrib-1.9.2.tar.gz

tar zxvf resiprocate-1.9.2.tar.gz

tar zxvf resiprocate-contrib-1.9.2.tar.gz

mv contrib resiprocate-1.9.2

cd resiprocate-1.9.2

./configure --with-pic --with-ssl

make -j4

當提示 AsyncSocketBase.hxx:5:20: error: asio.hpp: No such file or directory 錯誤時可忽略

直接編譯repro

cd repro

make -j4

如遇到提示沒有找到 cajun/json/reader.h 等等錯誤

拷貝一下標頭檔案到預設include 目錄

cp -rf ../contrib/cajun/include/cajun /usr/include/

如果編譯順利,可以在目錄下看到repro 檔案.

./repro 即可執行,這裡我們暫不執行,先配置設定

拷貝配置檔案到新的名稱

cp repro.config.ws repro-ext-sip-phone.conf

vi repro-ext-sip-phone.conf

假設你的伺服器ip為 1.2.3.4

修改管理埠為 8080

# Port on which to run the HTTP configuration interface and/or certificate server
# 0 to disable (default: 5080)
HttpPort = 8080

為了測試方便先關掉http認證

# disable HTTP challenges for web based configuration GUI
DisableHttpAuth = true

修改ws transport 監聽

# Transport5Interface = 192.168.1.106:5062
# Transport5Type = WS
# Transport5RecordRouteUri = auto

取消註釋修改為

Transport5Interface = 1.2.3.4:5080
Transport5Type = WS
Transport5RecordRouteUri = sip:1.2.3.4:5080;transport=ws

# Disable DIGEST challenges - disables this monkey //為了測試方便暫時關掉sip認證
DisableAuth = true

新增SIP Domain

開啟伺服器地址 htt://1.2.3.4:8080/

點選login 進入,如果提示輸入使用者名稱密碼,輸入 admin/admin

點選Domain, 右側New Domain 輸入 1.2.3.4 點選Add


點選Resetart Proxy

開啟您所部署的 ext_sip_phone的頁面

http://1.2.3.4/ext_sip_phone/

使用者名稱密碼任意輸入,ip 填您的伺服器地址,點選登陸

登陸成功後即可進行sip 呼叫,

如需在公網部署,解決stun 和turn 問題請參考 另一篇博文 <

repro 伺服器也可以支援 sipml5, 或jssip 等webphone

再來一張截圖


ext_sip_phone 原始碼請加群

WebRTC技術討論群 234795279 群共享下載