BelledonneCommunications / flexisip

Linphone.org mirror for flexisip (git://git.linphone.org/flexisip.git)
http://flexisip.org
GNU Affero General Public License v3.0
140 stars 68 forks source link
linphone server sip voip

Flexisip

Flexisip is a comprehensive, modular and scalable SIP server suite written in C++17. It offers a wide range of functionalities, including:

Deployment and Applications:

License

Copyright © Belledonne Communications

Flexisip is dual licensed, and can be licensed and distributed:

Documentation

Dependencies

Dependency Description Mandatory Enabled by default
OpenSSL TLS stack. X
LibNgHttp2 HTTP2 stack. X
libsrtp2 Secure RTP (SRTP) and UST Reference Implementations X
SQLite3 Library for handling SQlite3 file X
libmysql-client Client library for MySQL database. X
Hiredis Redis DB client library, used for Registrar DB and communications between Flexisip instances of a same cluster. (-DENABLE_REDIS=YES) X
Protobuf Needed for migration from legacy registrar database format. (-DENABLE_PROTOBUF=YES) X
NetSNMP SNMP library, used for SNMP support. (-DENABME_SNMP=YES) X
XercesC XML parser. (-DENABLE_PRESENCE=YES) X
jsoncpp JSON parsing and writing (-DENABLE_B2BUA=YES) X

Compilation

Required build tools

Building Flexisip with CMake

Create a build directory and configure the project:

From cloned GIT repository

mkdir ./build
cmake -S . -B ./build
make -C ./build -j<njobs>

Custom

mkdir ./build
cmake -S . -B ./build -DFLEXISIP_VERSION=<version> -DLINPHONESDK_VERSION=<version>
make -C ./build -j<njobs>

Some tips

Check CMakeLists.txt to know the list of the available options and their default value. To change an option, you just need to invoke CMake again and specifying the option you need to change only. For instance, to disable the presence server feature:

cmake ./build -DENABLE_PRESENCE=OFF
make -C ./build -j<njobs>

You may also use ccmake or cmake-gui utilities to configure the project interactively:

ccmake ./build
make -C ./build -j<njobs>

Building RPM or DEB packages

This procedure will generate a unique RPM package containing Flexisip, all its dependencies and the corresponding package for debug symbols. The following options are relevant for packaging:

Option Description
CMAKE_INSTALL_PREFIX Prefix path where the package will install the files.
SYSCONF_INSTALL_DIR Directory where Flexisip expects to find its default configuration.
CMAKE_BUILD_TYPE Set it to “RelWithDebInfo” to have debug symbols in the debuginfo package.
CPACK_GENERATOR Package type: “RPM” or “DEB”.
cmake ./build -DCMAKE_INSTALL_PREFIX=/opt/belledonne-communications -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSYSCONF_INSTALL_DIR=/etc -DCPACK_GENERATOR=RPM
make -C ./build -j<njobs> package

Packages are now available in ./build directory.

Docker

A docker image can be built from sources using the following command:

docker build -t flexisip --build-arg='njobs=<njobs>' -f docker/flex-from-src .

Nix ❄️

Flexisip can also be compiled with Nix. From the root of the repository, you can obtain a development shell using:

nix-shell

Or with Flakes enabled:

nix develop

Nix makes it easier to have a reproducible development environment on any Linux distribution, and doesn't interfere with other installed tooling. It is just an additional, optional way to build flexisip.

Example build commands:

CC=gcc CXX=g++ BUILD_DIR_NAME="build" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -S . -B ./$BUILD_DIR_NAME -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="$PWD/$BUILD_DIR_NAME/install" -DENABLE_UNIT_TESTS=ON -DENABLE_STRICT_LINPHONESDK=OFF -DINTERNAL_JSONCPP=OFF
cd build
clear && cmake --build . --target install && LSAN_OPTIONS="suppressions=../sanitizer_ignore.txt" bin/flexisip_tester --resource-dir "../tester/" --verbose

Note to maintainers

At the exception to shell.nix, .nix files should live inside the nix/ folder.

All .nix files should be formatted with nixpkgs-fmt.

Configuration

Flexisip needs a configuration file to run correctly. Use ./flexisip --dump-all-default > flexisip.conf to generate a documented default configuration file.

Developer notes

With sofia-sip, you have the choice between msg_dup() and msg_copy(), sip_from_dup() and sip_from_copy(), etc. The difference isn't well documented in sofia-sip documentation, but it is important to understand that:

Your build is broken, but you don't see how that's your fault? (E.g. trying to compile a file you removed, and you've double-checked it is not referenced anywhere in the source code anymore) Try reconfiguring and regenerating. (With e.g. ccmake)