服务器环境
- Ubuntu 16.04
- 1核4G
- 已打开端口信息:
bbb安装
- 安装bbb2.2版本
- 我这里使用github上面提供的bbb-install.sh脚本进行安装,安装过程很慢,也多次提示错误,不过重复执行下面的命令最后也成功了,还是
推荐按照官网上面的步骤去安装
wget -qO- https://ubuntu.bigbluebutton.org/bbb-install.sh | bash -s -- -v xenial-220 -a
安装完成后的信息如下:
BigBlueButton Server 2.2.0-rc-2 (1613)
Kernel version: 4.4.0-142-generic
Distribution: Ubuntu 16.04.6 LTS (64-bit)
Memory: 4046 MB
CPU cores: 1
/usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties (bbb-web)
bigbluebutton.web.serverURL: http://172.18.243.192
defaultGuestPolicy: ALWAYS_ACCEPT
svgImagesRequired: true
/etc/nginx/sites-available/bigbluebutton (nginx)
server name: 172.18.243.192
port: 80, [::]:80
bbb-client dir: /var/www/bigbluebutton
/var/www/bigbluebutton/client/conf/config.xml (bbb-client)
Port test (tunnel): rtmp://172.18.243.192
red5: 172.18.243.192
useWebrtcIfAvailable: true
/opt/freeswitch/etc/freeswitch/vars.xml (FreeSWITCH)
local_ip_v4: 172.18.243.192
external_rtp_ip: stun:stun.freeswitch.org
external_sip_ip: stun:stun.freeswitch.org
/opt/freeswitch/etc/freeswitch/sip_profiles/external.xml (FreeSWITCH)
ext-rtp-ip: $${local_ip_v4}
ext-sip-ip: $${local_ip_v4}
ws-binding: :5066
wss-binding: :7443
/usr/local/bigbluebutton/core/scripts/bigbluebutton.yml (record and playback)
playback_host: 172.18.243.192
playback_protocol: http
ffmpeg: 4.1.3-0york1~16.04
/etc/bigbluebutton/nginx/sip.nginx (sip.nginx)
proxy_pass: 172.18.243.192
/usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml (Kurento SFU)
kurento.ip: 172.18.243.192
kurento.url: ws://127.0.0.1:8888/kurento
localIpAddress: 172.18.243.192
recordScreenSharing: true
recordWebcams: true
codec_video_main: VP8
codec_video_content: VP8
/usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml (HTML5 client)
build: 798
kurentoUrl: ws://172.18.243.192/bbb-webrtc-sfu
enableListenOnly: true
# Potential problems described below
# Not running: tomcat7 or grails
# Error: Found text in freeswitch.log:
#
# Thread ended for mod_event_socket
#
# FreeSWITCH may not be responding to requests on port 8021 (event socket layer)
# and users may have errors joining audio.
#
#
# Error: Unable to connect to the FreeSWITCH Event Socket Layer on port 8021
#
................................................................................
# Error: Could not connect to the configured hostname/IP address
#
# http://172.18.243.192/
#
# If your BigBlueButton server is behind a firewall, see FAQ.
# Warning: The API demos are installed and accessible from:
#
# http://172.18.243.192
#
# and
#
# http://172.18.243.192/demo/demo1.jsp
#
# These API demos allow anyone to access your server without authentication
# to create/manage meetings and recordings. They are for testing purposes only.
# If you are running a production system, remove them by running:
#
# apt-get purge bbb-demo
# Warning: found only 1 cores, whereas this server should have (at least) 4 CPU cores
# to run BigBlueButton in production.
#
# https://docs.bigbluebutton.org/install/install.html#minimum-server-requirements
#
可以发现里面有一行错误提示Error: Unable to connect to the FreeSWITCH Event Socket Layer on port 8021
,这个问题是因为服务器不支持ipv6,需要禁用freeswitch的ipv6选项
。
一开始并没留意到上面的错误,打开demo的时候提示网站看到下面的错误。(后面配置完成偶尔也会出现这个错误界面,不过重新进入网站就可以了,或者多刷新几次)。
java.lang.NullPointerException
at org.apache.jsp.demoHTML5_jsp.getJoinURLExtended(demoHTML5_jsp.java:259)
at org.apache.jsp.demoHTML5_jsp._jspService(demoHTML5_jsp.java:1257)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:400)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:344)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:221)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
安装完成后需要根据服务器的环境修改相关参数
FreeSWITCH无法绑定到端口8021
http://docs.bigbluebutton.org/2.2/troubleshooting.html#freeswitch-fails-to-bind-to-port-8021
vi /opt/freeswitch/etc/freeswitch/autoload_configs/event_socket.conf.xml
//change the line
//to
$ sudo mv /opt/freeswitch/etc/freeswitch/sip_profiles/internal-ipv6.xml /opt/freeswitch/etc/freeswitch/sip_profiles/internal-ipv6.xml_
$ sudo mv /opt/freeswitch/etc/freeswitch/sip_profiles/external-ipv6.xml /opt/freeswitch/etc/freeswitch/sip_profiles/external-ipv6.xml_
配置ip
root@bbb:~# sudo bbb-conf --setip 120.24.55.239
Assigning 120.24.55.239 for testing for firewall in /var/www/bigbluebutton/client/conf/config.xml
Assigning 120.24.55.239 for rtmp:// in /var/www/bigbluebutton/client/conf/config.xml
Assigning 120.24.55.239 for servername in /etc/nginx/sites-available/bigbluebutton
Assigning 120.24.55.239 for http[s]:// in /var/www/bigbluebutton/client/conf/config.xml
Assigning 120.24.55.239 for publishURI in /var/www/bigbluebutton/client/conf/config.xml
Assigning 120.24.55.239 for web application URL in /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties
Assigning 120.24.55.239 for web application URL in /usr/share/bbb-apps-akka/conf/application.conf
Assigning 120.24.55.239 for api demos in /var/lib/tomcat7/webapps/demo/bbb_api_conf.jsp
Assigning 120.24.55.239 for record and playback in /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml
Assigning 120.24.55.239 for playback of recordings:
Restarting the BigBlueButton 2.2.0-rc-2 ...
Stopping BigBlueButton
Starting BigBlueButton
配置ssl证书
http://docs.bigbluebutton.org/2.2/install.html#configure-ssl-on-your-bigbluebutton-server
1002 Could not make a WebSocket connection
到这一步,可以正常打开bbb-demo界面,但打开麦克风的时候提示1002
错误。打开网页空控制台,也看到ws的请求失败了。
查找文档,文档里面有关于1002错误的具体说明以及解决方法
1002:无法建立WebSocket连接 -初始WebSocket连接失败。可能的原因:
防火墙阻止WS协议
服务器已关闭或配置不正确
http://docs.bigbluebutton.org/2.2/configure-firewall#configure-a-dummy-nic-if-required
- To setup a dummy NIC, on your BigBlueButton enter the following command and substitute EXTERNAL_IP_ADDRESS with the external IP address of your firewall.
sudo ip addr add EXTERNAL\_IP\_ADDRESS/32 dev lo
- Next, edit /opt/freeswitch/conf/sip_profiles/external.xml and ensure the value for wss-binding uses the external IP address
配置完虚拟网卡之后,bbb-demo运行正常,麦克风正常,桌面分享也可以,到这里就算安装完成了。
一篇关于linux虚拟ip的文章https://blog.csdn.net/zhengwei125/article/details/53019651
配置TURN(非必需)
当前的stun服务器是使用默认配置的地址,可以打开控制台观察bigbluebutton/api/stuns这个请求看到服务器返回的stun信息,stun.freeswitch.org这个域名是在美国,所以可能会影响连接速度(这个是我的猜测,可能不正确,我自己了解到stun的turn在nat穿透上面的作用不太一样,我猜测在某些复杂的网络请求下还是需要turn服务器的),我们打算自己安装一个。
P2P技术详解(三):P2P技术之STUN、TURN、ICE详解
{
"stunServers": [
{
"url": "stun:stun.freeswitch.org"
}
],
"turnServers": [
],
"remoteIceCandidates": [
]
}
http://docs.bigbluebutton.org/2.2/setup-turn-server.html
按照文档的说明在服务器上面安装了turn服务器,修改相关配置,最后bbb-demo也运行正常,可以看到修改后返回的stun地址是服务器的地址。
{
"stunServers": [
{
"url": "stun:120.24.55.239"
}
],
"turnServers": [
],
"remoteIceCandidates": [
]
}
服务器上也有在监听的turn服务
总结
经过不同情况的尝试,以下三种方法都可以正常运行bbb。
- 一、ECS+公网IP(在ECS实例网卡上看不到该IP的),添加虚拟网卡并修改freeswitch的配置,bbb运行成功
setup a dummy NIC
edit /opt/freeswitch/conf/sip_profiles/external.xml
- 二、ECS+弹性公网IP,在ECS实例网卡上可以看到该IP的,所以不需要添加虚拟网卡,但需要修改freeswitch的配置
edit /opt/freeswitch/conf/sip_profiles/external.xml
- 三、ECS+公网IP(在ECS实例网卡上看不到该IP的),修改stun服务器的地址,改为自己搭建的turn服务器地址(个人推测是默认的stun服务器无法穿透),这种方法不需要添加虚拟网卡。
/usr/share/bbb-web/WEB-INF/classes/spring/turn-stun-servers.xml
/etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini
stunServerAddress=
stunServerPort=