'2017/03/26'에 해당되는 글 1건

  1. 2017.03.26 [WebRTC] Janus-Gateway (MCU) 에 대해서 #1 개요, 설치 9
반응형

1. 개요

이전 포스팅(http://alnova2.tistory.com/1118) 에서 MCU/SFU 와 같은 Media Server에 대해서 설명 하였다. 이번 포스팅에서는 MCU 오픈 소스중 하나인 Janus-Gateway에 대해서 논한다.


 Janus-Gateway 는 다음의 사이트에서 문서를 보거나 소스를 다운로드 받을 수 있다.


https://janus.conf.meetecho.com/

https://github.com/meetecho/janus-gateway


 Janus-Gateway는 C로 만들어져 있으며 다른 오픈 소스 MCU 인 Kurento 에 비교해 볼때, 성능적인 면에서 우수하다. (Kurento 의 장점도 있다. 이건 다른 포스팅에서 논하도록 하겠다.) Kurento도 그렇지만 Janus-Gateway 또한 기본적인 WebRTC 프로토콜의 처리 기능에 Plugin 형태로 기능을 덧붙일 수 있도록 되어 있다. 기본적으로 제공되는 Plugin 은 다음과 같다.


1. Echo Test

2. Streaming

3. Video Call

4. SIP Gateway

5. Video Room

6. Audio Room

7. Text Room

8. Voice Mail

9. Recorder/Playout

10. Screen Sharing


 이중 5. Video Room 은 SFU 와 같은 기능을 제공하는 것이며, 6. Audio Room 은 서버에서 Mixing을 하는 MCU와 같은 기능을 제공하는 것이다. 특이한 것은 2. Streaming 인데, Streaming의 경우 Broadcasting하는 Channel을 만들고, 여기에 RTP 패킷을 전송하면 방송처럼 Recv-Only로 수신 가능하다.


 그리고 Media Server로의 역활 뿐만 아니라 Signaling 기능도 제공하며 해당 API를 Websocket, HTTP REST, MQTT, RabbitMQ 등의 프로토콜을 이용해서 사용 가능하다.


 Janus-Gateway 는 Monolithic 한 구조로, 모듈들이 한번에 컴파일 되어 실행되어야 한다. 하지만 모듈화가 잘 되어 있다. 


 Core는 WebRTC 부분(JSEP/SDP, ICE, DTLS-SRTP, Data Channels..)만을 구현하고 Application Login은 Plugin 형태로 구현하며 Signaling을 위한 프로토콜은 transport (HTTP/WebSOcket/RabbitMQ) 형태로 구현 가능하다.


2. 설치

 Janus-Gateway는 리눅스 환경에서 설치 가능하며 본 포스팅에서는 Ubuntu 16.04를 기준으로 설명하도록 하겠다. Janus-Gateway는 다음의 Dependency 가 있어서 필요한 라이브러리를 설치해 주어야 한다.



Plugin에 따른 Dependency는 다음과 같다.


그리고 추가적으로 GLib, pkg-config, gengetopt 등이 필요하다. ubuntu에서는 다음의 명령으로 필요한 패키지를 설치한다.


sudo apt-get install libmicrohttpd-dev libjansson-dev libnice-dev libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev libopus-dev libogg-dev libcurl4-openssl-dev pkg-config gengetopt libtool automake cmake


libsrtp 는 다음과 같이 설치한다.

wget https://github.com/cisco/libsrtp/archive/v2.0.0.tar.gz

tar xzvf v2.0.0.tar.gz

cd libsrtp-2.0.0/

./configure --prefix=/usr --enable-openssl

make shared_library && sudo make install


libwebsocket은 다음과 같이 설치한다.

git clone git://git.libwebsockets.org/libwebsockets

cd libwebsockets

mkdir build

cd build

cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" ..

make && sudo make install


위 패키지/라이브러리가 설치 되면 다음과 같이 janus-gateway를 설치한다.


git clone https://github.com/meetecho/janus-gateway.git

cd janus-gateway

sh autogen.sh

./configure --prefix=/usr/local

make

sudo make install


./configure 시에 다음의 옵션을 줄 수 있다.

 --disable-option-checking  ignore unrecognized --enable/--with options

  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)

  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]

  --enable-shared[=PKGS]  build shared libraries [default=yes]

  --enable-static[=PKGS]  build static libraries [default=no]

  --enable-silent-rules   less verbose build output (undo: "make V=1")

  --disable-silent-rules  verbose build output (undo: "make V=0")

  --enable-dependency-tracking do not reject slow dependency extractors

  --disable-dependency-tracking speeds up one-time build

  --enable-fast-install[=PKGS] optimize for fast installation [default=yes]

  --disable-libtool-lock  avoid locking (might break parallel builds)

  --enable-docs           Enable building documentation

  --disable-rest          Disable REST (HTTP/HTTPS) support

  --disable-websockets    Disable WebSockets support

  --disable-data-channels Disable DataChannels

  --disable-rabbitmq      Disable RabbitMQ integration

  --disable-mqtt          Disable MQTT integration

  --disable-unix-sockets  Disable Unix Sockets integration

  --disable-sample-event-handler Disable sample event handler (HTTP POST)

  --enable-boringssl      Use BoringSSL instead of OpenSSL

  --enable-libsrtp2       Use libsrtp 2.0.x instead of libsrtp 1.5.x

  --enable-dtls-settimeout Use DTLSv1_set_initial_timeout_duration 

                                 (only available in recent BoringSSL versions)

  --disable-turn-rest-api Disable TURN REST API client (via libcurl)

  --disable-plugin-audiobridge Disable audiobridge plugin

  --disable-plugin-echotest Disable echotest plugin

  --disable-plugin-recordplay Disable record&play plugin

  --disable-plugin-sip    Disable sip plugin

  --disable-plugin-streaming Disable streaming plugin

  --disable-plugin-videocall Disable videocall plugin

  --disable-plugin-videoroom Disable videoroom plugin

  --disable-plugin-voicemail Disable voicemail plugin

  --disable-plugin-textroom Disable textroom plugin

  --enable-post-processing Enable building post-processing utility


3. 설정

 2에서 설치가 완료 되면 /usr/local/etc/janus 밑에 설정 파일 샘플들이 들어 있다. *.cfg.sample 로 되어 있는데 이를 *.cfg로 파일명을 바꿔준다. 


sudo rename -v 's/cfg.sample/cfg/' *


 설정 파일은 janus 전체 설정(janus.cfg) 및 plugin 설정(janus.plugin.*.cfg) 및 transport 설정(janus.transport.*.cfg)로 나누어져 있다. 

 (향후 업데이트 할 예정임)


4. 실행

 /usr/local/bin/janus -F /usr/local/etc/janus 로 실행한다. 실행시 옵션은 janus.cfg 에 설정된대로 실행되지만 janus --help 로 실행해보면 실행하면서 설정할 수 있는 옵션들을 볼 수 있다.

 (향후 업데이트 할 예정임)

반응형
Posted by alias
,