Janus 需要至少 version 1.5 以上的 libsrtp,如果系統(tǒng)中已經(jīng)安裝了 libsrtp,則首先卸載后,手動安裝新版本,這里我們安裝 libsrtp 2.2,2. 依次執(zhí)行以下命令:
git clone https://gitee.com/MediaNext/libsrtp.git
cd libsrtp
git checkout v2.3.0./configure --prefix=/usr --enable-openssl
make shared_library && sudo make install
3. 安裝libmicrohttpd
libmicrohttpd支持–enable-rest
wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.71.tar.gz
tar zxf libmicrohttpd-0.9.71.tar.gz
cd libmicrohttpd-0.9.71/./configure
make
sudo make install
3. 編譯 Janus
通過 Git 下載 Janus 源碼,并編譯安裝:
git clone https://gitee.com/easyhao/janus-gateway.git
或git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway
git tag 查看當前的 tag,選擇最新穩(wěn)定的版本v0.10.4
git checkout v0.10.4
sh autogen.sh
./configure --prefix=/opt/janus --enable-websockets --enable-post-processing --enable-docs --enable-rest
make
sudo make install
make install的時候,將janus安裝到 /opt/janus路徑,插件的so庫在/opt/janus/lib/janus/plugins
general:{#events=true # Whether to notify event handlers about transport events(default=true)json ="indented" # Whether the JSON messages should be indented(default),#plain(no indentation)orcompact(no indentation and no spaces)base_path ="/janus" # Base path to bind to in the web server(plain HTTP only)threads ="unlimited" # unlimited=thread per connection, number=thread poolhttp =true # Whether to enable the plain HTTP interfaceport =8088 # Web server HTTP port#interface="eth0"#Whether we should bind this server to a specific interface only#ip="192.168.0.1"#Whether we should bind this server to a specific IP address(v4 or v6) onlyhttps =true # Whether to enable HTTPS(default=false)secure_port =8089 # Web server HTTPS port,if enabled#secure_interface ="eth0"#Whether we should bind this server to a specific interface only#secure_ip ="192.168.0.1"#Whether we should bind this server to a specific IP address(v4 or v6) only#acl="127.,192.168.0."#Only allow requests coming from this comma separated list of addresses}
?
certificates:{cert_pem ="/home/ubuntu/cert/cert.pem" # 跟前面配置的cert.pem一樣路徑cert_key ="/home/ubuntu/cert/key.pem"#cert_pwd ="secretpassphrase"#ciphers="PFS:-VERS-TLS1.0:-VERS-TLS1.1:-3DES-CBC:-ARCFOUR-128"}
4. 配置janus.transport.websockets.jcfg
general:{#events=true # Whether to notify event handlers about transport events(default=true)json ="indented" # Whether the JSON messages should be indented(default),#plain(no indentation)orcompact(no indentation and no spaces)#pingpong_trigger =30 # After how many seconds of idle, a PING should be sent#pingpong_timeout =10 # After how many seconds of not getting a PONG, a timeout should be detected
?ws =true # Whether to enable the WebSockets APIws_port =8188 # WebSockets server port#ws_interface ="eth0"#Whether we should bind this server to a specific interface only#ws_ip ="192.168.0.1"#Whether we should bind this server to a specific IP address onlywss =true # Whether to enable secure WebSocketswss_port =8989 # WebSockets server secure port,if enabled#wss_interface ="eth0"#Whether we should bind this server to a specific interface only#wss_ip ="192.168.0.1"#Whether we should bind this server to a specific IP address only#ws_logging ="err,warn"#libwebsocketsdebugging level as a comma separated list of things#todebug, supported values: err, warn, notice, info, debug, parser,#header, ext, client, latency, user,count(plus 'none'and'all')#ws_acl ="127.,192.168.0."#Only allow requests coming from this comma separated list of addresses}
?
certificates:{cert_pem ="/home/ubuntu/cert/cert.pem"cert_key ="/home/ubuntu/cert/key.pem"#cert_pwd ="secretpassphrase"}
var server = null;if(window.location.protocol ==='http:')server ="http://"+ window.location.hostname +":8088/janus";elseserver ="https://"+ window.location.hostname +":8089/janus";
將默認的https協(xié)議改為wss
var server ="wss://"+ window.location.hostname +":8989";