中小企业做法

只能满足大概五人的实时视频通话。
搭建AppRTC开发环境,服务器组成包含:
AppRTC 房间+Web服务器 https://github.com/webrtc/apprtc
Collider 信令服务器,包含在AppRTC源码里 (Collider服务器是基于Golang开发的,并使用了google
appengine的python开发包)
CoTurn coturn打洞+中继服务器
Nginx 服务器,用于Web访问代理和Websocket代理。

有实力的公司业务

基于Janus做二次开发逐渐成为主流趋势
https://janus.conf.meetecho.com/
https://github.com/meetecho/janus-gateway

Janus 是⼀个开源的,通过 C 语⾔实现了对 WebRTC ⽀持的 Gateway;Janus ⾃身实现得很简单,提供插件机制来⽀持不同的业务逻辑,配合官⽅⾃带插件就可以⽤来实现⾼效的 Media Server 服务。

Centos部署Janus

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

# 环境部署一般配置
yum install -y epel-release && \
yum update -y && \
yum install -y deltarpm && \
yum install -y openssh-server sudo which file curl zip unzip wget && \
yum install -y libmicrohttpd-devel jansson-devel libnice-devel glib22-devel
opus-devel libogg-devel pkgconfig gengetopt libtool autoconf automake make gcc
gcc-c++ git cmake libconfig-devel openssl-devel
# 升级libsrtp 注意和openssl的版本兼容性 升级你的版本
wget https://github.com/cisco/libsrtp/archive/v2.1.0.tar.gz
wget https://github.com/cisco/libsrtp/archive/v1.5.4.tar.gz
tar xfv v1.5.4.tar.gz
cd libsrtp-1.5.4
./configure --prefix=/usr --enable-openssl
make shared_library && sudo make install
#install sofia-sip for sip-gateway plugin
wget https://sourceforge.net/projects/sofia-sip/files/sofia-sip/1.12.11/sofiasip-1.12.11.tar.gz
tar zxf sofia-sip-1.12.11.tar.gz && cd sofia-sip-1.12.11 && ./configure --
prefix=/usr CFLAGS=-fno-aggressive-loop-optimizations && make && make install
#install usrsctp for Data channel support
git clone https://github.com/sctplab/usrsctp && cd usrsctp && \
./bootstrap && \
./configure --prefix=/usr && make && make install

#install libwebsocket for android or ios instead of http/https
git clone https://github.com/warmcat/libwebsockets && \
mkdir libwebsockets/build && cd libwebsockets/build && \
cmake -DMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" .. && \
make && make install
#Janus
#if cannot configure plugin sofia,Perhaps you should add the directory containing
`sofia-sip-ua.pc' to the PKG_CONFIG_PATH environment variable,
#for example centos7 :export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig
#if cannot load libsofia-sip-ua.so.0 , try ldconfig -v
git clone https://github.com/meetecho/janus-gateway.git && \
cd janus-gateway &&\
sh autogen.sh && \
./configure --prefix=/opt/janus --disable-rabbitmq --disable-docs &&\
make && make install && make configs

参考资料

  1. https://www.w3.org/TR/webrtc/
  2. https://datatracker.ietf.org/doc/draft-nandakumar-rtcweb-sdp/?include_text=1
  3. https://webrtc.googlesource.com/src/+/master/examples
  4. https://www.zego.im/product/whiteboardview
  5. https://janus.conf.meetecho.com/
  6. https://github.com/meetecho/janus-gateway