Coder Social home page Coder Social logo

kurento-sip-gw's Introduction

Synopsis

This project is a basic WebRTC to SIP gateway. It uses drachtio for SIP signaling and Kurento for the Media Server. This node application was made using Kurent-tutorial-node/helloworld. Html client UI is made using Login/Logout Animation Concept by Nikolay Talanov http://codepen.io/suez/pen/dPqxoM.

Motivation

This gateway was made to easily connect a browser to any classic SIP endpoint like Softphone, PABX or MCU. It was firstly designed to work with Asterisk and it works with it.

Architecture

Kurento-SIP-GW architecture

Installation on Ubuntu 16.04

First, install Kurento-media-server (with a coturn server it's better) :

echo "deb http://ubuntu.kurento.org trusty kms6" | sudo tee /etc/apt/sources.list.d/kurento.list
wget -O - http://ubuntu.kurento.org/kurento.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install kurento-media-server-6.0

Now, install coturn

sudo apt-get install coturn

Edit cotrun startup script /etc/init.d/coturn

  • If you're behind a NAT add :
EXTERNAL_IP=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)
LOCAL_IP=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)

DAEMON_ARGS="-c /etc/turnserver.conf -f -o -a -v -r kurento.org
-u kurento:kurento --no-stdout-log --external-ip $EXTERNAL_IP/$LOCAL_IP"

Next, install drachtio-server :

Note : we must install devlop branch to support sip info.

sudo apt-get install autoconf automake libtool-bin g++ libcurl4-openssl-dev libssl-dev
git clone --depth=50 --branch=develop git://github.com/davehorton/drachtio-server.git && cd drachtio-server
git submodule update --init --recursive
./bootstrap.sh
mkdir build && cd $_
../configure CPPFLAGS='-DNDEBUG'
make
sudo make install
# Put Drachtio as a Deamon service with sytemd
cp drachtio-server.service /etc/systemd/system
# Put Drachtio as a Deamon service with init.d
cp drachtio-init-script /etc/systemd/system


cd ../..
cp drachtio-conf.xml /etc

#start service
service drachtio-server start
#or
service drachtio-init-script start

Install nodejs 8 LTS vesion :

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

And finally, install node modules :

npm install

Server Configuration

Change config.serverPublicIP in file config.js to expose external public IP used for SIP sdp generation.

  • config.kurento.as_uri is for HTTPS node server, default=8443.
  • config.kurento.ws_uri is for Kurento-media-sever uri, default='ws://localhost:8888/kurento'
  • config.maxCallSeconds is for Call time limitation to control and limit long call usage (Demo server is limited to 60 seconds calls)
  • config.maxConcurentCalls is for limiting max concurrent call on a server.

Client Configuration

Change client gateway option in static/js/config_client.js

  • wsUrl : Kurneto-SIP-GW websocket server URL (default to 'wss://' + location.host + '/sip-gw' ).

  • dtmfTransport : "inband" for audio inband DTMF || "sip" for SIP INFO dtmf (Default to inband).

  • renegotiateMode : set how SIP calls deals with remote re-invite

    • none = only reply to SIP but not change anything in media stack
    • rtp = restart the rtp connection part on media stack (default value)
    • rtp-webrtc = restart the rtp connection part on media stack and restart the peerconnectino on browser part

To run

node server.js

Open https://localhost:8443/ and fill a userName and a destination number like [email protected] and click on Start Call.

Kurento-SIP-GW will send an invite to destination and connect media after call accept by remote end.

Reduce CPU usage by disabling H264 encoding in Kurento

By removing VP8 support in Kurento server configuration you can disable h264 encoding and reduce CPU usage by a factor 4 (from 40% to 10% of 1 core on a i7-7820HQ CPU per call).

Take care that removing transcoding in Kurento add some stability issues (Maybe due to keyframe generation on browser side).

First install openh264 gstreamer plugin

sudo apt-get install openh264-gst-plugins-bad-1.5

Then remove vp8 from /etc/kurento/modules/kurento/SdpEndpoint.conf.json by commenting VP8 line "name" : "VP8/90000" in VideoCodecs Array.

Restart Kurento

sudo kurent-mediaserver-6.0 restart

Tested with

  • Linphone
  • Asterisk 11 video echo diaplan application
  • Scopia Elite 6000 Series MCU - Avaya
  • Cisco MSE 8000 Series MCU

Current Limitations

  • Only a SIP inviter to other endpoint
  • No STUN/TURN/ICE support on SIP/RTP side
  • DTMF sending only not receiving

Roadmap

  1. Provide Demo ready server (still waiting purchasing department agreement....)
  2. Codec selection
  3. Call control API and administrator UI
  4. Build unit Test

Not planified yet :

  1. Run load Test
  2. Add RFC 4733 DTMF sending support
  3. Add SIP REGISTER
  4. Add incoming call support

Contributors

Damien Fétis

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

kurento-sip-gw's People

Contributors

daimoc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.