Seren

Introduction

Seren is a simple VoIP program based on the Opus codec that allows you to create a voice conference from the terminal, with up to 10 participants, without having to register accounts, exchange emails, or add people to contact lists. All you need to join an existing conference is the host name or IP address of one of the participants.
Seren creates a dynamic peer-to-peer network of equivalent nodes which exchange text and audio data using a udp connection, and offers the user the ability to change the quality/bitrate on the fly, encrypt the traffic and record the calls.

License

Seren is released under the GNU GPLv3 license.

How to compile Seren

Seren is written in C and uses alsa to access the sound card and libopus to compress the audio stream. In order to compile Seren you need:

  1. gcc
  2. make
  3. libasound
  4. libopus
  5. libogg
  6. libgmp
  7. libncurses

Under Debian/Ubuntu all the dependencies should be satisfied by installing the following packages:

build-essential libasound2-dev libopus-dev libogg-dev libgmp-dev libncursesw5-dev

If your distribution is too old and does not provide a package for libopus, you can build it from source by running the following commands:

$ mkdir src
$ cd src
$ wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
$ tar xvf opus-1.1.tar.gz
$ cd opus-1.1/
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig
# you can later uninstall with:
#$ sudo make uninstall
			

Once the dependencies are satisfied, you can compile the program simply with:

$ ./configure && make

The resulting binary can be run from the local directory or can be installed with:

$ make install

To clean the build directory run:

$ make clean

or if you want to reset the configuration before running the configure again:

$ make distclean

Using Seren

You can access the help by running:

$ seren -h
Seren, ver. 0.0.21

Usage: seren [option...]

Options:
  -h             print help
  -v             increment verbosity level
  -L logfile     log messages to logfile       ($HOME/.seren/seren.log)
  -N             disable ncurses interface
  -t theme       set ncurses theme
                 0-simple, 1-dark, 2-clear     (1)
  -n nick        set nickname                  (login name)
  -p port        set udp listening port        (8110)
  -b bitrate     set bitrate in bit/s          (16000)
  -C complexity  set encoder complexity [0-10] (10)
  -d audiodev    set playback audio device     (hw:0,0)
  -D audiodev    set capture audio device      (playback device)
  -c host[:port] autocall host on startup
  -a             autoaccept calls
  -S             disable STUN
			

This will show you a list of command line options. The values in parentheses on the right are the default values. Refer to the man page for more information about these options.
To create a conference the first node starts the program with:

$ ./seren -n NICK

where NICK is of course your nickname. If you do not specify the nickname it will default to your login name. The program will now listen for incoming connections on udp port 8110 (you can change this port with -p option). Note that if you are using a router from a home connection and want people to be able to call you from the outside, you'll most likely need to forward this port.

On the status bar on the bottom, you can see a logarithmic vu-meter and a peak indicator for the microphone input. Make sure that the peak never reaches 100% and that the vu-meter moves enough when you speak into the microphone.

People that want to join a conference will need the IP address or host name of one of the participants. After starting the program with the same command line as above, they will type /c host[:port] to connect to an active conference, where host can be either an IP address or a hostname, and port can be omitted when using the standard 8110 port.

On the right part of the window there is the list of the participants, together with the logarithmic vu-meter indicating their audio level. This allows you to easily understand who is talking. Also, the nicknames are shown in different colors depending on their packet loss: the green, yellow and red colors refers respectively to a packet loss <= 0.5 %, between 0.5% and 5% and > 5%.

While the program is running, type /h to access the online help. The available commands include /i or F4 to print information about the status of the program and the network/participants, /m or F5 to mute the microphone, /g to set a software gain for the microphone and /b to change bitrate on the fly.

Node modes and encryption

Seren supports three basic modes of operation:

  1. Clear mode: both traffic and handshake are sent in clear.
  2. Secure mode: traffic is encrypted but the initial handshake is sent in clear. It uses DHM key exchange and a different key for each link.
  3. Pre-shared key (PSK) mode: everything is encrypted using a pre-shared key.

Depending on which mode is currently selected, the letters "CLR", "SEC" or "PSK" will appear in the bottom left corner of the window.

The default mode of operation is Secure. To set the mode of operation of your node you can use the /e command, usually before joining or hosting a conference. If necessary, though, these modes can be changed on the fly while the conference is running, providing that all the nodes switch mode within 6 seconds to avoid node timeouts.

When using the Secure mode, Seren by default uses the XTEA block cipher in cbc mode (unless this is changed with /X before calling a host), together with a 128-bit key exchanged using Diffie–Hellman–Merkle algorithm.

When using the PSK mode the user has a choice of five different block ciphers (XTEA, CAST-128, Blowfish, Camellia and Twofish) and a symmetric key with maximum length of 384-bit. People wanting to make an encrypted conferences using this mode must choose the same block cipher and the same common key. The typical procedure to use this mode is as follows:

  1. Choose PSK mode with /e
  2. Choose the encryption algorithm with /X
  3. Set the key with /x. Note that with this command the key is passed to Seren as a hexadecimal number. For example a 128-bit key can be represented by a 32-char hexadecimal number (a key composed of less than 32 characters will be padded with '0's)
  4. Use /c to join a conference or wait for other nodes to call you

Note that a 128-bit key could be created from a passphrase with the following command:

$ echo -n "put passphrase here" | md5sum | cut -b 1-32

Log and configuration files

Seren creates a log file in $HOME/.seren/seren.log , where it reports everything the program does. Inspecting this file can be useful in case you encounter any problem. In such situations, using -v -v on the command line to increase the verbosity level can also help understanding what went wrong.

Options for Seren can be specified on the command line or by using the configuration file in $HOME/.seren/seren.conf . Options specified on the command line take precedence over the ones in the configuration file.

Audio options

Seren uses alsa for audio capture and playback. You can specify the alsa device to use with -d option. Note that internally Seren uses the following format: 2 channels, 48000Hz sampling rate, s16_le format. If your sound card does not support this format you're likely to get an error when alsa is initialized. In this case try 'plughw:0,0' instead of the defaul device 'hw:0,0'.
Use the option -D to select a capture device different from the playback device. It should be possible to use pulseaudio with both options using the device 'pulse'.

To choose the initial bitrate of the compressed Opus stream, option -b can be used. The default is 16000 bit/s and should give very good quality with a typical bandwidth of 2 kbyte/s for each stream.
The complexity of the Opus encoder can be set via -C option.

Seren also supports audio input and output via a pair of fifos. Refer to the man page for more information about these fifos.

Calls recording

To start recording a call to a ogg/opus file you can use the /r command. A message containing the name of the file will be printed to inform you that the recording has been started, and the letters "REC" will appear in red on the bottom left corner of the window, next to the call timer. Type /r again to end the recording.
It is also possible to record in wave format using the /R command.

Raspberry Pi

Seren has been tested and works quite well on the Raspberry Pi, provided that you do the following things:

  1. Configure libopus with ./configure --enable-fixed-point to select the fixed-point implementation and enable the assembly optimizations.
  2. Launch Seren with command line option "-C 0" to select the lowest complexity for the Opus Encoder; this will make Seren run much faster.

Screenshots

Screenshots of Seren in action:

seren-dark-1


seren-clear-1


seren-dark-2

The values on the status bar on the bottom have the following meanings:

Download source code

The following versions of Seren are available for download. We recommend you to download the latest version.

WARNING: Please note that Seren is in active development and should be considered beta software. This means that new functions will be added and/or the protocol can change, thus backward compatibility is not guaranteed.

Download binary packages

The following binary packages are available for download. Please note that these packages are still experimental. If you find any problem/bug please let me know.

Download from repositories

Seren has been packaged for the following distributions:

Donations

If you like Seren and want to support its development you can use the following button to donate:

Contact

Development chat, testing and support happens on the #seren IRC channel on the FreeNode IRC network. You can join the chat room through the following web interface if you do not have a IRC client:

Changelog

version 0.0.21:

        * Engine version bump
        * Added --without-ncurses option to configure
        * Added VPATH build functionality
        * Added selftest targets to Makefile
        * Added input.{h,c} for unified command parsing
        * Added tones.{h,c}
        * Added /f command
        * Added twofish block cipher
        * Added support for round trip time (RTT) estimation
        * Added reason field to REFUSE packets
        * Added opus packets bandwidth and channels decoding
        * Added bw/ch informations to ncurses lateral bar
        * Use the same encipher/decipher functions for all key sizes in camellia
        * Renamed config file option theme to ncurses_theme
        * nc_init() now sets print and die callbacks
        * Fixed fifout delay (now the fifo is opened in WRONLY mode)
        * Fixed functions prototypes in random.{h,c}
        * Small code improvements and fixes

version 0.0.20:

	* Added /v command
	* Added event_type_verbose
	* Fixed buffer overflow in all ciphers when len is not a multiple of blocksize
	* Improved ciphers selftest routine
	* Factorized md5 code
	* Fixed potential buffer overflow in packet_encrypt()
	* Improved size check for received packets
	* Changed prefix for functions in udp.c
	* Other minor code changes

version 0.0.19:

	* Fixed terminal resizing, now the content of the window is not lost anymore
	* Added support for input history (Up/Down keys) in ncurses gui
	* Improved lateral bar with more information about nodes
	* Added fcntl.h and gmp.h checks in build system
	* Initial support for counter mode in xtea.{h,c}
	* Small code changes and refactoring

version 0.0.18:

	* New protocol, not compatible with older versions!
	* Support for node modes (clear, secure, psk)
	* Added raw audio input and output fifos
	* Added support for packet loss telemetry
	* Added cast-128 block cipher
	* Added blowfish block cipher
	* Added camellia block cipher
	* Added md5 hash function
	* Added random.{h,c}
	* Added libgmp dependency
	* Added Diffie–Hellman–Merkle key exchange
	* Factorized audio dsp code in adsp.{h,c}
	* Added support for node vu-meters
	* Improved checks for data coming from the network
	* Added /T, /H, /X commands
	* Changed /e command to set node mode
	* Changed /g command to accept gain in dB
	* Added event_type_ringtone, event_type_setmode, event_type_setalgo,
	  event_type_setpsk and event_type_call_hangup events
	* Fixed ncurses compilation in arch
	* Factorized nc_scroll_input_text()
	* Added support for nick autocomplete
	* Added node list and vu-meters column in ncurses gui
	* Added colored nick list based on local/remote packet losses
	* Added -Wconversion compiler flag
	* Fixed a lot of -Wconversion warnings
	* Updated man page

version 0.0.17:

	* Changed CALL and CONNECT packets format, protocol not compatible with older versions!
	* ncurses gui rewritten, now it supports UTF-8 input
	* Added --enable-default-pulse option to configure
	* Removed libncurses5-dev dependency, now only libncursesw5-dev is necessary
	* Fixed compilation with libopus < 1.0
	* Added event_type_autoaccept_calls and event_type_incoming_call_lost events
	* Updated man page
	* Fixed various messages
	* Added -L option for setting log filename
	* Added -N option for disabling ncurses gui
	* Fixed high cpu usage when stdin was redirected
	* Added /t, /C, /a commands

versions up to 0.0.16:

	* Lots of improvements/cleanups/refactoring/optimizations
	* Option to autocall host on startup
	* Option for setting encoder complexity 
	* Added man page
	* Support for ncurses themes
	* Support for packet loss concealment (PLC) 
	* Configuration file support
	* Call recording in ogg/opus or wave
	* Better/safer encrypted calls support
	* Option for auto answering calls
	* Individual nodes gain support
	* Synthesized ringtones
	* ITU-T E.180 calltone
	* Callers queue
	* STUN support
	* Commands and event-based system for the pc-engine
	* parole-conference-engine has been rewritten and separated from the gui
	* First internal release forked from parole-conference-010alpha17
			

Valid XHTML 1.0 Transitional

Copyright (C) 2013, 2014 Giorgio Vazzana