为什么选用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
点击SETTINGS ,下拉到最下面
点击Resetart Proxy
打开您所部署的 ext_sip_phone的页面
http://1.2.3.4/ext_sip_phone/
用户名密码任意输入,ip 填您的服务器地址,点击登陆
登陆成功后即可进行sip 呼叫,
如需在公网部署,解决stun 和turn 问题请参考 另一篇博文 <<为WebRTC 应用部署Turn Server>>
repro 服务器也可以支持 sipml5, 或jssip 等webphone
再来一张截图
ext_sip_phone 源码请加群
WebRTC技术讨论群 234795279 群共享下载