Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kipishio/d88000773915d3b23f6fb014b1199152 to your computer and use it in GitHub Desktop.
Save kipishio/d88000773915d3b23f6fb014b1199152 to your computer and use it in GitHub Desktop.

Tested 2024.07.28 Rasspberry Pi model 3B, Raspberry Pi OS (Legacy) Lite Release date: July 4th 2024, System: 32-bit Kernel version: 6.1 Debian version: 11 (bullseye)

All actions are performed from under root

sudo -i

Also works without token and entering the following command

TOKEN=Your TOKEN

Update system and install dependencies.

apt-get update && apt-get install -yq gnupg2 wget lsb-release libtool
apt install --yes git cmake autoconf automake unzip yasm libcurl4-openssl-dev pkg-config mc
apt install --yes libpcre3-dev libspeex-dev libspeexdsp-dev libldns-dev libedit-dev libjpeg9 libjpeg-dev libtiff-dev libopus-dev liblua5.2-0 liblua5.2-dev unixodbc-dev ntpdate libxml2-dev sngrep portaudio19-dev libtiff-dev python3.9-distutils libsqlite3-dev
apt install --yes libsndfile1-dev libavformat-dev libswscale-dev libavresample-dev libpq-dev libpq-dev libpq5

Installing required components and libraries

All components, incl. and FreeSWITCH download and install from the directory /usr/local/src/

Install Libks:

git clone https://github.com/signalwire/libks.git /usr/local/src/libks
cd /usr/local/src/libks
cmake .
make && sudo make install

Chek install libls:

ldconfig && ldconfig -p | grep libks

If libks is not installed, there will be no output. If it is installed, you will get a line for each version available.:

root@pi:/usr/local/src/libks# ldconfig && ldconfig -p | grep libks libks2.so.2 (libc6,hard-float) => /lib/libks2.so.2 libks2.so (libc6,hard-float) => /lib/libks2.so libksba.so.8 (libc6,hard-float) => /lib/arm-linux-gnueabihf/libksba.so.8 root@pi:/usr/local/src/libks#

Install signalwire

git clone https://github.com/signalwire/signalwire-c.git /usr/local/src/signalwire-c
cd /usr/local/src/signalwire-c
cmake .
make && make install

Chek install signalwire

ldconfig && ldconfig -p | grep signalwire

Install Sofia SIP

git clone https://github.com/freeswitch/sofia-sip /usr/local/src/sofia-sip
cd /usr/local/src/sofia-sip
 ./bootstrap.sh 
 ./configure
make &&  make install

verification:

ldconfig && ldconfig -p | grep signalwire

Install Spandsp

I have mistake, when I make FS according to the official instructions(mod_spandsp_dsp.c: In function 'get_v18_mode': mod_spandsp_dsp.c:159:10: error: 'V18_MODE_5BIT_4545' undeclared (first use in this function) 159 | int r = V18_MODE_5BIT_4545;), I make next steps:

git clone https://github.com/freeswitch/spandsp.git
cd spandsp/
git checkout 0d2e6ac
./bootstrap.sh
./configure
make && make install

verification:

ldconfig && ldconfig -p | grep spandsp

Install and build FreeSWITCH

Download FreeSWITCH 1.10.11 release in /usr/local/src directory and unpack

sudo wget -c https://files.freeswitch.org/releases/freeswitch/freeswitch-1.10.11.-release.tar.gz -P /usr/local/src
cd /usr/local/src
tar -zxvf freeswitch-1.10.11.-release.tar.gz
cd freeswitch-1.10.11.-release

Configure FreeSWITCH

./configure 

Installing FS.

make 
make install 
make cd-sounds-install
make cd-moh-install 

Post install setup

Further according to the standard instructions FS. Create Symlinks :

ln -s /usr/local/freeswitch/conf /etc/freeswitch 
ln -s /usr/local/freeswitch/bin/fs_cli /usr/bin/fs_cli 
ln -s /usr/local/freeswitch/bin/freeswitch /usr/sbin/freeswitch

Create a unprivileged system user for running FreeSWITCH daemon

groupadd freeswitch 
adduser --quiet --system --home /usr/local/freeswitch --gecos 'FreeSWITCH open source softswitch' --ingroup freeswitch freeswitch --disabled-password 
chown -R freeswitch:freeswitch /usr/local/freeswitch/ 
chmod -R ug=rwX,o= /usr/local/freeswitch/ 
chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/*

Running as systemd service

In order to run FreeSWITCH in background using systemctl, open /etc/systemd/system/freeswitch.service in your favorite editor.

nano /etc/systemd/system/freeswitch.service

copy following content into the file:

[Unit] 
Description=FreeSWITCH open source softswitch 
Wants=network-online.target Requires=network.target local-fs.target 
After=network.target network-online.target local-fs.target 

[Service] 
; service 
Type=forking 
PIDFile=/usr/local/freeswitch/run/freeswitch.pid 
Environment="DAEMON_OPTS=-nonat" 
Environment="USER=freeswitch" 
Environment="GROUP=freeswitch" 
EnvironmentFile=-/etc/default/freeswitch 
ExecStartPre=/bin/chown -R ${USER}:${GROUP} /usr/local/freeswitch 
ExecStart=/usr/local/freeswitch/bin/freeswitch -u ${USER} -g ${GROUP} -ncwait ${DAEMON_OPTS} 
TimeoutSec=45s 
Restart=always 

[Install] 
WantedBy=multi-user.target

Reload systemctl daemon,run and check status:

 systemctl daemon-reload
 systemctl start freeswitch
 systemctl status freeswitch

Enter FS CLI a Command-Line Interface

sudo fs_cli

Exit from command line: CTRL+D

Enable service FreeSWITCH in autorun

 systemctl enable freeswitch.service
@kipishio
Copy link
Author

kipishio commented Aug 7, 2024

1

@kipishio
Copy link
Author

kipishio commented Aug 7, 2024

Добавил в предустановку программу libtool для того что пакеты собирались без ошибок в которых есть макросы. Т.к. libtool отвечает за работу макросов.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment