Coder Social home page Coder Social logo

saisyam / drachtio-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from drachtio/drachtio-server

0.0 1.0 0.0 212.38 MB

A SIP call processing server that can be controlled via nodejs applications

Home Page: https://drachtio.org

License: MIT License

Dockerfile 0.18% Makefile 0.77% Shell 6.16% M4 4.59% C++ 82.71% JavaScript 5.59%

drachtio-server's Introduction

drachtio-server Build Status

drachtio logo

drachtio-server is a SIP server that is built on the sofia SIP stack. It provides a high-performance SIP engine that can be controlled by client applications written in pure Javascript running on node.js .

The nodejs module that you can use to create applications controlling the server is called drachtio-srf.

Docker

A docker image can be found here.

The drachtio/drachtio-server:latest tagged image is kept current with the tip of the develop branch, which is probably what you want.

Ansible

An ansible role can be found here for building drachtio using ansible. This is the recommended approach for building from source, as it will install a reasonable configuration file and systemd scripts for you, but if you want to build eveything manually then read on..

Building from source

Please use the develop branch when building from source, as it is most up to date

Note: The build requires cmake, libtool-bin, libcurl, which can be installed on debian as sudo apt install libcurl4-openssl-dev cmake libtool-bin. All other third-party dependencies can be found under $(srcdir)/deps. These include boost and the sofia sip stack. sofia is included as git submodules in this project.

Note for OSX: Install and tell the compiler to use homebrew's openssl

brew install openssl
export LDFLAGS="-L/usr/local/opt/openssl/lib $LDFLAGS"
export CXXFLAGS="-I/usr/local/opt/openssl/include $CXXFLAGS"
export CFLAGS="-I/usr/local/opt/openssl/include $CFLAGS"

Then:

git clone --depth=50 --branch=develop git://github.com/davehorton/drachtio-server.git && cd drachtio-server
git submodule update --init --recursive
./autogen.sh
mkdir build && cd $_
../configure CPPFLAGS='-DNDEBUG'
make
sudo make install

Platform support and dependencies

drachtio-server has been most heavily deployed on debian jesse (8) but has undergone at least some level of testing on the following platforms:

  • Debian 8, 9
  • Centos 6.x
  • Ubuntu
  • Fedora 20
  • Linux Mint
  • Mac OSX (10.9.2+)
  • Raspberry pi

The following libraries are required to build:

  • gcc and c++ compilers
  • libssl-dev
  • libtool
  • libtool-bin
  • autoconf
  • automake
  • zlib1g-dev

Installing

The output of the build process is an executable named 'drachtio'. You can run sudo make install to copy it into /usr/local/bin, or you can run the executable directly from the build directory. If run with no command line parameters, it will look for a configuration file in /etc/drachtio.conf.xml; alternatively you can specify the config file location by starting the executable with the -f option (e.g. ./drachtio -f ../drachtio.conf.xml).

The server can be run as a daemon process by running with the --daemon command line parameter.

To see all of the command line options, run drachtio -h.

The process can be installed as a Linux systemd or init script using the example script that can be found in drachtio.service or drachtio-init-script.

Configuring

drachtio can be configured via a configuration file (see sample config), environment variables, or command-line arguments. The order of precedence is that command-line arguments will dictate, if provided; otherwise environment variables (if provided), and last of all the configuration file. This is on a parameter-by-parameter basis; i.e. one configuration option may be provided by environment variables, some others by command-line args, and the rest by a configuration file.

Overview

The configuration settings are described below as provided in the configuration file, with notes as to the equivalent command line or environment variables (if available).

SIP

The most important configuration parameters specify which sip address(es) and protocols to listen on/for. drachtio can listen on multiple addresses/ports/protocols simultaneously, Example config file section:

<drachtio>
  <sip>
    <contacts>
      <contact>sip:172.28.0.1:5060;transport=udp,tcp</contact>
      <contact>sip:172.28.0.1:5080;transport=udp,tcp</contact>
    </contacts>

or, via command line:

drachtio --contact "sip:172.28.0.1:5060;transport=udp,tcp" \
   --contact "sip:172.28.0.1:5080;transport=udp,tcp"

Note: there is currently no option to specify these settings via environment variables.

Optionally, you can also specify an external ip address to associate with a sip contact, if the server is set up to masquerade or is otherwise assigned a public IP address that it does not know about. You can also specify the local network CIDR associated with a sip address, which is useful in scenarios where a server is connected to both public and private networks. See the sample configuration file for more details on this.

Admin port

The server listens for TCP (or, if desired, TLS) connections (e.g. inbound connections) from node.js applications on a specified address and port.

<drachtio>
  <admin port="9022" tls-port="9023" secret="cymru">127.0.0.1</admin>

or

drachtio --port 9022 --tls-port 9023 # address defaults to 0.0.0.0

or

DRACHTIO_ADMIN_TCP_PORT=9022 DRACHTIO_ADMIN_TLS_PORT=9023 drachtio

Logging

Log files can be written to the console, to a file, or to syslog (or any or all of the above simultaneously).

In a standard installation, log files are written to /var/log/drachtio with the current drachtio.log found there, and archived logs in the archive sub-folder. drachtio will automically truncate and roll logs based on the parameters specified in the config file.

In a container implementation, console based logging is more useful, and is the default when all arguments are supplied on the command line. Log levels for both drachtio and the underlying sofia sip stack can be specified:

<drachtio>
  <logging>
    <sofia-loglevel>3</sofia-loglevel> <!-- 0-9 -->
    <loglevel>info</loglevel> <!-- notice, warning, error, info, debug -->

or

drachtio --loglevel info --sofia-loglevel 3

or

DRACHTIO_LOGLEVEL=info DRACHTIO_SOFIA_LOGLEVEL=3 drachtio

Monitoring

Homer

drachtio can send encapsulated SIP messages to Homer for reporting.

<drachtio>
  <sip>
    <capture-server port="9060" hep-version="3" id="101">172.28.0.23</capture-server>

or, using command-line arguments

drachtio --homer 172.28.0.23 --homer-id 101  # defaults to HEP3 and UDP

or, using environment variables

DRACHTIO_HOMER_ADDRESS=172.28.0.23 DRACHTIO_HOMER_PORT=9060 DRACHTIO_HOMER_ID=101 drachtio
Prometheus.io

drachtio can be configured to report metrics to Prometheus.

<drachtio>
  <monitoring>
    <prometheus port="9060">172.28.0.23</prometheus>
  </monitoring>

or, using command line arguments

drachtio --prometheus-scrape-port 9090

or

drachtio --prometheus-scrape-port "0.0.0.0:9090"

or, using environment variables

DRACHTIO_PROMETHEUS_SCRAPE_PORT=9090 drachtio

For details on the specified metrics exposed, see here.

Fail2ban integration

To install fail2ban on a drachtio server, refer to this ansible role which installs and configures fail2ban with a filter for drachtio log files.

drachtio-server's People

Contributors

andrewvmail avatar csiwek avatar danias avatar davehorton avatar gitter-badger avatar jimg777 avatar wcs-machine-user avatar

Watchers

 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.