├── .DS_Store ├── README.md ├── docs ├── apiref │ ├── pure_api.md │ ├── siru_client.md │ └── siru_device.md ├── how_to_install.md ├── how_to_install_manually.md ├── how_to_setup_apikey.md ├── how_to_use_sample_app.md └── how_to_use_siru.md ├── images ├── install.jpg ├── iot_sample_app_bar.png ├── iot_sample_app_me.png ├── skyway-iot-sdk-overview.png ├── skyway_dashboard_appsetting.jpg └── skyway_dashboard_domaing.jpg └── install_scripts ├── debian_based ├── installer.0.0.2.sh ├── installer.0.1.0.sh └── installer.sh └── raspbian_stretch ├── installer.0.0.2.sh ├── installer.0.1.0.sh └── installer.sh /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nttcom/skyway-iot-sdk/e7969ccb53f7e6c0ebdce6276a611ab7cc0ce8ca/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Important notice : This experimental SDK has been deprecated. We recommend you migrating to [SkyWay WebRTC GW](https://github.com/skyway/skyway-webrtc-gateway). 2 | 3 | --- 4 | 5 | # SkyWay IoT SDK 6 | 7 | Project repository for [SkyWay](https://webrtc.ecl.ntt.com/en/) IoT SDK (At this moment, open beta feature). 8 | 9 | ![iot sdk over view](https://nttcom.github.io/skyway-iot-sdk/images/skyway-iot-sdk-overview.png) 10 | 11 | ## What's SkyWay IoT SDK? 12 | 13 | SkyWay IoT SDK is headless WebRTC app developement kit for linux box. Working together with SkyWay and [Janus Gateway](https://github.com/meetecho/janus-gateway), we can build global accessible WebRTC gateway services even though under NAT circumstances. Since this SDK leveraging WebRTC as a gateway feature, more flexible and extensible IoT apps we can build than using browser or mobile. For instance, 14 | 15 | - Transfer video from [ONVIF](https://www.onvif.org/) security camera. 16 | - Add AI features, such as face detection, on top of monitoring app. 17 | - Enable MQTT device operation from outside without global broaker server. 18 | 19 | Coding with SkyWay IoT SDK is super easy, especially you use SiRu (SkyWay IoT Room Utility) framework. For instance, the snipet to get media streaming and MQTT data from IoT device is shown below. 20 | 21 | ```javascript 22 | const client = new SiRuClient('myroom', {key: 'YOUR_API_KEY'}); 23 | 24 | client.on('meta', profile => { 25 | client.requestStreaming(profile.uuid) 26 | .then(stream => video.srcObject = stream); 27 | 28 | client.subscribe('topic/temperature'); 29 | 30 | client.on('message', (topic, mesg) => { 31 | console.log(topic, mesg); 32 | }); 33 | 34 | client.publish('topic/operation', 'hello'); 35 | }) 36 | ``` 37 | 38 | # New features in 0.1.x 39 | 40 | * Running 3rd party app is not needed any more. 41 | * MQTT relay feature is supported. 42 | * Large size data transfer ( about 60KB ) is supported. 43 | * Stability improved. 44 | 45 | ## Platforms 46 | 47 | Platforms shown berow are being tested at this moment. 48 | 49 | * device 50 | - Ubuntu 16.04 51 | - Raspbian Jessie and Stretch 52 | * client 53 | - Chrome 54 | - Firefox 55 | 56 | ## Dive In! 57 | 58 | Please check below 59 | 60 | * [How to Install](./docs/how_to_install.md) 61 | * [Getting Started - How to use sample app](./docs/how_to_use_sample_app.md) 62 | * [Getting Started - SkyWay IoT Room Utility(SiRu)](./docs/how_to_use_siru.md) 63 | * [API reference - SiRu client](https://github.com/nttcom/skyway-siru-client/blob/master/docs/SiRuClient.md) 64 | * [Sample code](https://github.com/nttcom/skyway-siru-client/blob/master/examples/index.html) 65 | 66 | Temporary unsupported documents. 67 | 68 | * [API reference - SkyWay IoT pure API](./docs/apiref/pure_api.md) 69 | * [API reference - SiRu device](./docs/apiref/siru_device.md) 70 | 71 | --- 72 | Copyright. NTT Communications All Rights Reserved. 73 | -------------------------------------------------------------------------------- /docs/apiref/pure_api.md: -------------------------------------------------------------------------------- 1 | # API reference - SkyWay IoT Pure API 2 | 3 | In SkyWay IoT SDK framework, you can use [SkyWay api](https://webrtc.ecl.ntt.com/en/js-tutorial.html) without any change. So, you can develop your own web app with SkyWay API. 4 | 5 | However, several things you have to be care while using pure SkyWay API. 6 | 7 | ## including skyway library 8 | 9 | We only support release version of [SkyWay library](https://webrtc.ecl.ntt.com/en/developer.html). 10 | 11 | ```html 12 | 13 | ``` 14 | 15 | ## media stream 16 | 17 | before getting media streaming from device, you need to establish data channel with device, then send dedicated message. 18 | sample code is like this. 19 | 20 | ```js 21 | const peer = new Peer({key: MY_APIKEY}) 22 | 23 | peer.on('open', id => { 24 | const mypeerid = id 25 | const conn = peer.connect(PEERID_OF_SSG, {serialization: "none", reliable: true}); 26 | // you can check the peerid of SSG in log message. Or, you can specify peerid of SSG. For more detail please check https://github.com/nttcom/skyway-signaling-gateway 27 | 28 | conn.on('open', () => { 29 | // send media stream request 30 | conn.send(`SSG:stream/start,${mypeerid}`); 31 | }); 32 | 33 | // event handler for media stream from device 34 | peer.on('call', stream => { ... }) 35 | }) 36 | ``` 37 | 38 | When you want to stop media streaming, send `SSG:stream/stop` message. 39 | 40 | ```js 41 | conn.send('SSG:stream/stop') 42 | ``` 43 | 44 | ## keepalive 45 | 46 | To keep WebRTC connection between client and devicee, you need to send keepalive message with data channel every 25 seconds. 47 | 48 | ```js 49 | setInterval((ev) => { 50 | conn.send(`SSG:keepalive,${mypeerid}`) 51 | }, 25000) 52 | ``` 53 | 54 | --- 55 | Copyright. NTT Communications All Rights Reserved. 56 | -------------------------------------------------------------------------------- /docs/apiref/siru_client.md: -------------------------------------------------------------------------------- 1 | # API reference - SiRu client 2 | 3 | see https://github.com/nttcom/skyway-siru-client/blob/master/docs/SiRuClient.md 4 | 5 | --- 6 | Copyright. NTT Communications All Rights Reserved. 7 | -------------------------------------------------------------------------------- /docs/apiref/siru_device.md: -------------------------------------------------------------------------------- 1 | # API reference - SiRu device 2 | 3 | ## SiRuDevice 4 | 5 | Constructor of SiRuDevice. By calling this function, device will join room indicated by roomName. 6 | 7 | ```js 8 | const device = new SiRuDevice(roomName, [options]) 9 | ``` 10 | 11 | * roomName - string 12 | - room name which this client will join 13 | * options - object 14 | - option parameter 15 | * options.ssgaddress - string 16 | - IP address of SSG (default is ``localhost``) 17 | * options.extport - number 18 | - TCP port number of External interface of SSG (default is 15000) 19 | * options.dashboardport - number 20 | - TCP port number of dashboard interface of SSG (default is 3000) 21 | 22 | ## get 23 | 24 | set GET interface 25 | 26 | ```js 27 | device.get(path, callback) 28 | ``` 29 | 30 | * path - string 31 | - REST path 32 | * callback - function 33 | - callback function for this path 34 | 35 | ## post 36 | 37 | set POST interface 38 | 39 | ```js 40 | device.post(path, callback) 41 | ``` 42 | 43 | * path - string 44 | - REST path 45 | * callback - function 46 | - callback function for this path 47 | 48 | ## put 49 | 50 | set PUT interface 51 | 52 | ```js 53 | device.put(path, callback) 54 | ``` 55 | 56 | * path - string 57 | - REST path 58 | * callback - function 59 | - callback function for this path 60 | 61 | ## delete 62 | 63 | set delete interface 64 | 65 | ```js 66 | device.delete(path, callback) 67 | ``` 68 | 69 | * path - string 70 | - REST path 71 | * callback - function 72 | - callback function for this path 73 | 74 | ## publish 75 | 76 | ```js 77 | device.publish(topic, data) 78 | ``` 79 | 80 | publish data to clients in the room. data is distinguished by topic. 81 | 82 | * topic - string 83 | - name of topic 84 | * data - string|object 85 | - arbitrary data 86 | 87 | ## subscribe 88 | 89 | ```js 90 | device.subscribe(topic) 91 | ``` 92 | 93 | subscribe topic 94 | 95 | * topic - string 96 | - name of topic 97 | 98 | ## unsubscribe 99 | 100 | ```js 101 | device.unsubscribe(topic) 102 | ``` 103 | 104 | unsubscribe topic 105 | 106 | * topic - string 107 | - name of topic 108 | 109 | ## Event 110 | 111 | ### connect 112 | 113 | ```js 114 | device.on('connect', () => {...}) 115 | ``` 116 | 117 | fired when connected to skyway signaling server and join room procedure has completed. 118 | 119 | ### meta 120 | 121 | ```js 122 | device.on('meta', meta => { ... }) 123 | ``` 124 | 125 | fired when meta data is received from each device in the room. 126 | 127 | * meta - object 128 | - we will not completely specified for the format of meta data, but ``meta.uuid`` must be specified. You can see example meta data in [profile.yaml](https://github.com/nttcom/skyway-signaling-gateway/tree/master/conf/profile.yaml) 129 | 130 | ### message 131 | 132 | ```js 133 | device.on('message', (topic, message) => { ... }) 134 | ``` 135 | 136 | When published data will be received for subscribed topic. This event will be fired 137 | 138 | * topic - string 139 | - name of topic 140 | * message - string|object 141 | - arbitrary data which is published 142 | 143 | ### stream 144 | 145 | ```js 146 | device.on('stream', stream => { ... }) 147 | ``` 148 | 149 | fired when media streaming is arrived from device. 150 | 151 | * stream - object 152 | - media stream object. 153 | 154 | 155 | ## Request 156 | 157 | request object which will be passed to REST interface as 1st argument. 158 | 159 | * uuid - string 160 | - uuid of request generator client 161 | * method - string 162 | - method name which is one of 'GET', 'POST', 'PUT', 'DELETE' 163 | * params - object 164 | - request parameter (e.g. device.get('/echo/:message') and GET /echo/hello #=> params.message = hello) 165 | * query - object 166 | - query parameter 167 | * body - string 168 | - request body 169 | 170 | ## Response 171 | 172 | response object which will be passed to REST interface as 2nd argument. 173 | 174 | ### setStatus 175 | 176 | set status code for the response 177 | 178 | ```js 179 | res.setStatus(code) 180 | ``` 181 | 182 | * code - number 183 | - status code (200, 404 etc.) 184 | 185 | ### send 186 | 187 | send response to client 188 | 189 | ```js 190 | res.send(data) 191 | ``` 192 | 193 | * data - string|number|object 194 | - arbitrary data 195 | 196 | --- 197 | Copyright. NTT Communications All Rights Reserved. 198 | -------------------------------------------------------------------------------- /docs/how_to_install.md: -------------------------------------------------------------------------------- 1 | # How to Install SkyWay IoT SDK 2 | 3 | ## Setup apikey and domains 4 | 5 | For using SkyWay IoT SDK, you need to setup SkyWay APIKEY for your app. More detail, see [how to setup apikey](./how_to_setup_apikey.md) page. 6 | 7 | ## Install by installer 8 | 9 | Run ``installer.sh`` as follows 10 | 11 | * Ubuntu16.04 or Raspbian jessie 12 | 13 | ```bash 14 | curl https://nttcom.github.io/skyway-iot-sdk/install_scripts/debian_based/installer.sh | sudo -E bash - 15 | ``` 16 | 17 | * Raspbian stretch 18 | 19 | ```bash 20 | curl https://nttcom.github.io/skyway-iot-sdk/install_scripts/raspbian_stretch/installer.sh | sudo -E bash - 21 | ``` 22 | 23 | After installation, please run 24 | 25 | ``` 26 | ssg setup 27 | ``` 28 | 29 | Then type your **APIKEY**. 30 | 31 | ## Install manually 32 | 33 | When you need to setup SkyWay IoT SDK manually for some reason, see [this instruction](./how_to_install_manually.md) page. 34 | 35 | ## Next Step 36 | 37 | To check SkyWay IoT SDK completely installed, see [Getting Started - How to use sample app](./how_to_use_sample_app.md) 38 | 39 | --- 40 | Copyright. NTT Communications All Rights Reserved. 41 | -------------------------------------------------------------------------------- /docs/how_to_install_manually.md: -------------------------------------------------------------------------------- 1 | # Install SkyWay IoT SDK Manually 2 | 3 | ## Overview 4 | 5 | SkyWay IoT SDK is kind of framework rather than saying libraries. This framework consists of several building blocks as shown below. 6 | 7 | ![iot sdk over view](https://nttcom.github.io/skyway-iot-sdk/images/skyway-iot-sdk-overview.png) 8 | 9 | - [Janus Gateway + SkyWay Plugin](https://github.com/nttcom/janus-skywayiot-plugin) 10 | - WebRTC gateway feature within the framework. For example, Janus Gateway establish WebRTC P2P connection between device and client, then relays pure RTP base media streaming data ( provided by streaming process explained below ) into WebRTC media streaming protocol (ICE + SRTP). By using SkyWay Plugin, developer can control Janus Gateway feature from client api outside of Janus Signaling Protocol. Also, it gives a way to connect 3rd party app and client app leveraging DataChannel relayed by Janus Gateway. 11 | - [SkyWay Signaling Gateway (SSG)](https://github.com/nttcom/skyway-signaling-gateway) 12 | - Signaling Protocol gateway between Janus REST API and SkyWay Signaling Server. Since it transform SkyWay's signaling protocol such as offer, answer and ice candidate into Janus REST API inside private network, you can easily develop global accessible WebRTC-IoT app. Because of this building block, you can get not only global accesibility but also a way for developping to control Janus Gateway by (release version of SkyWay API)[https://webrtc.ecl.ntt.com/en/js-tutorial.html]. Also, it relays DataChannel data between Janus Gateway and 3rd party app. 13 | - Streaming Process 14 | - Streaming Process is used for generating stream data. It generates rtp stream that will be received by Janus Gateway. This rtp data will be relayed to client app by WebRTC P2P protocol. Typically, gstreamer is used for this purpose. But in case of generating stream from file, this process is not needed. Just configuring file path to Janus Gateway is enought for it. 15 | - Client app 16 | - Arbitrary application which would be used on client side. For instance, monitoring camera streaming, realtime metrics data and operating IoT device would be a typical use-case. In most cases, makin use of [SiRu Client](https://github.com/nttcom/skyway-siru-client) module would be easy to implement your client side application. 17 | 18 | So you need to install above building blocks on linux based IoT devices, such as raspberry PI. 19 | 20 | 21 | ## Install 22 | 23 | We will explain how to install SkyWay IoT SDK framework manually on Debian based environment. (We assume that git and node.js version>=6.x are already installed) 24 | 25 | ### Janus Gateway + SkyWay Plugin 26 | 27 | * Install dependency libraries 28 | 29 | ```bash 30 | sudo aptitude install libmicrohttpd-dev libjansson-dev libnice-dev \ 31 | libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev \ 32 | libopus-dev libogg-dev libcurl4-openssl-dev pkg-config gengetopt \ 33 | libtool automake 34 | ``` 35 | 36 | * Install libsctp 37 | 38 | ```bash 39 | git clone https://github.com/sctplab/usrsctp 40 | cd usrsctp 41 | ./bootstrap 42 | ./configure --prefix=/usr; make; sudo make install 43 | ``` 44 | 45 | * Install Janus-gateway & skywayiot-plugin 46 | 47 | ```bash 48 | cd .. 49 | git clone --branch v0.2.1 https://github.com/meetecho/janus-gateway.git 50 | git clone https://github.com/nttcom/janus-skywayiot-plugin.git 51 | cd janus-skywayiot-plugin 52 | bash addplugin.sh 53 | 54 | cd ../janus-gateway 55 | sh autogen.sh 56 | ./configure --prefix=/opt/janus --disable-mqtt --disable-rabbitmq --disable-docs --disable-websockets 57 | make 58 | sudo make install 59 | sudo make configs 60 | ``` 61 | 62 | * update configs 63 | 64 | ``/opt/janus/etc/janus/janus.plugin.streaming.cfg`` 65 | 66 | Comment out several lines for ``[gstreamer-sample]``, ``[file-live-sample]`` and ``[file-ondemand-sample]``. Then append example streaming setting shown below (you can check sample configs on [this gist](https://gist.github.com/KensakuKOMATSU/430abf94081cfa9f377a7461eaaf59d7)) 67 | 68 | ``` 69 | [skywayiotsdk-example] 70 | type = rtp 71 | id = 1 72 | description = SkyWay IoT SDK H264 example streaming 73 | audio = yes 74 | video = yes 75 | audioport = 5002 76 | audiopt = 111 77 | audiortpmap = opus/48000/2 78 | videoport = 5004 79 | videopt = 96 80 | videortpmap = H264/90000 81 | videofmtp = profile-level-id=42c01f\;packetization-mode=1 82 | ``` 83 | 84 | ``/opt/janus/etc/janus/janus.transport.http.cfg`` 85 | 86 | ``` 87 | https=yes 88 | secure_port=8089 89 | ``` 90 | 91 | ``/opt/janus/etc/janus/janus.cfg`` 92 | 93 | ``` 94 | [nat] 95 | stun_server = stun.webrtc.ecl.ntt.com 96 | stun_port = 3478 97 | 98 | turn_server = 52.41.145.197 99 | turn_port = 443 100 | turn_type = tcp 101 | turn_user = siruuser 102 | turn_pwd = s1rUu5ev 103 | ``` 104 | 105 | Please be sure that you can use our dedicated turn server for demonstration needs. Since current SkyWay TURN feature does not have compatibility with IoT SDK, for developers demonstration convenience, we setupped shared turn server. If you want to use SkyWay IoT SDK for your own purpose, please setup and use your own TURN server. [Coturn](https://github.com/coturn/coturn) will be one option to setup your server. Please be sure that we will not guarantee our demonstration TURN server. 106 | 107 | ### SSG 108 | 109 | * install SSG 110 | 111 | ```bash 112 | npm -g install skyway-signaling-gateway 113 | ``` 114 | 115 | * setup ssg 116 | 117 | ```bash 118 | ssg setup 119 | ``` 120 | 121 | For obtaining apikey and setting domain of origin, please login or sign up at [Our SkyWay dashboard](https://webrtc.ecl.ntt.com/en/login.html) 122 | 123 | ### Streaming Process (gstreamer) 124 | 125 | * install gstreamer 126 | 127 | **raspbian stretch** 128 | 129 | ```bash 130 | sudo apt-get update 131 | sudo apt-get install libgstreamer1.0-0 \ 132 | libgstreamer1.0-dev gstreamer1.0-nice gstreamer1.0-plugins-base \ 133 | gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \ 134 | gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-omx gstreamer1.0-alsa 135 | ``` 136 | 137 | **ubuntu16.04 or raspbian jessie** 138 | 139 | ```bash 140 | sudo apt-get update 141 | sudo apt-get install gstreamer1.0 142 | ``` 143 | 144 | --- 145 | Copyright. NTT Communications All Rights Reserved. 146 | -------------------------------------------------------------------------------- /docs/how_to_setup_apikey.md: -------------------------------------------------------------------------------- 1 | # How to setup APIKEY 2 | 3 | To use SkyWay IoT SDK, you need to setup your APIKEY. Instructions are as follows. If you don't have account for [Enterprise Cloud WebRTC Platform - SkyWay](https://webrtc.ecl.ntt.com/en/), please signup for free from [here](https://webrtc.ecl.ntt.com/en/signup.html) 4 | 5 | ## Login to dashboard 6 | 7 | https://webrtc.ecl.ntt.com/en/login.html 8 | 9 | ## Create a new Application 10 | 11 | 1. Click ``Create a new Application`` button 12 | 2. **API Key** will be automatically generated 13 | 14 | ![Create a new Application](https://nttcom.github.io/skyway-iot-sdk/images/skyway_dashboard_appsetting.jpg) 15 | 16 | ## Edit Application settings (minimum settings for IoT SDK) 17 | 18 | 1. Click ``Edit application settings`` button 19 | 2. set ``localhost`` and ``nttcom.github.io`` in **Available domains** as minimum setting. 20 | 3. Set all checkboxes are off in **Permissions**. 21 | 22 | ![Edit Application settings](https://nttcom.github.io/skyway-iot-sdk/images/skyway_dashboard_domaing.jpg) 23 | 24 | 25 | * Back to [how to install](./how_to_install.md) 26 | 27 | --- 28 | Copyright. NTT Communications All Rights Reserved. 29 | -------------------------------------------------------------------------------- /docs/how_to_use_sample_app.md: -------------------------------------------------------------------------------- 1 | # How to use sample app 2 | 3 | After installation, you can check the sample page which you can check live streaming from your IoT device and MQTT relay feature. Please be sure that [installation procedure](./how_to_install.md) is completely finished before. 4 | 5 | ## start processes on your IoT device 6 | 7 | * janus gateway 8 | 9 | ```bash 10 | /opt/janus/bin/janus 11 | ``` 12 | 13 | * SSG 14 | 15 | ```bash 16 | ROOMNAME=testroom MQTT_URL=mqtt://localhost MQTT_TOPIC=testtopic/+ ssg start 17 | ``` 18 | 19 | * Video Streaming ( test source ) 20 | 21 | **Raspbian** 22 | 23 | ```bash 24 | gst-launch-1.0 videotestsrc is-live=true ! \ 25 | video/x-raw,width=640,height=480,framerate=30/1 ! \ 26 | videoscale ! videorate ! videoconvert ! timeoverlay ! \ 27 | omxh264enc target-bitrate=2000000 control-rate=variable ! \ 28 | h264parse ! rtph264pay config-interval=1 pt=96 ! \ 29 | udpsink host=127.0.0.1 port=5004 \ 30 | audiotestsrc ! \ 31 | audioconvert ! queue ! \ 32 | audioresample ! \ 33 | audio/x-raw,channels=1,rate=16000 ! \ 34 | opusenc bitrate=20000 ! \ 35 | rtpopuspay ! udpsink host=127.0.0.1 port=5002 36 | ``` 37 | 38 | **Ubuntu16.04** 39 | 40 | ```bash 41 | gst-launch-1.0 videotestsrc is-live=true ! \ 42 | video/x-raw,width=640,height=480,framerate=30/1 ! \ 43 | timeoverlay ! \ 44 | x264enc aud=false key-int-max=1 tune=zerolatency intra-refresh=true ! \ 45 | "video/x-h264,profile=constrained-baseline,level=(string)3.1" ! \ 46 | rtph264pay pt=96 ! \ 47 | capssetter caps='application/x-rtp,profile-level-id=(string)42c01f' ! \ 48 | udpsink host=127.0.0.1 port=5004 \ 49 | audiotestsrc ! \ 50 | audioconvert ! queue ! \ 51 | audioresample ! \ 52 | audio/x-raw,channels=1,rate=16000 ! \ 53 | opusenc bitrate=20000 ! \ 54 | rtpopuspay ! udpsink host=127.0.0.1 port=5002 55 | ``` 56 | 57 | ## Try sample web app 58 | 59 | Before trying to access sample web app, you need to set ``nttcom.github.io`` and ``localhost`` in your SkyWay API Key settings (available domain). 60 | 61 | To check installation is completely finished and your environment working properly, you can use our sample web site. 62 | 63 | https://nttcom.github.io/skyway-siru-client/examples/ 64 | 65 | Type your APIKEY in the top-left text box, then click `start` button. 66 | You would see the test video stream shwon below. 67 | 68 | ![sample app screenshot with test src](https://nttcom.github.io/skyway-iot-sdk/images/iot_sample_app_bar.png) 69 | 70 | ## Change video source - real camera 71 | 72 | Now, you can see the test video and audio streaming which are generated by your IoT device. Yes it is ok, but you would enjoy if you could see the real media streaming from actual camera and mic. We'll show you how to do this. 73 | 74 | Please notice that setting USB camera and mic on your IoT device is completely finished (Since Raspberry PI supports built-in mic, you don't need to set USB mic on it). 75 | 76 | Then simply run gsreamer pipeline shown below. 77 | 78 | **Raspbian** 79 | 80 | ```bash 81 | gst-launch-1.0 v4l2src device=/dev/video0 ! \ 82 | video/x-raw,width=640,height=480,framerate=30/1 ! \ 83 | videoscale ! videorate ! videoconvert ! timeoverlay ! \ 84 | omxh264enc target-bitrate=2000000 control-rate=variable ! \ 85 | h264parse ! rtph264pay config-interval=1 pt=96 ! \ 86 | udpsink host=127.0.0.1 port=5004 \ 87 | alsasrc device=hw:1,0 ! \ 88 | audioconvert ! queue ! audioresample ! \ 89 | audio/x-raw,channels=1,rate=16000 ! \ 90 | opusenc bitrate=20000 ! rtpopuspay ! \ 91 | udpsink host=127.0.0.1 port=5002 92 | ``` 93 | 94 | **Ubuntu16.04** 95 | 96 | ```bash 97 | gst-launch-1.0 v4l2src device=/dev/video0 ! \ 98 | video/x-raw,width=640,height=480,framerate=15/1 ! \ 99 | timeoverlay ! \ 100 | x264enc aud=false key-int-max=1 tune=zerolatency intra-refresh=true ! \ 101 | "video/x-h264,profile=constrained-baseline,level=(string)3.1" ! \ 102 | rtph264pay pt=96 ! \ 103 | capssetter caps='application/x-rtp,profile-level-id=(string)42c01f' ! \ 104 | udpsink host=127.0.0.1 port=5004 \ 105 | alsasrc device=hw:1,0 ! \ 106 | audioconvert ! queue ! audioresample ! \ 107 | audio/x-raw,channels=1,rate=16000 ! \ 108 | opusenc bitrate=20000 ! rtpopuspay ! \ 109 | udpsink host=127.0.0.1 port=5002 110 | ``` 111 | 112 | Then, you may see that video changes from test source to real camera. 113 | 114 | ![sample app screenshot with usb cam](https://nttcom.github.io/skyway-iot-sdk/images/iot_sample_app_me.png) 115 | 116 | ## MQTT relay 117 | 118 | From 0.1.0, this SDK supports MQTT relay feature from the linux device to web app. As you may see `testtopic/from_dev` in right-top text box, this web app is subscribing this topic. So, published message from the linux box with this topic will be proxied to this app. For instance, when you type below commnad, you will see this message in your web app. 119 | 120 | ```bash 121 | mosquitto_pub -t testtopic/from_dev -m 'hello iot sdk' 122 | ``` 123 | 124 | Of course, you can send `publish` messsage to the linux device. To test this, please execute `mosquitto_sub -t testtopic/+` on the devie. Then, in the web app, please type `testtopic/from_cli` in topic box and arbitrary message in message box, then click `send` button. You can see the proxied message at the linux console like below. 125 | 126 | ```bash 127 | $ mosquitto_sub -t testtopic/+ 128 | "hello from client" 129 | ``` 130 | 131 | ## Next Step 132 | 133 | Now your SkyWay IoT SDK environment is properly working. Next step is to learn how to build your own app with SDK. 134 | * [Getting Started - SkyWay IoT Room Utility(SiRu)](./how_to_use_siru.md) 135 | 136 | --- 137 | Copyright. NTT Communications All Rights Reserved. 138 | -------------------------------------------------------------------------------- /docs/how_to_use_siru.md: -------------------------------------------------------------------------------- 1 | # Getting started - how to use SkyWay IoT Room Utility (SiRu) 2 | 3 | For building WebRTC IoT app, we recommend you to use **SkyWay IoT Room Utility (SiRu)**. With SiRu, you can 4 | 5 | * have room base connectivity with clients and devices inside room. You don't care about each peerid. 6 | * get Media Streaming from IoT device super easy way. This makes easy to build app for monitoring camera, for instance. 7 | * have MQTT relay messaging inside room on top of the data channel. 8 | 9 | Below, we will explain about how to use SiRu. 10 | 11 | ## load module 12 | 13 | SiRu has a JS client library for browser. 14 | 15 | * pre-built 16 | 17 | ```html 18 | 19 | ``` 20 | 21 | You don't need including skyway library, since it is already involved in siru-client. 22 | 23 | * with webpack 24 | 25 | ```bash 26 | $ npm install skyway-siru-client 27 | ``` 28 | 29 | then, 30 | 31 | ```js 32 | const SiRuClient = require('skyway-siru-client') 33 | ``` 34 | 35 | ## Coding 36 | 37 | In this tutorial, we assume that `ssg start` is executed with `ROOMNAME=testroom MQTT_URL=mqtt://localhost MQTT_TOPIC=testtopic/+` on the linux machine. We also assumed that `mosquitto` is running as a daemon. When you used our installer, `mosquitto` has been running already. 38 | 39 | First, you need to create `siru-client` instance by indicating room name and APIKEY. This library will connect to the linux device which runs `janus` and `ssg`. When connection is established, `connect` event will be fired. 40 | 41 | ```js 42 | // here room name is `testroom` and APIKEY is `01234567-0123-0123-0123456789ab` 43 | // Room name must be same with ROOMNAME environment for `ssg start`. 44 | const client = new SiRuClient('testroom', {key: '01234567-0123-0123-0123456789ab'}) 45 | 46 | 47 | client.on('connect', () => { 48 | // ... 49 | }) 50 | ``` 51 | 52 | ## Getting Media Streaming from device 53 | 54 | When device has joined the room, ``meta`` event will be fired. (you can check and modify meta data in ``~/.ssg/profile.yaml``. Please note that you MUST not change the uuid in this file.) 55 | 56 | Here, meta data has ``uuid`` property which is automatically allocated while 1st execution process of ssg. By indicating ``uuid``, you can request media streaming from device. 57 | 58 | ```js 59 | client.on('meta', profile => { 60 | client.requestStreaming(profile.uuid) 61 | .then(stream => { 62 | const video = document.querySelector('video') 63 | video.srcObject = stream 64 | 65 | video.onloadedmetadata = (ev) => { 66 | video.play() 67 | } 68 | }) 69 | }) 70 | ``` 71 | 72 | ## MQTT relay 73 | 74 | SiRu-client supports MQTT relay messaging inside room with full-mesh P2P technology without any global broaker server. 75 | 76 | ### subscribe 77 | 78 | Once subscribed to the MQTT topic, published message from the linux device will be proxied to web app. When message is received, `message` event will be fired. 79 | 80 | ```js 81 | // subscribe topic 82 | client.subscribe('testtopic/from_dev') 83 | 84 | // when published message is received, ``message`` event will be fired. 85 | client.on('message', (topic, mesg) => { 86 | console.log(`${topic}: ${mesg}`) 87 | }) 88 | ``` 89 | 90 | To check this feature, please execute `mosquitto_pub` command on the linux device ( by using our installer, mosquitto has been installed already. ). 91 | 92 | ```bash 93 | mosquitto_pub -t testtopic/from_dev -m 'hello iot sdk' 94 | ``` 95 | 96 | ### publish 97 | 98 | To send message to MQTT broaker running inside the linux device, you can use `publish()` method. 99 | 100 | ```js 101 | client.publish('testtopic/from_cli', 'hello from client') 102 | ``` 103 | 104 | Easy way to check this message is using `mosquitto_sub` on your linux device. 105 | 106 | ```bash 107 | $ mosquitto_sub -t testtopic/+ 108 | "hello from client" 109 | ``` 110 | 111 | ## sample code 112 | 113 | * [HTML](https://github.com/nttcom/skyway-siru-client/blob/master/examples/index.html) 114 | * [JS](https://github.com/nttcom/skyway-siru-client/blob/master/examples/script.js) 115 | 116 | 117 | ## Next Step 118 | 119 | More detail about our SiRu client API, please check 120 | 121 | * [API reference - SiRu Client](https://github.com/nttcom/skyway-siru-client/blob/master/docs/SiRuClient.md) 122 | 123 | --- 124 | Copyright. NTT Communications All Rights Reserved. 125 | -------------------------------------------------------------------------------- /images/install.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nttcom/skyway-iot-sdk/e7969ccb53f7e6c0ebdce6276a611ab7cc0ce8ca/images/install.jpg -------------------------------------------------------------------------------- /images/iot_sample_app_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nttcom/skyway-iot-sdk/e7969ccb53f7e6c0ebdce6276a611ab7cc0ce8ca/images/iot_sample_app_bar.png -------------------------------------------------------------------------------- /images/iot_sample_app_me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nttcom/skyway-iot-sdk/e7969ccb53f7e6c0ebdce6276a611ab7cc0ce8ca/images/iot_sample_app_me.png -------------------------------------------------------------------------------- /images/skyway-iot-sdk-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nttcom/skyway-iot-sdk/e7969ccb53f7e6c0ebdce6276a611ab7cc0ce8ca/images/skyway-iot-sdk-overview.png -------------------------------------------------------------------------------- /images/skyway_dashboard_appsetting.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nttcom/skyway-iot-sdk/e7969ccb53f7e6c0ebdce6276a611ab7cc0ce8ca/images/skyway_dashboard_appsetting.jpg -------------------------------------------------------------------------------- /images/skyway_dashboard_domaing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nttcom/skyway-iot-sdk/e7969ccb53f7e6c0ebdce6276a611ab7cc0ce8ca/images/skyway_dashboard_domaing.jpg -------------------------------------------------------------------------------- /install_scripts/debian_based/installer.0.0.2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script to install [SkyWay IoT SDK](https://github.com/nttcom/skyway-iot-sdk) onto general debian series. 4 | # Tested environments are: 5 | # Ubuntu16.04 6 | # Raspbian jessie 7 | # 8 | # Run as root or insert `sudo -E` before `bash` 9 | 10 | APIKEY="THIS_KEY_WILL_BE_UPDATED" 11 | 12 | print_status() { 13 | echo 14 | echo "## $1" 15 | echo 16 | } 17 | 18 | if test -t 1; then # if terminal 19 | ncolors=$(which tput > /dev/null && tput colors) # supports color 20 | if test -n "$ncolors" && test $ncolors -ge 8; then 21 | termcols=$(tput cols) 22 | bold="$(tput bold)" 23 | underline="$(tput smul)" 24 | standout="$(tput smso)" 25 | normal="$(tput sgr0)" 26 | black="$(tput setaf 0)" 27 | red="$(tput setaf 1)" 28 | green="$(tput setaf 2)" 29 | yellow="$(tput setaf 3)" 30 | blue="$(tput setaf 4)" 31 | magenta="$(tput setaf 5)" 32 | cyan="$(tput setaf 6)" 33 | white="$(tput setaf 7)" 34 | fi 35 | fi 36 | 37 | print_bold() { 38 | title="$1" 39 | text="$2" 40 | 41 | echo 42 | echo "${green}================================================================================${normal}" 43 | echo "${green}================================================================================${normal}" 44 | echo -e "${bold}${blue}${title}${normal}" 45 | echo 46 | echo -en " ${text}" 47 | echo 48 | echo "${green}================================================================================${normal}" 49 | echo "${green}================================================================================${normal}" 50 | } 51 | 52 | bail() { 53 | echo 'Error executing command, exiting' 54 | exit 1 55 | } 56 | 57 | exec_cmd_nobail() { 58 | echo "+ $1" 59 | bash -c "$1" 60 | } 61 | 62 | exec_cmd() { 63 | exec_cmd_nobail "$1" || bail 64 | } 65 | 66 | install_prerequired() { 67 | print_status "Install pre-required packages" 68 | 69 | exec_cmd 'apt-get update' 70 | exec_cmd 'apt-get install -y git aptitude' 71 | 72 | print_status "Finished to install pre-required packages" 73 | } 74 | 75 | install_nodejs() { 76 | print_status "Install node 8.x" 77 | 78 | curl -sL https://deb.nodesource.com/setup_8.x | bash - 79 | apt-get -y install nodejs build-essential 80 | 81 | print_status "Finished to install nodejs" 82 | } 83 | 84 | install_janus() { 85 | print_status "Install required packages" 86 | exec_cmd "aptitude install -y 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" 87 | exec_cmd "mkdir tmp" 88 | 89 | print_status "Install usrsctp" 90 | exec_cmd "cd ./tmp;git clone https://github.com/sctplab/usrsctp" 91 | exec_cmd "cd ./tmp/usrsctp;./bootstrap;./configure --prefix=/usr; make; sudo make install" 92 | exec_cmd "rm -rf ./tmp/usrsctp" 93 | 94 | print_status "Install Janus-gateway & skywayiot-plugin" 95 | exec_cmd "cd ./tmp;git clone --branch v0.2.1 https://github.com/meetecho/janus-gateway.git" 96 | exec_cmd "cd ./tmp;git clone --branch v0.4.2 https://github.com/nttcom/janus-skywayiot-plugin.git" 97 | exec_cmd "cd ./tmp/janus-skywayiot-plugin;bash addplugin.sh" 98 | exec_cmd "cd ./tmp/janus-gateway;sh autogen.sh;./configure --prefix=/opt/janus --disable-mqtt --disable-rabbitmq --disable-docs --disable-websockets;make;make install;make configs" 99 | 100 | exec_cmd "rm -rf tmp" 101 | 102 | ## 103 | ## todo update configs. 104 | ## 105 | # /opt/janus/etc/janus/janus.plugin.streaming.cfg 106 | TARGET="/opt/janus/etc/janus/janus.plugin.streaming.cfg" 107 | 108 | exec_cmd "sed -i.bak -e '44,74 s/^/;/g' ${TARGET}" 109 | 110 | echo '; Sample config for SkyWay IoT SDK' | tee -a ${TARGET} 111 | echo '; This streams H.246 as video and opus as audio codec' | tee -a ${TARGET} 112 | echo ';' | tee -a ${TARGET} 113 | echo '[skywayiotsdk-example]' | tee -a ${TARGET} 114 | echo 'type = rtp' | tee -a ${TARGET} 115 | echo 'id = 1' | tee -a ${TARGET} 116 | echo 'description = SkyWay IoT SDK H264 example streaming' | tee -a ${TARGET} 117 | echo 'audio = yes' | tee -a ${TARGET} 118 | echo 'video = yes' | tee -a ${TARGET} 119 | echo 'audioport = 5002' | tee -a ${TARGET} 120 | echo 'audiopt = 111' | tee -a ${TARGET} 121 | echo 'audiortpmap = opus/48000/2' | tee -a ${TARGET} 122 | echo 'videoport = 5004' | tee -a ${TARGET} 123 | echo 'videopt = 96' | tee -a ${TARGET} 124 | echo 'videortpmap = H264/90000' | tee -a ${TARGET} 125 | echo 'videofmtp = profile-level-id=42e028\;packetization-mode=1' | tee -a ${TARGET} 126 | 127 | # /opt/janus/etc/janus/janus.transport.http.cfg 128 | TARGET="/opt/janus/etc/janus/janus.transport.http.cfg" 129 | 130 | exec_cmd "sed -i.bak -e 's/^https = no/https = yes/' ${TARGET}" 131 | exec_cmd "sed -i -e 's/^;secure_port/secure_port/g' ${TARGET}" 132 | 133 | # /opt/janus/etc/janus/janus.cfg 134 | TARGET="/opt/janus/etc/janus/janus.cfg" 135 | 136 | exec_cmd "sed -i.bak -e 's/^;stun_server = stun.voip.eutelia.it/stun_server = stun.webrtc.ecl.ntt.com/' ${TARGET}" 137 | exec_cmd "sed -i -e 's/^;stun_port/stun_port/' ${TARGET}" 138 | exec_cmd "sed -i -e 's/^;turn_server = myturnserver.com/turn_server = 52.41.145.197/' ${TARGET}" 139 | exec_cmd "sed -i -e 's/^;turn_port = 3478/turn_port = 443/' ${TARGET}" 140 | exec_cmd "sed -i -e 's/^;turn_type = udp/turn_type = tcp/' ${TARGET}" 141 | exec_cmd "sed -i -e 's/^;turn_user = myuser/turn_user = siruuser/' ${TARGET}" 142 | exec_cmd "sed -i -e 's/^;turn_pwd = mypassword/turn_pwd = s1rUu5ev/' ${TARGET}" 143 | 144 | print_status "Finished to install Janus" 145 | } 146 | 147 | install_gstreamer() { 148 | print_status "Install gstreamer" 149 | 150 | exec_cmd "apt-get update" 151 | exec_cmd "apt-get install -y gstreamer1.0" 152 | 153 | print_status "Finished to install gstreamer" 154 | } 155 | 156 | 157 | install_ssg() { 158 | exec_cmd "mkdir skyway-iot" 159 | 160 | print_status "Install SkyWay Signaling Gateway" 161 | exec_cmd "cd ./skyway-iot;git clone --branch v0.5.4 https://github.com/nttcom/skyway-signaling-gateway.git;cd skyway-signaling-gateway;npm install" 162 | 163 | ## 164 | ## todo update configs. 165 | ## 166 | # skyway-signaling-gateway/conf/skyway.yaml (apply APIKEY variable) 167 | print_status "Update config" 168 | exec_cmd "cd ./skyway-iot/skyway-signaling-gateway/conf;sed -i.bak -e 's/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/${APIKEY}/' skyway.yaml" 169 | 170 | print_status "Finished to install SSG" 171 | } 172 | 173 | install_siru_device() { 174 | print_status "Install SkyWay IoT Room Utility for device" 175 | exec_cmd "cd ./skyway-iot;git clone --branch v0.0.4 https://github.com/nttcom/skyway-siru-device.git;cd skyway-siru-device;npm install" 176 | 177 | print_status "Finished to install SkyWay IoT Room Utility for device" 178 | } 179 | 180 | setup() { 181 | print_bold "Install pre-required packages" 182 | install_prerequired 183 | install_nodejs 184 | 185 | print_bold "Install Janus" 186 | install_janus 187 | 188 | print_bold "Install gstreamer" 189 | install_gstreamer 190 | 191 | print_bold "Install SkyWay Signaling Gateway" 192 | install_ssg 193 | 194 | print_bold "Install SkyWay IoT Room Utility for device" 195 | install_siru_device 196 | } 197 | 198 | start() { 199 | print_bold "Input your SkyWay APIKEY" "APIKEY can be obtained at our dashboard.\n (https://console-webrtc-free.ecl.ntt.com/users/login).\n Please note that you need to set 'localhost' in your Available domains setting.\n" 200 | read -p "Your APIKEY: " APIKEY 201 | 202 | read -p "Attempt to start installing SkyWay IoT SDK. Is it ok? [Y/n] " IN 203 | 204 | case ${IN} in 205 | "" | "Y" | "y" | "yes" | "Yes" | "YES" ) setup;; 206 | * ) print_status "Aborted";; 207 | esac 208 | } 209 | 210 | start 211 | -------------------------------------------------------------------------------- /install_scripts/debian_based/installer.0.1.0.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script to install [SkyWay IoT SDK](https://github.com/nttcom/skyway-iot-sdk) onto general debian series. 4 | # Tested environments are: 5 | # Ubuntu16.04 6 | # Raspbian jessie 7 | # 8 | # Run as root or insert `sudo -E` before `bash` 9 | 10 | print_status() { 11 | echo 12 | echo "## $1" 13 | echo 14 | } 15 | 16 | if test -t 1; then # if terminal 17 | ncolors=$(which tput > /dev/null && tput colors) # supports color 18 | if test -n "$ncolors" && test $ncolors -ge 8; then 19 | termcols=$(tput cols) 20 | bold="$(tput bold)" 21 | underline="$(tput smul)" 22 | standout="$(tput smso)" 23 | normal="$(tput sgr0)" 24 | black="$(tput setaf 0)" 25 | red="$(tput setaf 1)" 26 | green="$(tput setaf 2)" 27 | yellow="$(tput setaf 3)" 28 | blue="$(tput setaf 4)" 29 | magenta="$(tput setaf 5)" 30 | cyan="$(tput setaf 6)" 31 | white="$(tput setaf 7)" 32 | fi 33 | fi 34 | 35 | print_bold() { 36 | title="$1" 37 | text="$2" 38 | 39 | echo 40 | echo "${green}================================================================================${normal}" 41 | echo "${green}================================================================================${normal}" 42 | echo "${bold}${blue}${title}${normal}" 43 | echo 44 | echo " ${text}" 45 | echo 46 | echo "${green}================================================================================${normal}" 47 | echo "${green}================================================================================${normal}" 48 | } 49 | 50 | bail() { 51 | echo 'Error executing command, exiting' 52 | exit 1 53 | } 54 | 55 | exec_cmd_nobail() { 56 | echo "+ $1" 57 | bash -c "$1" 58 | } 59 | 60 | exec_cmd() { 61 | exec_cmd_nobail "$1" || bail 62 | } 63 | 64 | install_prerequired() { 65 | print_status "Install pre-required packages" 66 | 67 | exec_cmd 'apt-get update' 68 | exec_cmd 'apt-get install -y git aptitude' 69 | 70 | print_status "Finished to install pre-required packages" 71 | } 72 | 73 | install_nodejs() { 74 | print_status "Install node 8.x" 75 | 76 | curl -sL https://deb.nodesource.com/setup_8.x | bash - 77 | apt-get -y install nodejs build-essential 78 | 79 | print_status "Finished to install nodejs" 80 | } 81 | 82 | install_janus() { 83 | print_status "Install required packages" 84 | exec_cmd "aptitude install -y 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" 85 | exec_cmd "mkdir tmp" 86 | 87 | print_status "Install usrsctp" 88 | exec_cmd "cd ./tmp;git clone https://github.com/sctplab/usrsctp" 89 | exec_cmd "cd ./tmp/usrsctp;./bootstrap;./configure --prefix=/usr; make; sudo make install" 90 | exec_cmd "rm -rf ./tmp/usrsctp" 91 | 92 | print_status "Install Janus-gateway & skywayiot-plugin" 93 | exec_cmd "cd ./tmp;git clone --branch v0.2.1 https://github.com/meetecho/janus-gateway.git" 94 | exec_cmd "cd ./tmp;git clone --branch v0.4.3 https://github.com/nttcom/janus-skywayiot-plugin.git" 95 | exec_cmd "cd ./tmp/janus-skywayiot-plugin;bash addplugin.sh" 96 | exec_cmd "cd ./tmp/janus-gateway;sh autogen.sh;./configure --prefix=/opt/janus --disable-mqtt --disable-rabbitmq --disable-docs --disable-websockets;make;make install;make configs" 97 | 98 | exec_cmd "rm -rf tmp" 99 | 100 | ## 101 | ## todo update configs. 102 | ## 103 | # /opt/janus/etc/janus/janus.plugin.streaming.cfg 104 | TARGET="/opt/janus/etc/janus/janus.plugin.streaming.cfg" 105 | 106 | exec_cmd "sed -i.bak -e '44,74 s/^/;/g' ${TARGET}" 107 | 108 | echo '; Sample config for SkyWay IoT SDK' | tee -a ${TARGET} 109 | echo '; This streams H.246 as video and opus as audio codec' | tee -a ${TARGET} 110 | echo ';' | tee -a ${TARGET} 111 | echo '[skywayiotsdk-example]' | tee -a ${TARGET} 112 | echo 'type = rtp' | tee -a ${TARGET} 113 | echo 'id = 1' | tee -a ${TARGET} 114 | echo 'description = SkyWay IoT SDK H264 example streaming' | tee -a ${TARGET} 115 | echo 'audio = yes' | tee -a ${TARGET} 116 | echo 'video = yes' | tee -a ${TARGET} 117 | echo 'audioport = 5002' | tee -a ${TARGET} 118 | echo 'audiopt = 111' | tee -a ${TARGET} 119 | echo 'audiortpmap = opus/48000/2' | tee -a ${TARGET} 120 | echo 'videoport = 5004' | tee -a ${TARGET} 121 | echo 'videopt = 96' | tee -a ${TARGET} 122 | echo 'videortpmap = H264/90000' | tee -a ${TARGET} 123 | echo 'videofmtp = profile-level-id=42c01f\;packetization-mode=1' | tee -a ${TARGET} 124 | 125 | # /opt/janus/etc/janus/janus.transport.http.cfg 126 | TARGET="/opt/janus/etc/janus/janus.transport.http.cfg" 127 | 128 | exec_cmd "sed -i.bak -e 's/^https = no/https = yes/' ${TARGET}" 129 | exec_cmd "sed -i -e 's/^;secure_port/secure_port/g' ${TARGET}" 130 | 131 | # /opt/janus/etc/janus/janus.cfg 132 | TARGET="/opt/janus/etc/janus/janus.cfg" 133 | 134 | exec_cmd "sed -i.bak -e 's/^;stun_server = stun.voip.eutelia.it/stun_server = stun.webrtc.ecl.ntt.com/' ${TARGET}" 135 | exec_cmd "sed -i -e 's/^;stun_port/stun_port/' ${TARGET}" 136 | exec_cmd "sed -i -e 's/^;turn_server = myturnserver.com/turn_server = 52.41.145.197/' ${TARGET}" 137 | exec_cmd "sed -i -e 's/^;turn_port = 3478/turn_port = 443/' ${TARGET}" 138 | exec_cmd "sed -i -e 's/^;turn_type = udp/turn_type = tcp/' ${TARGET}" 139 | exec_cmd "sed -i -e 's/^;turn_user = myuser/turn_user = siruuser/' ${TARGET}" 140 | exec_cmd "sed -i -e 's/^;turn_pwd = mypassword/turn_pwd = s1rUu5ev/' ${TARGET}" 141 | 142 | print_status "Finished to install Janus" 143 | } 144 | 145 | install_gstreamer() { 146 | print_status "Install gstreamer" 147 | 148 | exec_cmd "apt-get update" 149 | exec_cmd "apt-get install -y gstreamer1.0" 150 | 151 | print_status "Finished to install gstreamer" 152 | } 153 | 154 | 155 | install_ssg() { 156 | print_status "Install SkyWay Signaling Gateway" 157 | exec_cmd "npm install -g skyway-signaling-gateway@0.5.6" 158 | 159 | print_status "Finished to install SSG" 160 | } 161 | 162 | install_mosquitto() { 163 | print_status "Install mosquitto" 164 | exec_cmd "apt-get install -y mosquitto mosquitto-clients" 165 | 166 | print_status "Finished to install mosquitto and clients" 167 | } 168 | 169 | install() { 170 | print_bold "Install pre-required packages" 171 | install_prerequired 172 | install_nodejs 173 | 174 | print_bold "Install Janus" 175 | install_janus 176 | 177 | print_bold "Install gstreamer" 178 | install_gstreamer 179 | 180 | print_bold "Install SkyWay Signaling Gateway" 181 | install_ssg 182 | 183 | print_bold "Install mosquitto" 184 | install_mosquitto 185 | } 186 | 187 | print_final() { 188 | print_bold "Installation finished!" "run 'ssg setup' (You'll need to get your API key from https://webrtc.ecl.ntt.com/en/login.html.)" 189 | } 190 | 191 | start() { 192 | install 193 | 194 | print_final 195 | } 196 | 197 | start 198 | -------------------------------------------------------------------------------- /install_scripts/debian_based/installer.sh: -------------------------------------------------------------------------------- 1 | installer.0.1.0.sh -------------------------------------------------------------------------------- /install_scripts/raspbian_stretch/installer.0.0.2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script to install [SkyWay IoT SDK](https://github.com/nttcom/skyway-iot-sdk) onto Raspbian stretch. 4 | # 5 | # Run as root or insert `sudo -E` before `bash` 6 | 7 | APIKEY="THIS_KEY_WILL_BE_UPDATED" 8 | 9 | print_status() { 10 | echo 11 | echo "## $1" 12 | echo 13 | } 14 | 15 | if test -t 1; then # if terminal 16 | ncolors=$(which tput > /dev/null && tput colors) # supports color 17 | if test -n "$ncolors" && test $ncolors -ge 8; then 18 | termcols=$(tput cols) 19 | bold="$(tput bold)" 20 | underline="$(tput smul)" 21 | standout="$(tput smso)" 22 | normal="$(tput sgr0)" 23 | black="$(tput setaf 0)" 24 | red="$(tput setaf 1)" 25 | green="$(tput setaf 2)" 26 | yellow="$(tput setaf 3)" 27 | blue="$(tput setaf 4)" 28 | magenta="$(tput setaf 5)" 29 | cyan="$(tput setaf 6)" 30 | white="$(tput setaf 7)" 31 | fi 32 | fi 33 | 34 | print_bold() { 35 | title="$1" 36 | text="$2" 37 | 38 | echo 39 | echo "${green}================================================================================${normal}" 40 | echo "${green}================================================================================${normal}" 41 | echo -e "${bold}${blue}${title}${normal}" 42 | echo 43 | echo -en " ${text}" 44 | echo 45 | echo "${green}================================================================================${normal}" 46 | echo "${green}================================================================================${normal}" 47 | } 48 | 49 | bail() { 50 | echo 'Error executing command, exiting' 51 | exit 1 52 | } 53 | 54 | exec_cmd_nobail() { 55 | echo "+ $1" 56 | bash -c "$1" 57 | } 58 | 59 | exec_cmd() { 60 | exec_cmd_nobail "$1" || bail 61 | } 62 | 63 | install_prerequired() { 64 | print_status "Install pre-required packages" 65 | 66 | exec_cmd 'apt-get update' 67 | exec_cmd 'apt-get install -y git aptitude' 68 | 69 | print_status "Finished to install pre-required packages" 70 | } 71 | 72 | install_nodejs() { 73 | print_status "Install node 8.x" 74 | 75 | curl -sL https://deb.nodesource.com/setup_8.x | bash - 76 | apt-get -y install nodejs build-essential 77 | 78 | print_status "Finished to install nodejs" 79 | } 80 | 81 | install_janus() { 82 | print_status "Install required packages" 83 | exec_cmd "aptitude install -y 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" 84 | exec_cmd "mkdir tmp" 85 | 86 | print_status "Install usrsctp" 87 | exec_cmd "cd ./tmp;git clone https://github.com/sctplab/usrsctp" 88 | exec_cmd "cd ./tmp/usrsctp;./bootstrap;./configure --prefix=/usr; make; sudo make install" 89 | exec_cmd "rm -rf ./tmp/usrsctp" 90 | 91 | print_status "Install Janus-gateway & skywayiot-plugin" 92 | exec_cmd "cd ./tmp;git clone --branch v0.2.1 https://github.com/meetecho/janus-gateway.git" 93 | exec_cmd "cd ./tmp;git clone --branch v0.4.2 https://github.com/nttcom/janus-skywayiot-plugin.git" 94 | exec_cmd "cd ./tmp/janus-skywayiot-plugin;bash addplugin.sh" 95 | exec_cmd "cd ./tmp/janus-gateway;sh autogen.sh;./configure --prefix=/opt/janus --disable-mqtt --disable-rabbitmq --disable-docs --disable-websockets;make;make install;make configs" 96 | 97 | exec_cmd "rm -rf tmp" 98 | 99 | ## 100 | ## todo update configs. 101 | ## 102 | # /opt/janus/etc/janus/janus.plugin.streaming.cfg 103 | TARGET="/opt/janus/etc/janus/janus.plugin.streaming.cfg" 104 | 105 | exec_cmd "sed -i.bak -e '44,74 s/^/;/g' ${TARGET}" 106 | 107 | echo '; Sample config for SkyWay IoT SDK' | tee -a ${TARGET} 108 | echo '; This streams H.246 as video and opus as audio codec' | tee -a ${TARGET} 109 | echo ';' | tee -a ${TARGET} 110 | echo '[skywayiotsdk-example]' | tee -a ${TARGET} 111 | echo 'type = rtp' | tee -a ${TARGET} 112 | echo 'id = 1' | tee -a ${TARGET} 113 | echo 'description = SkyWay IoT SDK H264 example streaming' | tee -a ${TARGET} 114 | echo 'audio = yes' | tee -a ${TARGET} 115 | echo 'video = yes' | tee -a ${TARGET} 116 | echo 'audioport = 5002' | tee -a ${TARGET} 117 | echo 'audiopt = 111' | tee -a ${TARGET} 118 | echo 'audiortpmap = opus/48000/2' | tee -a ${TARGET} 119 | echo 'videoport = 5004' | tee -a ${TARGET} 120 | echo 'videopt = 96' | tee -a ${TARGET} 121 | echo 'videortpmap = H264/90000' | tee -a ${TARGET} 122 | echo 'videofmtp = profile-level-id=42e028\;packetization-mode=1' | tee -a ${TARGET} 123 | 124 | # /opt/janus/etc/janus/janus.transport.http.cfg 125 | TARGET="/opt/janus/etc/janus/janus.transport.http.cfg" 126 | 127 | exec_cmd "sed -i.bak -e 's/^https = no/https = yes/' ${TARGET}" 128 | exec_cmd "sed -i -e 's/^;secure_port/secure_port/g' ${TARGET}" 129 | 130 | # /opt/janus/etc/janus/janus.cfg 131 | TARGET="/opt/janus/etc/janus/janus.cfg" 132 | 133 | exec_cmd "sed -i.bak -e 's/^;stun_server = stun.voip.eutelia.it/stun_server = stun.webrtc.ecl.ntt.com/' ${TARGET}" 134 | exec_cmd "sed -i -e 's/^;stun_port/stun_port/' ${TARGET}" 135 | exec_cmd "sed -i -e 's/^;turn_server = myturnserver.com/turn_server = 52.41.145.197/' ${TARGET}" 136 | exec_cmd "sed -i -e 's/^;turn_port = 3478/turn_port = 443/' ${TARGET}" 137 | exec_cmd "sed -i -e 's/^;turn_type = udp/turn_type = tcp/' ${TARGET}" 138 | exec_cmd "sed -i -e 's/^;turn_user = myuser/turn_user = siruuser/' ${TARGET}" 139 | exec_cmd "sed -i -e 's/^;turn_pwd = mypassword/turn_pwd = s1rUu5ev/' ${TARGET}" 140 | 141 | print_status "Finished to install Janus" 142 | } 143 | 144 | install_gstreamer() { 145 | print_status "Install gstreamer" 146 | 147 | exec_cmd "apt-get update" 148 | exec_cmd "apt-get install -y libgstreamer1.0-0 libgstreamer1.0-dev gstreamer1.0-nice gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-omx" 149 | 150 | print_status "Finished to install gstreamer" 151 | } 152 | 153 | 154 | install_ssg() { 155 | exec_cmd "mkdir skyway-iot" 156 | 157 | print_status "Install SkyWay Signaling Gateway" 158 | exec_cmd "cd ./skyway-iot;git clone --branch v0.5.4 https://github.com/nttcom/skyway-signaling-gateway.git;cd skyway-signaling-gateway;npm install" 159 | 160 | ## 161 | ## todo update configs. 162 | ## 163 | # skyway-signaling-gateway/conf/skyway.yaml (apply APIKEY variable) 164 | print_status "Update config" 165 | exec_cmd "cd ./skyway-iot/skyway-signaling-gateway/conf;sed -i.bak -e 's/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/${APIKEY}/' skyway.yaml" 166 | 167 | print_status "Finished to install SSG" 168 | } 169 | 170 | install_siru_device() { 171 | print_status "Install SkyWay IoT Room Utility for device" 172 | exec_cmd "cd ./skyway-iot;git clone --branch v0.0.4 https://github.com/nttcom/skyway-siru-device.git;cd skyway-siru-device;npm install" 173 | 174 | print_status "Finished to install SkyWay IoT Room Utility for device" 175 | } 176 | 177 | setup() { 178 | print_bold "Install pre-required packages" 179 | install_prerequired 180 | install_nodejs 181 | 182 | print_bold "Install Janus" 183 | install_janus 184 | 185 | print_bold "Install gstreamer" 186 | install_gstreamer 187 | 188 | print_bold "Install SkyWay Signaling Gateway" 189 | install_ssg 190 | 191 | print_bold "Install SkyWay IoT Room Utility for device" 192 | install_siru_device 193 | } 194 | 195 | start() { 196 | print_bold "Input your SkyWay APIKEY" "APIKEY can be obtained at our dashboard.\n (https://console-webrtc-free.ecl.ntt.com/users/login).\n Please note that you need to set 'localhost' in your Available domains setting.\n" 197 | read -p "Your APIKEY: " APIKEY 198 | 199 | read -p "Attempt to start installing SkyWay IoT SDK. Is it ok? [Y/n] " IN 200 | 201 | case ${IN} in 202 | "" | "Y" | "y" | "yes" | "Yes" | "YES" ) setup;; 203 | * ) print_status "Aborted";; 204 | esac 205 | } 206 | 207 | start 208 | -------------------------------------------------------------------------------- /install_scripts/raspbian_stretch/installer.0.1.0.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script to install [SkyWay IoT SDK](https://github.com/nttcom/skyway-iot-sdk) onto Raspbian stretch. 4 | # 5 | # curl -sL | sudo -E bash - 6 | 7 | 8 | print_status() { 9 | echo 10 | echo "## $1" 11 | echo 12 | } 13 | 14 | if test -t 1; then # if terminal 15 | ncolors=$(which tput > /dev/null && tput colors) # supports color 16 | if test -n "$ncolors" && test $ncolors -ge 8; then 17 | termcols=$(tput cols) 18 | bold="$(tput bold)" 19 | underline="$(tput smul)" 20 | standout="$(tput smso)" 21 | normal="$(tput sgr0)" 22 | black="$(tput setaf 0)" 23 | red="$(tput setaf 1)" 24 | green="$(tput setaf 2)" 25 | yellow="$(tput setaf 3)" 26 | blue="$(tput setaf 4)" 27 | magenta="$(tput setaf 5)" 28 | cyan="$(tput setaf 6)" 29 | white="$(tput setaf 7)" 30 | fi 31 | fi 32 | 33 | print_bold() { 34 | title="$1" 35 | text="$2" 36 | 37 | echo 38 | echo "${green}================================================================================${normal}" 39 | echo "${green}================================================================================${normal}" 40 | echo "${bold}${blue}${title}${normal}" 41 | echo 42 | echo " ${text}" 43 | echo 44 | echo "${green}================================================================================${normal}" 45 | echo "${green}================================================================================${normal}" 46 | } 47 | 48 | bail() { 49 | echo 'Error executing command, exiting' 50 | exit 1 51 | } 52 | 53 | exec_cmd_nobail() { 54 | echo "+ $1" 55 | bash -c "$1" 56 | } 57 | 58 | exec_cmd() { 59 | exec_cmd_nobail "$1" || bail 60 | } 61 | 62 | install_prerequired() { 63 | print_status "Install pre-required packages" 64 | 65 | exec_cmd 'apt-get update' 66 | exec_cmd 'apt-get install -y git aptitude' 67 | 68 | print_status "Finished to install pre-required packages" 69 | } 70 | 71 | install_nodejs() { 72 | print_status "Install node 8.x" 73 | 74 | curl -sL https://deb.nodesource.com/setup_8.x | bash - 75 | apt-get -y install nodejs build-essential 76 | 77 | print_status "Finished to install nodejs" 78 | } 79 | 80 | install_janus() { 81 | print_status "Install required packages" 82 | exec_cmd "aptitude install -y 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" 83 | exec_cmd "mkdir tmp" 84 | 85 | print_status "Install usrsctp" 86 | exec_cmd "cd ./tmp;git clone https://github.com/sctplab/usrsctp" 87 | exec_cmd "cd ./tmp/usrsctp;./bootstrap;./configure --prefix=/usr; make; sudo make install" 88 | exec_cmd "rm -rf ./tmp/usrsctp" 89 | 90 | print_status "Install Janus-gateway & skywayiot-plugin" 91 | exec_cmd "cd ./tmp;git clone --branch v0.2.1 https://github.com/meetecho/janus-gateway.git" 92 | exec_cmd "cd ./tmp;git clone --branch v0.4.3 https://github.com/nttcom/janus-skywayiot-plugin.git" 93 | exec_cmd "cd ./tmp/janus-skywayiot-plugin;bash addplugin.sh" 94 | exec_cmd "cd ./tmp/janus-gateway;sh autogen.sh;./configure --prefix=/opt/janus --disable-mqtt --disable-rabbitmq --disable-docs --disable-websockets;make;make install;make configs" 95 | 96 | exec_cmd "rm -rf tmp" 97 | 98 | ## 99 | ## todo update configs. 100 | ## 101 | # /opt/janus/etc/janus/janus.plugin.streaming.cfg 102 | TARGET="/opt/janus/etc/janus/janus.plugin.streaming.cfg" 103 | 104 | exec_cmd "sed -i.bak -e '44,74 s/^/;/g' ${TARGET}" 105 | 106 | echo '; Sample config for SkyWay IoT SDK' | tee -a ${TARGET} 107 | echo '; This streams H.246 as video and opus as audio codec' | tee -a ${TARGET} 108 | echo ';' | tee -a ${TARGET} 109 | echo '[skywayiotsdk-example]' | tee -a ${TARGET} 110 | echo 'type = rtp' | tee -a ${TARGET} 111 | echo 'id = 1' | tee -a ${TARGET} 112 | echo 'description = SkyWay IoT SDK H264 example streaming' | tee -a ${TARGET} 113 | echo 'audio = yes' | tee -a ${TARGET} 114 | echo 'video = yes' | tee -a ${TARGET} 115 | echo 'audioport = 5002' | tee -a ${TARGET} 116 | echo 'audiopt = 111' | tee -a ${TARGET} 117 | echo 'audiortpmap = opus/48000/2' | tee -a ${TARGET} 118 | echo 'videoport = 5004' | tee -a ${TARGET} 119 | echo 'videopt = 96' | tee -a ${TARGET} 120 | echo 'videortpmap = H264/90000' | tee -a ${TARGET} 121 | echo 'videofmtp = profile-level-id=42c01f\;packetization-mode=1' | tee -a ${TARGET} 122 | 123 | # /opt/janus/etc/janus/janus.transport.http.cfg 124 | TARGET="/opt/janus/etc/janus/janus.transport.http.cfg" 125 | 126 | exec_cmd "sed -i.bak -e 's/^https = no/https = yes/' ${TARGET}" 127 | exec_cmd "sed -i -e 's/^;secure_port/secure_port/g' ${TARGET}" 128 | 129 | # /opt/janus/etc/janus/janus.cfg 130 | TARGET="/opt/janus/etc/janus/janus.cfg" 131 | 132 | exec_cmd "sed -i.bak -e 's/^;stun_server = stun.voip.eutelia.it/stun_server = stun.webrtc.ecl.ntt.com/' ${TARGET}" 133 | exec_cmd "sed -i -e 's/^;stun_port/stun_port/' ${TARGET}" 134 | exec_cmd "sed -i -e 's/^;turn_server = myturnserver.com/turn_server = 52.41.145.197/' ${TARGET}" 135 | exec_cmd "sed -i -e 's/^;turn_port = 3478/turn_port = 443/' ${TARGET}" 136 | exec_cmd "sed -i -e 's/^;turn_type = udp/turn_type = tcp/' ${TARGET}" 137 | exec_cmd "sed -i -e 's/^;turn_user = myuser/turn_user = siruuser/' ${TARGET}" 138 | exec_cmd "sed -i -e 's/^;turn_pwd = mypassword/turn_pwd = s1rUu5ev/' ${TARGET}" 139 | 140 | print_status "Finished to install Janus" 141 | } 142 | 143 | install_gstreamer() { 144 | print_status "Install gstreamer" 145 | 146 | exec_cmd "apt-get update" 147 | exec_cmd "apt-get install -y libgstreamer1.0-0 libgstreamer1.0-dev gstreamer1.0-nice gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-omx gstreamer1.0-alsa" 148 | 149 | print_status "Finished to install gstreamer" 150 | } 151 | 152 | 153 | install_ssg() { 154 | print_status "Install SkyWay Signaling Gateway" 155 | 156 | exec_cmd "npm install -g skyway-signaling-gateway@0.5.6" 157 | 158 | print_status "Finished to install SSG" 159 | } 160 | 161 | install_mosquitto() { 162 | print_status "Install mosquitto" 163 | exec_cmd "apt-get install -y mosquitto mosquitto-clients" 164 | print_status "Finished to install mosquitto and clients" 165 | } 166 | 167 | install() { 168 | print_bold "Install pre-required packages" 169 | install_prerequired 170 | install_nodejs 171 | 172 | print_bold "Install Janus" 173 | install_janus 174 | 175 | print_bold "Install gstreamer" 176 | install_gstreamer 177 | 178 | print_bold "Install SkyWay Signaling Gateway" 179 | install_ssg 180 | 181 | print_bold "Install mosquitto" 182 | install_mosquitto 183 | } 184 | 185 | print_final() { 186 | print_bold "Installation finished!" "run 'ssg setup' (You'll need to get your API key from https://webrtc.ecl.ntt.com/en/login.html.)" 187 | } 188 | 189 | start() { 190 | install 191 | print_final 192 | } 193 | 194 | start 195 | -------------------------------------------------------------------------------- /install_scripts/raspbian_stretch/installer.sh: -------------------------------------------------------------------------------- 1 | installer.0.1.0.sh --------------------------------------------------------------------------------