搭建WebRTC视频会议服务02

本节开始安装MCU Server。
MCU Server有两种工作模式,一种是通过GPU,一种是通过CPU,由于我用的是虚拟机,所以这里用的是CPU。
MCU Server是自带自签名证书的域名与实际域名不匹配,所以大家要生成自己的证书。

1、权限配置
1.1、/etc/security/limits.conf

* hard nproc unlimited
* soft nproc unlimited
* hard nofile 163840
* soft nofile 163840
* hard stack 1024
* soft stack 1024

1.2、/etc/pam.d/login

session required pam_limits.so

1.3、/etc/security/limits.d/xx-nproc.conf

* hard nproc unlimited
* soft nproc unlimited

1.4、/etc/sysctl.conf

fs.file-max=200000
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.core.rmem_default=16777216
net.core.wmem_default=16777216
net.ipv4.udp_mem=4096 87380 16777216
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
net.ipv4.tcp_mem=8388608 8388608 16777216

1.5、启用设置

sudo  /sbin/sysctl -p
ulimit -a

2、解压文件

tar -xf CS_WebRTC_Conference_Server_MCU.v4.1.tgz
mv Release-v4.1 /neohope/webrtc/MCU-Release-v4.1

3、编译依赖库
3.1、Cisco OpenH264

cd /neohope/webrtc/MCU-Release-v4.1/video_agent
#编译并安装依赖库
install_deps.sh
#关闭支持
#uninstall_openh264.sh
#开启支持
#install_openh264.sh

3.2、ffmpeg with libfdk_aac

cd /neohope/webrtc/MCU-Release-v4.1/audio_agent
compile_ffmpeg_with_libfdkaac.sh
mv ffmpeg_libfdkaac_lib/* lib/

4、初始化服务
4.1、生成证书

#生成RSA私钥
openssl genrsa -out ryans-key.pem 2048

Generating RSA private key, 2048 bit long modulus
..........................................................+++
................................................................................                                                                              

........................................+++
e is 65537 (0x10001)

#生成CSR(certificate signing request) 
openssl req -new -sha256 -key ryans-key.pem -out ryans-csr.pem

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:SH
Locality Name (eg, city) [Default City]:SH
Organization Name (eg, company) [Default Company Ltd]:NEOHOPE
Organizational Unit Name (eg, section) []:RD
Common Name (eg, your name or your server's hostname) []:172.16.172.80
Email Address []:NEOHOPE@YAHOO.COM

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

#生成自签名证书
openssl x509 -req -in ryans-csr.pem -signkey ryans-key.pem -out ryans-cert.pem

Signature ok
subject=/C=CN/ST=SH/L=SH/O=NEOHOPE/OU=RD/CN=172.16.172.80/emailAddress=NEOHOPE@Y                                                                              
AHOO.COM
Getting Private key

#转换为p12格式
#openssl pkcs12 -export -in ryans-cert.pem -inkey ryans-key.pem -certfile ca-cert.pem -out ryans.pfx
openssl pkcs12 -export -in ryans-cert.pem -inkey ryans-key.pem -out ryans.pfx

Enter Export Password:
Verifying - Enter Export Password:

4.2、安装证书

cp ryans.pfx ../MCU-Release-v4.1/extras/basic_example/cert/certificate.pfx 
cp ryans.pfx ../MCU-Release-v4.1/portal/cert/certificate.pfx 
#cp ryans.pfx ../MCU-Release-v4.1/webrtc_agent/cert/certificate.pfx 
cp ryans.pfx ../MCU-Release-v4.1/management_console/cert/certificate.pfx 

#然后分别到basic_example、portal、management_console下面,执行
node initcert.js

5、初始化服务

#非GPU加速
bin/init-all.sh
#GPU加速
#bin/init-all.sh --hardware

6、开启服务

bin/start-all.sh
starting nuve, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-nuve.stdout
starting cluster-manager, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-cluster-manager.stdout
starting audio-agent, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-audio-agent.stdout
starting conference-agent, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-conference-agent.stdout
2018-10-11 00:24:30.336  - INFO: AmqpClient - Connecting to rabbitMQ server OK, hostPort: { host: 'localhost', port: 5672 }
2018-10-11 00:24:30.366  - INFO: ErizoAgent - conference agent join cluster ok.
2018-10-11 00:24:30.415  - INFO: ClusterWorker - Join cluster woogeen-cluster OK.
2018-10-11 00:24:30.429  - INFO: ErizoAgent - as rpc server ok.
2018-10-11 00:24:30.431  - INFO: ErizoAgent - as monitoring target ok.
starting recording-agent, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-recording-agent.stdout
2018-10-11 00:24:32.547  - INFO: AmqpClient - Connecting to rabbitMQ server OK, hostPort: { host: 'localhost', port: 5672 }
starting sip-agent, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-sip-agent.stdout
2018-10-11 00:24:33.886  - INFO: AmqpClient - Connecting to rabbitMQ server OK, hostPort: { host: 'localhost', port: 5672 }
2018-10-11 00:24:33.914  - INFO: ErizoAgent - sip agent join cluster ok.
2018-10-11 00:24:33.961  - INFO: ClusterWorker - Join cluster woogeen-cluster OK.
2018-10-11 00:24:33.970  - INFO: ErizoAgent - as rpc server ok.
2018-10-11 00:24:33.973  - INFO: ErizoAgent - as monitoring target ok.
starting streaming-agent, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-streaming-agent.stdout
2018-10-11 00:24:35.160  - INFO: AmqpClient - Connecting to rabbitMQ server OK, hostPort: { host: 'localhost', port: 5672 }
2018-10-11 00:24:35.187  - INFO: ErizoAgent - streaming agent join cluster ok.
2018-10-11 00:24:35.235  - INFO: ClusterWorker - Join cluster woogeen-cluster OK.
2018-10-11 00:24:35.246  - INFO: ErizoAgent - as rpc server ok.
2018-10-11 00:24:35.262  - INFO: ErizoAgent - as monitoring target ok.
starting video-agent, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-video-agent.stdout
2018-10-11 00:24:36.529  - INFO: AmqpClient - Connecting to rabbitMQ server OK, hostPort: { host: 'localhost', port: 5672 }
2018-10-11 00:24:36.563  - INFO: ErizoAgent - video agent join cluster ok.
2018-10-11 00:24:36.603  - INFO: ClusterWorker - Join cluster woogeen-cluster OK.
2018-10-11 00:24:36.616  - INFO: ErizoAgent - as rpc server ok.
2018-10-11 00:24:36.631  - INFO: ErizoAgent - as monitoring target ok.
starting webrtc-agent, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-webrtc-agent.stdout
2018-10-11 00:24:37.938  - INFO: AmqpClient - Connecting to rabbitMQ server OK, hostPort: { host: 'localhost', port: 5672 }
2018-10-11 00:24:37.964  - INFO: ErizoAgent - webrtc agent join cluster ok.
2018-10-11 00:24:37.999  - INFO: ClusterWorker - Join cluster woogeen-cluster OK.
2018-10-11 00:24:38.020  - INFO: ErizoAgent - as rpc server ok.
2018-10-11 00:24:38.024  - INFO: ErizoAgent - as monitoring target ok.
starting management-console, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-management-console.stdout
Start management-console HTTP server
starting portal, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-portal.stdout
2018-10-11 00:24:40.691  - INFO: AmqpClient - Connecting to rabbitMQ server OK, hostPort: { host: 'localhost', port: 5672 }
2018-10-11 00:24:40.715  - INFO: Main - portal initializing as rpc client ok
2018-10-11 00:24:40.733  - INFO: Main - portal join cluster ok, with rpcID: portal-089f86b5d0a4c156d6b5@172.16.172.80
2018-10-11 00:24:40.734  - INFO: ClusterWorker - Join cluster woogeen-cluster OK.
2018-10-11 00:24:40.741  - INFO: Main - portal initializing as rpc server ok
2018-10-11 00:24:40.748  - INFO: Main - portal-089f86b5d0a4c156d6b5@172.16.172.80 as monitor ready
starting sip-portal, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-sip-portal.stdout
starting app, stdout -> /home/neohope/webrtc/MCU-Release-v4.1/logs/woogeen-app.stdout

7、测试服务,访问地址
7.1、你可以用浏览器浏览这个页面,可以看到自己的输入和输出视频画面
https://172.16.172.80:3004/

7.2、你可以用多个浏览器浏览这个页面,可以看到多路视频被合并为一个视频画面了。
https://172.16.172.80:3004/

7.3、如果不想合并多路视频,而是直接获取单个视频,可以用这个链接
https://172.16.172.80:3004/?forward=true

7.4、你可以用这个URL加入某个视频会议的房间
https://172.16.172.80:3004/?room=root_id
房间ID,在启动时,会输出到命令行及日志。

7.5、可以进入管理页面
https://172.16.172.80:3300/console/
需要输入Service_ID及Service_KEY。
可以在MCU-Release-v4.1/extras/basic_example/samplertcservice.js,查找这行代码即可得到:

icsREST.API.init('_service_ID_', '_service_KEY_', 'http://localhost:3000/', true);

8、停止服务

bin/stop-all.sh
stopping nuve
stopping cluster-manager
stopping audio-agent
stopping conference-agent
stopping recording-agent
stopping sip-agent
stopping streaming-agent
stopping video-agent
stopping webrtc-agent
stopping management-console
stopping portal.
stopping sip-portal
stopping app

Leave a Reply

Your email address will not be published. Required fields are marked *

*