Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cyrenity/96cc1ad7979b719b1c684f90aa0f526d to your computer and use it in GitHub Desktop.
Save cyrenity/96cc1ad7979b719b1c684f90aa0f526d to your computer and use it in GitHub Desktop.
Install FreeSWITCH 1.10.x on Ubuntu 18.04 | 20.04 | 22.04 LTS

Installing FreeSWITCH 1.10.X on Ubuntu 18.04 | 20.04 | 22.04 LTS

Introduction

FreeSWITCH is a software defined telecom stack that runs on any commodity hardware. FreeSWITCH can handle voice, video and text communication and support all popullar VoIP protocols. FreeSWITCH is flexible and modular, and can be used in any way you can imagine

This guide demonstrates how to get it install FreeSWITCH and get it up and running on a Ubuntu 20.04 LTS machine

Prerequisites

To follow along with this guide, you need one Ubuntu 20.04 LTS server which has prerequisite packages installed and configured. In order to install required packages issue following command

Ubuntu 18.04 LTS
$ sudo apt install --yes build-essential pkg-config uuid-dev zlib1g-dev libjpeg-dev libsqlite3-dev libcurl4-openssl-dev \
            libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev libtiff5-dev yasm libopus-dev libsndfile1-dev unzip \
            libavformat-dev libswscale-dev libavresample-dev liblua5.2-dev liblua5.2 cmake libpq-dev \
            unixodbc-dev autoconf automake ntpdate libxml2-dev libpq-dev libpq5 sngrep
Ubuntu 20.04 LTS
$ sudo apt install --yes build-essential pkg-config uuid-dev zlib1g-dev libjpeg-dev libsqlite3-dev libcurl4-openssl-dev \
            libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev libtiff5-dev yasm libopus-dev libsndfile1-dev unzip \
            libavformat-dev libswscale-dev libavresample-dev liblua5.2-dev liblua5.2-0 cmake libpq-dev \
            unixodbc-dev autoconf automake ntpdate libxml2-dev libpq-dev libpq5 sngrep
Ubuntu 22.04 LTS
sudo apt install --yes build-essential pkg-config uuid-dev zlib1g-dev libjpeg-dev libsqlite3-dev libcurl4-openssl-dev \
            libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev libtiff5-dev yasm libopus-dev libsndfile1-dev unzip \
            libavformat-dev libswscale-dev liblua5.2-dev liblua5.2-0 cmake libpq-dev \
            unixodbc-dev autoconf automake ntpdate libxml2-dev libpq-dev libpq5 sngrep

Install pre-requisites and libraries

In order to install libks First, download latest code from github using following command

$ sudo git clone https://github.com/signalwire/libks.git /usr/local/src/libks

Now run following commands in sequence to install the library

$ cd /usr/local/src/libks
$ sudo cmake .
$ sudo make && sudo make install

To verify if libks is installed correctly in your system, run following command

$ sudo sh -c 'ldconfig && ldconfig -p' | grep libks

In Order to install libsignalwire Run following command to download latest code from github

$ sudo git clone https://github.com/signalwire/signalwire-c.git /usr/local/src/signalwire-c

Now run following commands in sequence to install the library

$ cd /usr/local/src/signalwire-c
$ sudo cmake .
$ sudo make && sudo make install

To verify if libsignalwire-client is installed correctly in your system, run following command

$ sudo sh -c 'ldconfig && ldconfig -p' | grep signalwire

Starting from FreeSWITCH version 1.10.4 You have to Download, Compile and install sofia-sip and spandsp libraries separately

In order to install Sofia-Sip library, you need to download the latest code from FreeSWITCH’s official Packages repository

Installing Sofia-Sip library

Clone the official Sofia-Sip repository into /usr/local/src directory

$ sudo git clone https://github.com/freeswitch/sofia-sip /usr/local/src/sofia-sip

Now run following commands in sequence to install the library

$ cd /usr/local/src/sofia-sip
$ sudo ./bootstrap.sh 
$ sudo ./configure
$ sudo make && sudo make install

To verify if Sofia-Sip library is installed correctly in your system, run following command

$ sudo sh -c 'ldconfig && ldconfig -p' | grep sofia

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

Installing SpanDSP library

Clone the SpanDSP repository from FreeSWITCH packages repository into /usr/local/src directory

$ sudo git clone https://github.com/freeswitch/spandsp /usr/local/src/spandsp

Now run following commands in sequence to install the library

$ cd /usr/local/src/spandsp
$ sudo ./bootstrap.sh 
$ sudo ./configure
$ sudo make && sudo make install

To verify if SpanDSP library is installed correctly in your system, run following command

$ sudo sh -c 'ldconfig && ldconfig -p' | grep spandsp

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

You are now ready to install FreeSWITCH

Installing FreeSWITCH

Download the FreeSWITCH 1.10.7 release file into /usr/local/src directory

$ sudo wget -c https://files.freeswitch.org/releases/freeswitch/freeswitch-1.10.7.-release.tar.gz -P /usr/local/src 

Extract the release file

$ cd /usr/local/src
$ sudo tar -zxvf freeswitch-1.10.7.-release.tar.gz
$ cd freeswitch-1.10.7.-release

Run the configure script

$ sudo ./configure 

Note: FreeSWITCH uses SQLite by default for it’s core database although support for other database options Like PostgreSQL, ODBC exists. If you want to enable Postgres or ODBC support than you need to run the ./configure script with following arguments

$ sudo ./configure --enable-core-odbc-support --enable-core-pgsql-support 

Now you are ready to compile and install the FreeSWITCH, run following commands in sequence

$ sudo make 
$ sudo make install 

To install sound and music on hold run following command

$ sudo make cd-sounds-install
$ sudo make cd-moh-install 

FreeSWITCH is now installed and you can confirm it by running sudo freeswitch -nonat from your terminal

Post install setup

Create Symlinks (Optional)

By default, FreeSWITCH will install it’s binaries and configurations in /usr/local/bin and /usr/local/freeswitch, to make them available system wide you can create following symlinks

$ sudo ln -s /usr/local/freeswitch/conf /etc/freeswitch 
$ sudo ln -s /usr/local/freeswitch/bin/fs_cli /usr/bin/fs_cli 
$ sudo ln -s /usr/local/freeswitch/bin/freeswitch /usr/sbin/freeswitch
Create an unprivileged user

Create a unprivileged system user for running FreeSWITCH daemon

$ sudo groupadd freeswitch 
$ sudo adduser --quiet --system --home /usr/local/freeswitch --gecos 'FreeSWITCH open source softswitch' --ingroup freeswitch freeswitch --disabled-password 
$ sudo chown -R freeswitch:freeswitch /usr/local/freeswitch/ 
$ sudo chmod -R ug=rwX,o= /usr/local/freeswitch/ 
$ sudo 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 and copy following content into it

[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 the systemctl daemon

$ sudo systemctl daemon-reload

Start the FreeSWITCH Service

$ sudo systemctl start freeswitch

Check if daemon has start successfully

$ sudo systemctl status freeswitch
Command Line interface

The fs_cli program is a Command-Line Interface that allows a user to connect to a running FreeSWITCH™ instance. The fs_cli program can connect to the FreeSWITCH™ process on the local machine or on a remote system. (Network connectivity to the remote system is, of course, required.)

@sahil-siwatch
Copy link

Sure, carefully issue commands on the terminal and look for expected output before moving on to next instruction or command

On Fri, Oct 15, 2021 at 9:00 PM sahil-siwatch @.> wrote: @.* commented on this gist. ------------------------------ [image: image] https://user-images.githubusercontent.com/53403558/137517451-ed49d762-2460-4ab2-880b-a3949a2e528d.png I recompiled, same error. can i remove it completely and reinstall it again ?? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://gist.github.com/96cc1ad7979b719b1c684f90aa0f526d#gistcomment-3928459, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3FKKKOGPJFFJIAGKBIETTUHBFZ5ANCNFSM42S5QE6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

I am new to freeswitch. their website suggests that we use we use debian buster 10 for freeswitch. Do you think Ubuntu 18 can cause problem ?? Have you personally used freeswitch on UBUNTU 18 or 20 ? I am also trying to install on UBUNTU 20 and debian buster(too many issues here. so much confusion. if there is any good tutorial like this one, it will be great. ) Do you have any resources from where I can kickstart freeswitch ?

@cyrenity
Copy link
Author

cyrenity commented Oct 16, 2021 via email

@cyrenity
Copy link
Author

My bad, I forgot to add steps for installing mod_signalwire, I ll update the document soon

@sahil-siwatch
Copy link

I have been using Ubuntu for production FreeSWITCH deployments for past 10 years and have not faced any issues On Sat, Oct 16, 2021 at 11:58 PM sahil-siwatch @.> wrote:

@.
* commented on this gist. ------------------------------ Sure, carefully issue commands on the terminal and look for expected output before moving on to next instruction or command … <#m_2926732453397098612_> On Fri, Oct 15, 2021 at 9:00 PM sahil-siwatch @.*> wrote: @.** commented on this gist. ------------------------------ [image: image] https://user-images.githubusercontent.com/53403558/137517451-ed49d762-2460-4ab2-880b-a3949a2e528d.png I recompiled, same error. can i remove it completely and reinstall it again ?? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://gist.github.com/96cc1ad7979b719b1c684f90aa0f526d#gistcomment-3928459, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3FKKKOGPJFFJIAGKBIETTUHBFZ5ANCNFSM42S5QE6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . I am new to freeswitch. their website suggests that we use we use debian buster 10 for freeswitch. Do you think Ubuntu 18 can cause problem ?? Have you personally used freeswitch on UBUNTU 18 or 20 ? I am also trying to install on UBUNTU 20 and debian buster(too many issues here. so much confusion. if there is any good tutorial like this one, it will be great. ) Do you have any resources from where I can kickstart freeswitch ? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://gist.github.com/96cc1ad7979b719b1c684f90aa0f526d#gistcomment-3929449, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3FKKNADX6R5FQAR3WCUY3UHHDPBANCNFSM42S5QE6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

That's great to know. :) I am getting the error for spandsp with ubuntu 20. following the same steps to fix it that I used with ubuntu 18. Anything that I can do to fix it ?

@sahil-siwatch
Copy link

To my surprise, simply running sudo apt-get install libspandsp-dev works as well. Freeswitch is starting. I am yet to test it's functionality though. Service is starting.

@bluepoet2k
Copy link

I am having a problem getting the service to work. Did all the commands you mentioned above, no errors, everything appears to have gone in with no issues but when I try to run the start command it comes back and says it exited with an error code.

sudo systemctl start freeswitch
Job for freeswitch.service failed because the control process exited with error code.
See "systemctl status freeswitch.service" and "journalctl -xe" for details.

I then ran the status command and it says the following:
sudo systemctl status freeswitch.service
● freeswitch.service - FreeSWITCH open source softswitch
Loaded: loaded (/etc/systemd/system/freeswitch.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-02-23 19:15:40 UTC; 18s ago
Process: 122330 ExecStartPre=/bin/chown -R ${USER}:${GROUP} /usr/local/freeswitch (code=exited, status=0/SUCCESS)
Process: 122331 ExecStart=/usr/local/freeswitch/bin/freeswitch -u ${USER} -g ${GROUP} -ncwait ${DAEMON_OPTS} (code=exited, status=1/FAILURE)

Feb 23 19:15:40 freeswitch systemd[1]: freeswitch.service: Scheduled restart job, restart counter is at 5.
Feb 23 19:15:40 freeswitch systemd[1]: Stopped FreeSWITCH open source softswitch.
Feb 23 19:15:40 freeswitch systemd[1]: freeswitch.service: Start request repeated too quickly.
Feb 23 19:15:40 freeswitch systemd[1]: freeswitch.service: Failed with result 'exit-code'.
Feb 23 19:15:40 freeswitch systemd[1]: Failed to start FreeSWITCH open source softswitch.

I then ran the journal command and go the following:
A stop job for unit freeswitch.service has finished.

-- The job identifier is 8694 and the job result is done.
Feb 23 19:23:48 freeswitch systemd[1]: Starting FreeSWITCH open source softswitch...
-- Subject: A start job for unit freeswitch.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- A start job for unit freeswitch.service has begun execution.

-- The job identifier is 8694.
Feb 23 19:23:48 freeswitch freeswitch[122518]: Unknown option '-nonat -ncwait -u www-data -g www-data -run /var/run/freeswitch', see '/usr/local/freeswitch/bi>
Feb 23 19:23:48 freeswitch systemd[1]: freeswitch.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- An ExecStart= process belonging to unit freeswitch.service has exited.

-- The process' exit code is 'exited' and its exit status is 1.
Feb 23 19:23:48 freeswitch systemd[1]: freeswitch.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- The unit freeswitch.service has entered the 'failed' state with result 'exit-code'.
Feb 23 19:23:48 freeswitch systemd[1]: Failed to start FreeSWITCH open source softswitch.
-- Subject: A start job for unit freeswitch.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- A start job for unit freeswitch.service has finished with a failure.

-- The job identifier is 8694 and the job result is failed.
Feb 23 19:23:49 freeswitch systemd[1]: freeswitch.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- Automatic restarting of the unit freeswitch.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Feb 23 19:23:49 freeswitch systemd[1]: Stopped FreeSWITCH open source softswitch.
-- Subject: A stop job for unit freeswitch.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- A stop job for unit freeswitch.service has finished.

-- The job identifier is 8776 and the job result is done.
Feb 23 19:23:49 freeswitch systemd[1]: freeswitch.service: Start request repeated too quickly.
Feb 23 19:23:49 freeswitch systemd[1]: freeswitch.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- The unit freeswitch.service has entered the 'failed' state with result 'exit-code'.
Feb 23 19:23:49 freeswitch systemd[1]: Failed to start FreeSWITCH open source softswitch.
-- Subject: A start job for unit freeswitch.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- A start job for unit freeswitch.service has finished with a failure.

-- The job identifier is 8776 and the job result is failed.
Feb 23 19:23:57 freeswitch sudo[122519]: ap : TTY=pts/2 ; PWD=/usr/local ; USER=root ; COMMAND=/usr/bin/journalctl -xe
Feb 23 19:23:57 freeswitch sudo[122519]: pam_unix(sudo:session): session opened for user root by ap(uid=0)

ap@freeswitch:/usr/local$

ap@freeswitch:/usr/local$ sudo journalctl -xe
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- A start job for unit freeswitch.service has begun execution.

-- The job identifier is 8694.
Feb 23 19:23:48 freeswitch freeswitch[122518]: Unknown option '-nonat -ncwait -u www-data -g www-data -run /var/run/freeswitch', see '/usr/local/freeswitch/bi>
Feb 23 19:23:48 freeswitch systemd[1]: freeswitch.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- An ExecStart= process belonging to unit freeswitch.service has exited.

-- The process' exit code is 'exited' and its exit status is 1.
Feb 23 19:23:48 freeswitch systemd[1]: freeswitch.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- The unit freeswitch.service has entered the 'failed' state with result 'exit-code'.
Feb 23 19:23:48 freeswitch systemd[1]: Failed to start FreeSWITCH open source softswitch.
-- Subject: A start job for unit freeswitch.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- A start job for unit freeswitch.service has finished with a failure.

-- The job identifier is 8694 and the job result is failed.
Feb 23 19:23:49 freeswitch systemd[1]: freeswitch.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- Automatic restarting of the unit freeswitch.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Feb 23 19:23:49 freeswitch systemd[1]: Stopped FreeSWITCH open source softswitch.
-- Subject: A stop job for unit freeswitch.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- A stop job for unit freeswitch.service has finished.

-- The job identifier is 8776 and the job result is done.
Feb 23 19:23:49 freeswitch systemd[1]: freeswitch.service: Start request repeated too quickly.
Feb 23 19:23:49 freeswitch systemd[1]: freeswitch.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- The unit freeswitch.service has entered the 'failed' state with result 'exit-code'.
Feb 23 19:23:49 freeswitch systemd[1]: Failed to start FreeSWITCH open source softswitch.
-- Subject: A start job for unit freeswitch.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support

-- A start job for unit freeswitch.service has finished with a failure.

-- The job identifier is 8776 and the job result is failed.


Any suggestions as to what I should try next would be greatly appreciated. Thanks.

@cyrenity
Copy link
Author

instead of systemd, just run freeswitch -nonat from your console to quickly launch the freeswitch process, it will through the actual error

@cyrenity
Copy link
Author

Please verify your freeswitch.service file and make sure you have copied it right

@bluepoet2k
Copy link

did the command you suggest and got the following error back
freeswitch -nonat
ERROR: Failed to set SCHED_FIFO scheduler (Operation not permitted)
ERROR: Could not set nice level
Cannot open pid file /var/run/freeswitch/freeswitch.pid.

The freeswitch service file is the exact as what you gave above.
[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

I did a search for that PID file and I do not see it anywhere? So not sure what that file is or how do I create it.

@bluepoet2k
Copy link

So I did some more digging - found the PID file, set permissions to that folder. I also found another article that talked about setting kernel limits so I did that as well and now when I run the freeswitch -nonat command - it brings up a bunch of stuff but mainly it says that it could not listen on port 0.0.0.0 so guessing there is a config file messed up somewhere.

@bluepoet2k
Copy link

Well I rebooted the server and now I have the same issue again.

@cyrenity
Copy link
Author

Try running the freeswitch -nonat command as root user

@bluepoet2k
Copy link

I fixed an issue with the event socket conf file so that clear the 0.0.0.0 errors that we are having. I ran the freeswitch -nonat with the root user command and it comes up with no issues. So now just have to figure out why the freeswitch user is not working to load the service. I wish I had more experience in all of this and I appreciate your guidance in this.

@cyrenity
Copy link
Author

from your journalctl log i see this line ->

Feb 23 19:23:48 freeswitch freeswitch[122518]: Unknown option '-nonat -ncwait -u www-data -g www-data -run /var/run/freeswitch', see '/usr/local/freeswitch/bi>

If you are using www-data user than make sure you have also created a system user with same name

@bluepoet2k
Copy link

Maybe I have that in another config file as well. Or should that all be from the freeswitch.service file?

@cyrenity
Copy link
Author

This should not be the case, there is only one /etc/systemd/system/freeswitch.service file

@bluepoet2k
Copy link

Guess I will need to figure out then how to make a user with the right permissions or find out where it is getting the www-data name at. Thank you.

@bluepoet2k
Copy link

Okay - I got it to work I think - I went into the freeswitch.service file - took out the environment options and hard entered the information. Re-ran everything and it went with no issues.

I basically ran it like this ExecStart=/usr/local/freeswitch/bin/freeswitch -u freeswitch -g freeswitch -ncwait -nonat

Dunno why that worked but it did.

@bluepoet2k
Copy link

bluepoet2k commented Feb 23, 2022 via email

@cyrenity
Copy link
Author

for fusionpbx you really don't need to manually install FreeSWITCH, just run the fusion PBX installation script and it will take care of the FreeSWITCH installation

@bluepoet2k
Copy link

I realized that this morning and have things up and running. The last hurdle now is to see if the Avaya 9611G phones we acquired will provision in fusions. I do appreciate all your help.

@sahil-ecosmob
Copy link

Hello. I am installing freeswitch in ubuntu 20.04 LTS. Make and make install ran successfully. but when starting Freeswitch, I get this error.
/freeswitch: error while loading shared libraries: libsofia-sip-ua.so.0: cannot open shared object file: No such file or directory

@cyrenity
Copy link
Author

You need to make sure Sofia is installed successfully

@jeremy-immersitech
Copy link

@sahil-ecosmob You may need to run ldconfig by itself after installing sofia. That worked for me.

@victor-shelepen
Copy link

During signalwire-c installation I receive the following error:

[ 47%] Building C object CMakeFiles/signalwire_client.dir/src/transport/websocket.c.o
/usr/local/src/signalwire-c/src/transport/websocket.c: In function ‘__connect_socket’:
/usr/local/src/signalwire-c/src/transport/websocket.c:308:36: warning: ‘:swclt’ directive output may be truncated writing 6 bytes into a region of size between 0 and 254 [-Wformat-truncation=]
  308 |  snprintf(buf, sizeof(buf), "/%s:%s:swclt", ctx->info.path, ctx->info.address);
      |                                    ^~~~~~
/usr/local/src/signalwire-c/src/transport/websocket.c:308:2: note: ‘snprintf’ output between 9 and 263 bytes into a destination of size 256
  308 |  snprintf(buf, sizeof(buf), "/%s:%s:swclt", ctx->info.path, ctx->info.address);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 50%] Linking C shared library libsignalwire_client.so
[ 50%] Built target signalwire_client
Scanning dependencies of target swclt_bench
[ 52%] Building C object swclt_bench/CMakeFiles/swclt_bench.dir/main.c.o
[ 55%] Linking C executable swclt_bench
[ 55%] Built target swclt_bench
[ 57%] Generating C unity source swclt_test/cotire/swclt_test_C_unity.c
[ 60%] Generating C prefix source swclt_test/cotire/swclt_test_C_prefix.c
[ 63%] Generating C prefix header swclt_test/cotire/swclt_test_C_prefix.h
[ 65%] Building C precompiled header swclt_test/cotire/swclt_test_C_prefix.h.gch
Scanning dependencies of target swclt_test
[ 68%] Building C object swclt_test/CMakeFiles/swclt_test.dir/cases/callback.c.o
[ 71%] Building C object swclt_test/CMakeFiles/swclt_test.dir/cases/command.c.o

I've created an issue here.

@hrg92
Copy link

hrg92 commented Jan 20, 2023

Hello

When I start the service it gives me the following error.

image

I share the file freeswitch.service

image

What could cause the problem?

Thanks

@rolandwu777
Copy link

rolandwu777 commented Feb 5, 2023

@cyrenity, in your steps, there is a typo [signwalwire-c]
"sudo git clone https://github.com/signalwire/signalwire-c.git /usr/local/src/signwalwire-c"

Thanks!

@dinesh1310
Copy link

image

facing this issue while configuring freeswitch from openssl v 1.1.1 to v 3.0.8.. error while runing ./configure file

@rlorenz2417
Copy link

I'm running into these errors:

make[1]: Entering directory '/usr/local/src/freeswitch-1.10.7.-release'
CC src/libfreeswitch_la-switch_apr.lo
src/switch_apr.c: In function ‘switch_md5’:
src/switch_apr.c:1176:9: error: ‘MD5_Init’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
1176 | MD5_Init(&md5_context);
| ^~~~~~~~
In file included from src/switch_apr.c:79:
/usr/include/openssl/md5.h:49:27: note: declared here
49 | OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
| ^~~~~~~~
src/switch_apr.c:1177:9: error: ‘MD5_Update’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
1177 | MD5_Update(&md5_context, input, inputLen);
| ^~~~~~~~~~
In file included from src/switch_apr.c:79:
/usr/include/openssl/md5.h:50:27: note: declared here
50 | OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
| ^~~~~~~~~~
src/switch_apr.c:1178:9: error: ‘MD5_Final’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
1178 | MD5_Final(digest, &md5_context);
| ^~~~~~~~~
In file included from src/switch_apr.c:79:
/usr/include/openssl/md5.h:51:27: note: declared here
51 | OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
| ^~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2153: src/libfreeswitch_la-switch_apr.lo] Error 1
make[1]: Leaving directory '/usr/local/src/freeswitch-1.10.7.-release'
make: *** [Makefile:1292: all] Error 2

@cyrenity
Copy link
Author

cyrenity commented Jun 28, 2023 via email

@anmol1991
Copy link

mod_spandsp_dsp.c:159:10: error: ‘V18_MODE_5BIT_4545’ undeclared (first use in this function)
159 | int r = V18_MODE_5BIT_4545;
| ^~~~~~~~~~~~~~~~~~
mod_spandsp_dsp.c:159:10: note: each undeclared identifier is reported only once for each function it appears in
mod_spandsp_dsp.c:165:8: error: ‘V18_MODE_5BIT_50’ undeclared (first use in this function)
165 | r = V18_MODE_5BIT_50;
| ^~~~~~~~~~~~~~~~
mod_spandsp_dsp.c: In function ‘spandsp_tdd_send_session’:
mod_spandsp_dsp.c:216:14: error: too few arguments to function ‘v18_init’
216 | tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL);

I am getting this error, while building freeswitch-1.10.07 on U20.04 machine.

@aeschimannr
Copy link

Hello, i get the same error than @anmol1991 when make mod_spandsp.

@zhongcy
Copy link

zhongcy commented Jul 12, 2023

@anmol1991 @aeschimannr

git reset --hard 0d2e6ac65e0e8f53d652665a743015a88bf048d4

and remake

@cyrenity
Copy link
Author

Hello, i get the same error than @anmol1991 when make mod_spandsp.

which os and version you are installing on?

@aeschimannr
Copy link

aeschimannr commented Jul 13, 2023

i'm compiling on raspberry Pi OS Lite Debian Bullseye release 2023-05-03.
and with the freeswitch release v1.10.9

@aeschimannr
Copy link

I resolve the error with the following procedure
rm -rf spandsp
git clone https://github.com/freeswitch/spandsp
sudo git checkout -b finecode20230705 0d2e6ac65e0e8f53d652665a743015a88bf048d4
make and install

clean freeswitch repository
make and install again

@aeschimannr
Copy link

I'm not sure if this is the place to ask this question, but you seem to have experience with freeswitch.

I'd like freeswitch to boot into deamon. I have followed the procedure allowing Running as systemd service.
However, when I reboot and run fs_cli to see the status of sofia.
I get this:
Screenshot 2023-07-13 at 13 54 49
with a non-functional ip address

if I run the shutdown command in fs_cli and restart fs_cli, I get the following functional ip address:
Screenshot 2023-07-13 at 12 57 41

Do you have any idea what the problem is?

@cyrenity
Copy link
Author

You mean you get 127.0.0.1 on boot and if you restart using systemctl restart freeswitch then you get correct IP?

@aeschimannr
Copy link

yes, exactly

@cyrenity
Copy link
Author

Are you getting IP using DHCP or it's statically configured?

@aeschimannr
Copy link

i was using DHCP.

Editing dhcpcd.conf with the following cmd have resolve the issue.
sudo nano /etc/dhcpcd.conf
"interface [interface-name]
static ip_address=[ip-address]/[cidr-suffix]
static routers=[router-ip-address]
static domain_name_servers=[dns-address]"

many thanks!

@HDoIT
Copy link

HDoIT commented Sep 11, 2023

please help me this error:
make: *** No targets specified and no makefile found. Stop.

@glush
Copy link

glush commented Nov 26, 2023

To check SpanDSP installed run:

ldconfig && ldconfig -p | grep spandsp

instead of

ldconfig -p | grep spandsp

@swaman
Copy link

swaman commented Dec 29, 2023

Hi Sir, can you create the same instruction file of FreeSwitch and Unimrcp for RHEL 8. i was trying to install them but i was facing multiple type of errors. Please help me out.

@wheatforwood
Copy link

wheatforwood commented May 30, 2024

I've followed this guide on a fresh installation of Ubuntu 20.04 and I'm running into the following error on freeswitch compilation:

make[4]: Entering directory '/usr/local/src/freeswitch-1.10.7.-release/src/mod/endpoints/mod_verto'
CC mod_verto_la-mod_verto.lo
mod_verto.c:46:10: fatal error: ks.h: No such file or directory
46 | #include "ks.h"
| ^~~~~~

I have installed libks as recommended by the guide. And when I run sudo sh -c 'ldconfig && ldconfig -p' | grep libks I get
# sudo sh -c 'ldconfig && ldconfig -p' | grep libks
libks2.so.2 (libc6,x86-64) => /lib/libks2.so.2
libks2.so (libc6,x86-64) => /lib/libks2.so
libksba.so.8 (libc6,x86-64) => /lib/x86_64-linux-gnu/libksba.so.8

I have even tried changing the commit for libks thinking perhaps something changed. This commit was the most recent when others reported success, but it hasn't helped

git clone https://github.com/signalwire/libks.git /usr/local/src/libks && cd /usr/local/src/libks && git reset --hard 492532bcd27007113ee5ccedd5c65f33bbf9f4bc

Does anyone have any ideas on what to try from here?

Also note: I suggest adding libflite1 and flite-dev to the prerequisites. I needed these to build mod_flite

@cyrenity
Copy link
Author

If you installed libks after ./configure in FS directory then you would need to make clean and re-install FreeSWITCH

@wheatforwood
Copy link

Wow, thanks for such a fast rely @cyrenity! I installed libks first. But, just to be sure I ran

cd /usr/local/src/freeswitch-1.10.7.-release && make clean && ./configure && ./configure --enable-core-odbc-support --enable-core-pgsql-support && make && make install && make cd-sounds-install && make cd-moh-install

But, its still throwing an error in exactly the same way

mod_verto.c:46:10: fatal error: ks.h: No such file or directory
46 | #include "ks.h"
| ^~~~~~
compilation terminated.

@wheatforwood
Copy link

So, I went back to square one. Wiped the disk, reinstalled Ubuntu 20.04 and turned this whole thing into a one-liner for easy replicatability

# sudo to root to ensure its not possibly permissions
sudo su -
# stage modules.conf
vi /root/modules.conf
# one-liner install
apt install --yes build-essential pkg-config uuid-dev zlib1g-dev libjpeg-dev libsqlite3-dev libcurl4-openssl-dev libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev libtiff5-dev yasm libopus-dev libsndfile1-dev unzip libavformat-dev libswscale-dev libavresample-dev liblua5.2-dev liblua5.2-0 cmake libpq-dev unixodbc-dev autoconf automake ntpdate libxml2-dev libpq-dev libpq5 sngrep wget vim libflite1 flite-dev && git clone https://github.com/signalwire/libks.git /usr/local/src/libks && cd /usr/local/src/libks && git reset --hard 492532bcd27007113ee5ccedd5c65f33bbf9f4bc && cmake . && make && sudo make install && 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 && git clone https://github.com/freeswitch/spandsp /usr/local/src/spandsp && cd /usr/local/src/spandsp && git reset --hard 0d2e6ac65e0e8f53d652665a743015a88bf048d4 && ./bootstrap.sh && ./configure && make && make install && wget -c https://files.freeswitch.org/releases/freeswitch/freeswitch-1.10.7.-release.tar.gz -P /usr/local/src && cd /usr/local/src && tar -zxvf freeswitch-1.10.7.-release.tar.gz && cd freeswitch-1.10.7.-release && cp -f /root/modules.conf /usr/local/src/freeswitch-1.10.7.-release/modules.conf && ./configure && ./configure --enable-core-odbc-support --enable-core-pgsql-support && make && make install && make cd-sounds-install && make cd-moh-install

Still getting

mod_verto.c:46:10: fatal error: ks.h: No such file or directory
46 | #include "ks.h"
| ^~~~~~
compilation terminated.

@cyrenity
Copy link
Author

cyrenity commented May 31, 2024 via email

@cyrenity
Copy link
Author

Do you have any specific requirement to install 1.10.7? ./configure output shows it's looking for libks 1.0, and the latest libks version is 2.0. Either upgrade FS or download v.1 of libks from github https://github.com/signalwire/libks/tags

@wheatforwood
Copy link

@cyrenity Thank you so much! This is very helpful! I do have a specific need for 1.10.7. I'll install the v1.8.3 tag for libks and see how things go!

@wheatforwood
Copy link

@cyrenity Many thanks this works!

Some notes I've collected in case they are useful to anyone else:

  • Ubuntu 22.04 requires FS 1.10.10+ due to OpenSSL3

  • FS 1.10.9 and lower requires that you to use sudo git clone -bv1.8.3 https://github.com/signalwire/libks.git /usr/local/src/libks instead of sudo git clone https://github.com/signalwire/libks.git /usr/local/src/libks because they require libks v1 and the default branch is now v2.

  • libflite1 and flite-dev are required if you want to build mod_flite

@srmd-tl
Copy link

srmd-tl commented May 31, 2024

@cyrenity I am on ubuntu 24.04
cloned and make and install latest release of libk (worked fine)
cloned and make latest FS (1.10.11) got the error
make[4]: Entering directory '/usr/local/src/freeswitch-1.10.11.-release/src/mod/applications/mod_av'
CC libavmod_la-avformat.lo
avformat.c: In function ‘mod_avformat_alloc_output_context2’:
avformat.c:458:23: error: ‘const struct AVOutputFormat’ has no member named ‘priv_data_size’
458 | if (s->oformat->priv_data_size > 0) {
| ^~
avformat.c:459:53: error: ‘const struct AVOutputFormat’ has no member named ‘priv_data_size’
459 | s->priv_data = av_mallocz(s->oformat->priv_data_size);
| ^~
avformat.c: In function ‘add_stream’:
avformat.c:624:25: error: ‘ticks_per_frame’ is deprecated [-Werror=deprecated-declarations]
624 | c->ticks_per_frame = 2;
| ^
In file included from avformat.c:37:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:579:9: note: declared here
579 | int ticks_per_frame;
| ^~~~~~~~~~~~~~~
avformat.c: In function ‘av_file_read_video’:
avformat.c:3206:17: error: ‘ticks_per_frame’ is deprecated [-Werror=deprecated-declarations]
3206 | ticks = cp ? cp->repeat_pict + 1 : c->ticks_per_frame;
| ^~~~~
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:579:9: note: declared here
579 | int ticks_per_frame;
| ^~~~~~~~~~~~~~~
avformat.c:3212:25: error: ‘ticks_per_frame’ is deprecated [-Werror=deprecated-declarations]
3212 | context->video_start_time, ticks, c ? c->ticks_per_frame : -1, st->time_base.num, st->time_base.den, c ? c->time_base.num : -1, c ? c->time_base.den : -1,
| ^~~~~~~
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:579:9: note: declared here
579 | int ticks_per_frame;

@cyrenity
Copy link
Author

cyrenity commented Jun 1, 2024

@cyrenity I am on ubuntu 24.04 cloned and make and install latest release of libk (worked fine) cloned and make latest FS (1.10.11) got the error make[4]: Entering directory '/usr/local/src/freeswitch-1.10.11.-release/src/mod/applications/mod_av' CC libavmod_la-avformat.lo avformat.c: In function ‘mod_avformat_alloc_output_context2’: avformat.c:458:23: error: ‘const struct AVOutputFormat’ has no member

Try installing an older version of ffmpeg. Follow this link for more details

signalwire/freeswitch#2202

@rajujnvgupta
Copy link

please below link to install.
this

@srmd-tl
Copy link

srmd-tl commented Jun 4, 2024

@cyrenity i have tried by downgrading ffmpeg and it got with other dependency issues.
So, i shifted to ubuntu 22 and now using FS 1.10.10.
For FS 1.10.10 we need to install older 1.x version of both dsp,libk and signalwire

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