Skip to content

DuckyMomo20012/docker-flexisip

Repository files navigation

Flexisip server with flexisip-account-manager on ubuntu 23.10 by docker compose file

Table of contents

Introduction

This repository is a forked version of the original repository: https://github.com/capitalfuse/docker-flexisip, which is updated with required configurations so you can test on ubuntu 23.10.

Support features:

  • Flexisip proxy server.
    • Flexisip proxy server authentication.
    • Flexisip proxy server TLS.
  • Flexisip account manager.
    • Flexisip account manager TLS (Check here).
  • phpMyAdmin web interface.
  • Flexisip conference server.
  • Flexisip presence server.

schema

Prerequisites

Specifications

This project is tested on the following specifications:

  • OS: Ubuntu 23.10.
  • Docker: 26.0.0.
  • flexisip (GitHub): 8501f5b (build Docker image).

Build flexisip docker image from source code

We will build the flexisip docker image from the source code using the file flexisip/docker/flex-from-src.

  1. Clone the flexisip source code from the git repository.

Important

You have to clone the repository "recursive" to get the submodules.

  • From Github:

    git clone https://github.com/BelledonneCommunications/flexisip.git --recursive
  • From Gitlab:

    git clone https://gitlab.linphone.org/BC/public/flexisip.git --recursive

Note

The clone process may take sometimes depending on your internet speed.

  1. Update the Dockerfile:
  • Add the following lines to the file flexisip/docker/flex-from-src:

    # flexisip/docker/flex-from-src
    
    ...
    # Get source code
    COPY --chown=bc:bc . flexisip/
    +
    + RUN cd flexisip && ./docker/cmake_install.sh 3.22.6
    +
    # Configure & build
    RUN cd flexisip \
        && rm -rf work && mkdir work \
        && cmake -S . -B work -G Ninja -DCMAKE_BUILD_TYPE=${build_type} -DENABLE_SANITIZERS=${sanitizer} -DCMAKE_INSTALL_PREFIX=/opt/belledonne-communications -DSYSCONF_INSTALL_DIR=/etc \
        && cmake --build work \
        && sudo cmake --build work --target install
    ...

    This will update the cmake version to 3.22.6 to pass the cmake version requirements defined in the flexisip/CMakeLists.txt file.

  1. Build the flexisip docker image:
docker build -t flexisip --build-arg='njobs=<njobs>' -f docker/flex-from-src .

Setup and configurations

Setup flexisip-account-manager repository

  1. Clone the flexisip-account-manager repository from the git repository.
  • From Github:

    git clone https://github.com/BelledonneCommunications/flexisip-account-manager.git
  • From Gitlab:

    git clone https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
  1. Move to the ubuntu23-10 directory:
mv flexisip-account-manager ./ubuntu23-10/
  1. Change file permissions:
cd ubuntu23-10/flexisip-account-manager/flexiapi

sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache

Configuration files

Base configuration files

The following configuration files are required to run the docker-compose file:

Update base ip address

By default, all the configuration files are configured with the IP address 192.168.1.17, with subdomains. You have to update the IP address to your own IP address manually in the following files:

Or you can use the perl command to update the IP address with your own IP address (recommended):

cd ubuntu23-10

REPLACE_IP="192.168.1.127"
LOCAL_IP="192.168.1.17"

perl -i -pe 's/'"$LOCAL_IP"'/'"$REPLACE_IP"'/g' ./.env.flexiapi ./flexisip_conf/flexisip.conf

Or you can use the perl command to update the IP address with your own IP address and remove the subdomains:

cd ubuntu23-10

REPLACE_IP="192.168.1.127"
LOCAL_IP="192.168.1.17"

perl -i -pe 's/(?<=[=\"])(\w*\.)?'"$LOCAL_IP"'\.nip\.io/'"$REPLACE_IP"'/g' ./.env.flexiapi ./flexisip_conf/flexisip.conf

Reference configuration files

Get the default flexisip.conf configuration file

To get the default flexisip.conf config file, you can run the following command:

docker exec ubuntu-flexisip flexisip --dump-all-default > flexisip.conf

Deploy the services

Run docker compose file

Note

If you are using different flexisip image, you have to update the image name for ubuntu-flexisip service in the docker-compose.yml file.

  1. Move to the ubuntu23-10 directory:
cd ubuntu23-10
  1. Run the docker-compose file:
docker-compose up

Setup the Flexisip Account Manager server

  1. Enter the flexisip-account-manager container:
docker exec -it php-fpm-laravel /bin/bash
  1. Run the following commands to setup the flexisip-account-manager server:
cd flexiapi

composer install

php artisan key:generate

php artisan migrate
  1. (Optional): Serve the flexisip-account-manager server directly:

Note

Please make sure to finish step 2 before running the following commands.

docker exec -it php-fpm-laravel /bin/bash

php artisan serve --host=0.0.0.0

Then you can access the flexisip-account-manager server routes using the URL:

http://localhost:8000

# or

http://localhost:8000/documentation

# or

http://localhost:8000/api

Check service ports

After running the docker-compose file, you can check the service ports using the following command:

docker ps

You will get the following output:

CONTAINER ID   IMAGE                              COMMAND                  CREATED         STATUS         PORTS                                                                      NAMES
c36887f00b26   flexisip                           "/flexisip-entrypoin…"   2 minutes ago   Up 2 minutes   0.0.0.0:5060-5061->5060-5061/tcp, :::5060-5061->5060-5061/tcp              ubuntu-flexisip
dfb4f558e7d3   nginx:alpine                       "/docker-entrypoint.…"   9 hours ago     Up 2 minutes   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   nginx
b533a69ea894   phpmyadmin/phpmyadmin:fpm-alpine   "/docker-entrypoint.…"   34 hours ago    Up 2 minutes   9000/tcp                                                                   phpmyadmin-fpm
9d285f04e50c   ubuntu23-10-php-fpm-laravel        "docker-php-entrypoi…"   34 hours ago    Up 2 minutes   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 9000/tcp                        php-fpm-laravel
2421c502e2ea   redis:alpine                       "docker-entrypoint.s…"   34 hours ago    Up 2 minutes   0.0.0.0:6379->6379/tcp, :::6379->6379/tcp                                  redis
8cd52def74d5   mariadb                            "docker-entrypoint.s…"   34 hours ago    Up 2 minutes   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp                                  flexisip-mariadb

Since the network_mode is not compatible with other OS, it's changed to expose the ports to the host machine.

Note

Remove the network_mode: "host" means you can't access the flexisip server from the host machine, so you no longer can use wireshark to capture the SIP packets.

Debug when using network_mode: "host"

For the ubuntu-flexisip container, it configured with network_mode: "host", it's running in the host network, so you can't see the ports in the docker ps command.

As the flexisip server should be listen on the port 5060, you can check the port using the following command:

sudo netstat -ntlp | grep LISTEN | grep flexisip

You will get the following output:

tcp        0      0 127.0.0.1:5060          0.0.0.0:*               LISTEN      61046/flexisip
tcp        0      0 172.17.0.1:5060         0.0.0.0:*               LISTEN      61046/flexisip
tcp        0      0 172.18.0.1:5060         0.0.0.0:*               LISTEN      61046/flexisip
tcp        0      0 192.168.1.17:5060       0.0.0.0:*               LISTEN      61046/flexisip
tcp6       0      0 2402:800:631d:23a9:5060 :::*                    LISTEN      61046/flexisip
tcp6       0      0 ::1:5060                :::*                    LISTEN      61046/flexisip
tcp6       0      0 2402:800:631d:23a9:5060 :::*                    LISTEN      61046/flexisip

Important

The flexisip server is listening on the port 5060, but it won't receive any REGISTER requests from these domains, only if you configure the reg-domains in file ubuntu23-10/flexisip_conf/flexisip.conf.

However, we still can register with localhost, which is the default value of reg-domains.

Access services

Access phpMyAdmin

You can access the phpMyAdmin using the following URL:

http://localhost/phpmyadmin

With the credentials defined for MariaDB in the docker-compose.yml file:

  • Root user:

    • Username: root.
    • Password: mysql.
  • Normal user:

    • Username: mysql.
    • Password: mysql.

Access the Flexisip Account Manager

You can access the Flexisip Account Manager using the following URL:

  • API documentation:

    http://account.<YOUR-LOCAL-IP>.nip.io/api
  • Swagger documentation:

    http://account.<YOUR-LOCAL-IP>.nip.io/documentation
  • Login page:

    http://account.<YOUR-LOCAL-IP>.nip.io/login
  • Register page:

    http://account.<YOUR-LOCAL-IP>.nip.io/register

Access the MariaDB database

You can access the MariaDB database using Dbeaver, with phpMyAdmin as mentioned above, or any other database client tool with these credentials:

  • Host: localhost.

  • Port: 3306.

  • Root user:

    • Username: root.
    • Password: mysql.
  • Normal user:

    • Username: mysql.
    • Password: mysql.

Other documentations

FAQ

  • I can't register my account with softphone clients

    • Wrong password.

    • Check the email domain registered from the flexisip-account-manager server whether it is included in BOTH reg-domains and auth-domains in file ubuntu23-10/flexisip_conf/flexisip.conf.

    • Softphone client doesn't support hash algorithm configured in the flexisip.conf file. If you want the flexisip server to be compatible with most of the softphone clients, you can switch the available-algorithms to MD5 in env.flexiapi. Also, you have to update the algorithm in the flexisip.conf server.

Caution

Changing the hash algorithm will make the user no longer access to their account.

  • I can't access the account manager web page

  • I can't build the flexisip docker image

    • Make sure you cloned the flexisip source code with the submodules (recursive).

    • Make sure you have followed the steps in the Build flexisip docker image from source code section.

    • Check the cmake version in the flexisip/CMakeLists.txt file. If it is higher than the version defined in the flexisip/docker/flex-from-src file, you have to update the cmake version in the flexisip/docker/flex-from-src file.

    • Try to clone the flexisip source code that matches the flexisip version mentioned in the Prerequisites section.

  • On MacOS, I can't register my account with the softphone client

    • You have to use TCP as the transport protocol, because the UDP is not working properly. But on Linux, you can use UDP without any issues.

About

Dockerfile for flexisip sip server on Ubuntu 23.10

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published