Difference between revisions of "Free Switch"

From Fire And Ice Grid
Jump to navigation Jump to search
 
(12 intermediate revisions by the same user not shown)
Line 63: Line 63:
 
   sudo apt install build-essential autoconf cmake libtool pkg-config libcurl4-openssl-dev python-pycurl python3-pycurl libtiff-dev libaudiofile-dev fftw-dev sqlite3 libsqlite3-dev libpcre3-dev speex libspeex-dev libspeexdsp-dev libldns-dev nasm libavformat-dev libswscale-dev liblua5.3-dev libpq-dev libx11-dev libfreetype-dev libssl-dev uuid uuid-dev git unzip libedit-dev libopus-dev libsndfile-dev
 
   sudo apt install build-essential autoconf cmake libtool pkg-config libcurl4-openssl-dev python-pycurl python3-pycurl libtiff-dev libaudiofile-dev fftw-dev sqlite3 libsqlite3-dev libpcre3-dev speex libspeex-dev libspeexdsp-dev libldns-dev nasm libavformat-dev libswscale-dev liblua5.3-dev libpq-dev libx11-dev libfreetype-dev libssl-dev uuid uuid-dev git unzip libedit-dev libopus-dev libsndfile-dev
  
=== [https://github.com/fltk/fltk Fltk] ===
+
==== [https://github.com/fltk/fltk Fltk] ====
 
Required by Spandsp
 
Required by Spandsp
  
Line 72: Line 72:
 
  sudo make install
 
  sudo make install
  
=== [https://github.com/freeswitch/spandsp Spandsp] ===
+
==== [https://github.com/freeswitch/spandsp Spandsp] ====
  
 
  git clone https://github.com/freeswitch/spandsp
 
  git clone https://github.com/freeswitch/spandsp
Line 90: Line 90:
 
  sudo make install
 
  sudo make install
  
=== [https://github.com/signalwire/libks.git libks] ===
+
==== [https://github.com/signalwire/libks.git libks] ====
 
<syntaxhighlight lang="Bash" line>
 
<syntaxhighlight lang="Bash" line>
 
git clone https://github.com/signalwire/libks.git
 
git clone https://github.com/signalwire/libks.git
Line 99: Line 99:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
=== [https://github.com/signalwire/signalwire-c.git Signalwire] ===
  
=== [https://github.com/signalwire/signalwire-c.git Signalwire] ===
+
git clone https://github.com/signalwire/signalwire-c.git
<syntaxhighlight lang="Bash" line>
+
cd signalwire-c
git clone https://github.com/signalwire/signalwire-c.git
+
cmake .
cd signalwire-c
+
make
cmake .
+
sudo make install
make
 
sudo make install
 
</syntaxhighlight>
 
  
 
=== Free Switch ===
 
=== Free Switch ===
 
First download, extract and enter the folder.  
 
First download, extract and enter the folder.  
  
<syntaxhighlight lang="Bash" line>
+
 
sudo wget https://files.freeswitch.org/freeswitch-releases/freeswitch-1.10.6.-release.zip
+
sudo wget https://files.freeswitch.org/freeswitch-releases/freeswitch-1.10.6.-release.zip
unzip freeswitch-1.10.6.-release.zip
+
unzip freeswitch-1.10.6.-release.zip
cd freeswitch-1.10.6.-release
+
cd freeswitch-1.10.6.-release
</syntaxhighlight>
+
 
  
 
Copy lua5 files to where they should be, but are missing from the release files.  
 
Copy lua5 files to where they should be, but are missing from the release files.  
<syntaxhighlight lang="Bash" line>
+
 
mkdir src/mod/languages/mod_lua
+
mkdir src/mod/languages/mod_lua
cp /usr/include/lua5.3/*.h src/mod/languages/mod_lua/
+
cp /usr/include/lua5.3/*.h src/mod/languages/mod_lua/
</syntaxhighlight>
+
 
  
 
add a symbolic link so its found
 
add a symbolic link so its found
<syntaxhighlight lang="Bash" line>
+
 
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.3.so /usr/lib/x86_64-linux-gnu/liblua.so
+
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.3.so /usr/lib/x86_64-linux-gnu/liblua.so
</syntaxhighlight>
+
 
  
 
compile
 
compile
<syntaxhighlight lang="Bash" line>
+
 
./configure
+
./configure
make
+
make
sudo make install
+
sudo make install
</syntaxhighlight>
 
  
 
Compile the sounds
 
Compile the sounds
<syntaxhighlight lang="Bash" line>
+
 
sudo make all cd-sounds-install cd-moh-install
+
sudo make all cd-sounds-install cd-moh-install
</syntaxhighlight>
+
 
  
 
Create Symbolic links for ease of use
 
Create Symbolic links for ease of use
<syntaxhighlight lang="Bash" line>
 
sudo ln -s /usr/local/freeswitch/bin/freeswitch /usr/bin/
 
sudo ln -s /usr/local/freeswitch/bin/fs_cli /usr/bin
 
</syntaxhighlight>
 
  
Create a user with limited rights to run freeswitch
+
sudo ln -s /usr/local/freeswitch/bin/freeswitch /usr/bin/
<syntaxhighlight lang="Bash" line>
+
sudo ln -s /usr/local/freeswitch/bin/fs_cli /usr/bin
cd /usr/local
+
 
sudo groupadd freeswitch
+
==== Configure FreeSWITCH ====
sudo adduser --disabled-password  --quiet --system --home /usr/local/freeswitch --gecos "FreeSWITCH Voice Platform" --ingroup freeswitch freeswitch
+
Once you've compiled and installed Freeswitch, you will need to activate mod_siren and mod_xml_curl in /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml, since it's disabled by default on a fresh install. This bit needs doing as root
sudo chown -R freeswitch:freeswitch /usr/local/freeswitch/
+
 
sudo chmod -R ug=rwX,o= /usr/local/freeswitch/
+
su root
sudo chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/
+
nano /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml
</syntaxhighlight>
+
 
 +
uncomment the lines...
 +
 
 +
<load module="mod_xml_curl"/>
 +
and
 +
 
 +
<load module="mod_siren"/>
 +
 
 +
save and exit then su back to your normal user
 +
 
 +
====Create a user with limited rights to run freeswitch====
  
Create a systemd service file to start automatically
+
cd /usr/local
<syntaxhighlight lang="INI" line>
+
sudo groupadd freeswitch
[Unit]
+
sudo adduser --disabled-password  --quiet --system --home /usr/local/freeswitch --gecos "FreeSWITCH Voice Platform" --ingroup freeswitch freeswitch
Description=freeswitch
+
sudo chown -R freeswitch:freeswitch /usr/local/freeswitch/
Wants=network-online.target
+
sudo chmod -R ug=rwX,o= /usr/local/freeswitch/
Requires=syslog.socket network.target local-fs.target
+
sudo chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/
After=syslog.socket network.target network-online.target local-fs.target
 
  
[Service]
 
Type=forking
 
Environment="DAEMON_OPTS=-nonat"
 
EnvironmentFile=-/etc/default/freeswitch
 
ExecStartPre=/bin/chown -R freeswitch:freeswitch /usr/local/freeswitch
 
ExecStart=/usr/bin/freeswitch -u freeswitch -g freeswitch -ncwait $DAEMON_OPTS
 
TimeoutSec=45s
 
Restart=always
 
RestartSec=90
 
StartLimitInterval=0
 
StartLimitBurst=6
 
  
User=root
+
==== Create a systemd service file to start automatically====
Group=daemon
+
sudo nano /etc/systemd/system/freeswitch.service
LimitCORE=infinity
 
LimitNOFILE=100000
 
LimitNPROC=60000
 
LimitSTACK=250000
 
LimitRTPRIO=infinity
 
LimitRTTIME=infinity
 
IOSchedulingClass=realtime
 
IOSchedulingPriority=2
 
CPUSchedulingPolicy=rr
 
CPUSchedulingPriority=89
 
UMask=0007
 
NoNewPrivileges=false
 
  
[Install]
+
added the following contents and save
WantedBy=multi-user.target
 
</syntaxhighlight>
 
  
== Configure FreeSWITCH ==
+
[Unit]
Once you've compiled and installed Freeswitch, you will need to activate mod_siren and mod_xml_curl in /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml, since it's disabled by default on a fresh install.
+
Description=freeswitch
 +
Wants=network-online.target
 +
Requires=syslog.socket network.target local-fs.target
 +
After=syslog.socket network.target network-online.target local-fs.target
 +
 +
[Service]
 +
Type=forking
 +
Environment="DAEMON_OPTS=-nonat"
 +
EnvironmentFile=-/etc/default/freeswitch
 +
ExecStartPre=/bin/chown -R freeswitch:freeswitch /usr/local/freeswitch
 +
ExecStart=/usr/bin/freeswitch -u freeswitch -g freeswitch -ncwait $DAEMON_OPTS
 +
TimeoutSec=45s
 +
Restart=always
 +
RestartSec=90
 +
StartLimitInterval=0
 +
StartLimitBurst=6
 +
 +
User=root
 +
Group=daemon
 +
LimitCORE=infinity
 +
LimitNOFILE=100000
 +
LimitNPROC=60000
 +
LimitSTACK=250000
 +
LimitRTPRIO=infinity
 +
LimitRTTIME=infinity
 +
IOSchedulingClass=realtime
 +
IOSchedulingPriority=2
 +
CPUSchedulingPolicy=rr
 +
CPUSchedulingPriority=89
 +
UMask=0007
 +
NoNewPrivileges=false
 +
 +
[Install]
 +
WantedBy=multi-user.target
  
uncomment the lines...
+
start the service
 +
 +
sudo systemctl start freeswitch.service
  
  <load module="mod_xml_curl"/>
+
check its working with
and
+
sudo systemctl status freeswitch.service
  
  <load module="mod_siren"/>
+
enable the service so it starts each time at boot
 +
sudo systemctl enable freeswitch.service
  
 
== Configure Opensimulator ==
 
== Configure Opensimulator ==
Line 212: Line 225:
 
opensim.ini
 
opensim.ini
  
  [FreeSwitchVoice]
+
[FreeSwitchVoice]
  Enabled = true
+
Enabled = true
  LocalServiceModule = OpenSim.Services.Connectors.dll:RemoteFreeswitchConnector
+
LocalServiceModule = OpenSim.Services.Connectors.dll:RemoteFreeswitchConnector
  FreeswitchServiceURL = "${Const|BaseUrl}:${Const|FreeSwitchPort}/fsapi"
+
FreeswitchServiceURL = "${Const|BaseUrl}:${Const|FreeSwitchPort}/fsapi"
  
  
 
Add for Robust.ini/Robust.HG.ini
 
Add for Robust.ini/Robust.HG.ini
  
  [FreeswitchService]
+
[FreeswitchService]
  LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService
+
LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService
  ServerAddress = "${Const|FreeswitchURL}"
+
ServerAddress = "${Const|FreeswitchURL}"

Latest revision as of 14:31, 10 June 2021


Introduction

FreeSWITCH is a voice service that can be used with Opensimulator. Until recently it has been a little-used option; however, with the announcement that Vivox support for opensimulator is coming to an end, it is one of the alternative options. This page is not complete, the compilation works, and the plugin states it's active in the console. Additionally in the viewer in the voice preferences voice can be tested successfully. However, neither local nor IM voice chat buttons are enabled.


This page is aimed at adding to the information available for both getting a working version of FreeSwitch and configuring it for opensimulator. At the time of writing the latest release is 10.6.

Information Sources

Compile And Install

Compile And Install on Ubuntu 20.04 Server

The packages listed are a combination of those found so far after starting from three different images of ubuntu 20.04 server including a direct download

Ubuntu Packages Required

  • build-essential
  • git
  • unzip
  • autoconf
  • cmake
  • Libtool
  • pkg-config
  • libcurl4-opensssl-dev
  • python-pycurl
  • python3-pycurl
  • python3-pycurl-dbug
  • libtiff-dev
  • libaudiofile-dev
  • fftw-dev
  • sqlite3
  • libsqlite3-dev
  • libcurl4-openssl-dev
  • libpcre3-dev
  • speex
  • libspeex-dev
  • libspeexdsp-dev
  • libldns-dev
  • nasm
  • libavformat-dev
  • libswscale-dev
  • liblua5.3-dev
  • libpq-dev - required to compile Spandsp
  • libx11-dev - required to compile Fltk
  • libfreetype-dev - required to compile Fltk
  • libssl-dev - required to compile Sofia
  • uuid - required to compile Libks
  • uuid-dev - required to compile Libks
  • libedit-dev
  • libopus-dev
  • libsndfile-dev


  sudo apt install build-essential autoconf cmake libtool pkg-config libcurl4-openssl-dev python-pycurl python3-pycurl libtiff-dev libaudiofile-dev fftw-dev sqlite3 libsqlite3-dev libpcre3-dev speex libspeex-dev libspeexdsp-dev libldns-dev nasm libavformat-dev libswscale-dev liblua5.3-dev libpq-dev libx11-dev libfreetype-dev libssl-dev uuid uuid-dev git unzip libedit-dev libopus-dev libsndfile-dev

Fltk

Required by Spandsp

git clone https://github.com/fltk/fltk.git
cd fltk
cmake .
make
sudo make install

Spandsp

git clone https://github.com/freeswitch/spandsp
cd spandsp
./bootstrap.sh
./configure
make -j
sudo make install

sofia-sip

git clone https://github.com/freeswitch/sofia-sip
cd sofia-sip
sh autogen.sh (if building from darcs)
./configure
make
sudo make install

libks

1 git clone https://github.com/signalwire/libks.git
2 cd libks
3 cmake .
4 make 
5 sudo make install

Signalwire

git clone https://github.com/signalwire/signalwire-c.git
cd signalwire-c
cmake .
make
sudo make install

Free Switch

First download, extract and enter the folder.


sudo wget https://files.freeswitch.org/freeswitch-releases/freeswitch-1.10.6.-release.zip
unzip freeswitch-1.10.6.-release.zip
cd freeswitch-1.10.6.-release


Copy lua5 files to where they should be, but are missing from the release files.

mkdir src/mod/languages/mod_lua
cp /usr/include/lua5.3/*.h src/mod/languages/mod_lua/


add a symbolic link so its found

sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.3.so /usr/lib/x86_64-linux-gnu/liblua.so


compile

./configure
make
sudo make install

Compile the sounds

sudo make all cd-sounds-install cd-moh-install


Create Symbolic links for ease of use

sudo ln -s /usr/local/freeswitch/bin/freeswitch /usr/bin/
sudo ln -s /usr/local/freeswitch/bin/fs_cli /usr/bin

Configure FreeSWITCH

Once you've compiled and installed Freeswitch, you will need to activate mod_siren and mod_xml_curl in /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml, since it's disabled by default on a fresh install. This bit needs doing as root

su root
nano /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml

uncomment the lines...

<load module="mod_xml_curl"/>

and

<load module="mod_siren"/>

save and exit then su back to your normal user

Create a user with limited rights to run freeswitch

cd /usr/local
sudo groupadd freeswitch
sudo adduser --disabled-password  --quiet --system --home /usr/local/freeswitch --gecos "FreeSWITCH Voice Platform" --ingroup freeswitch freeswitch
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/


Create a systemd service file to start automatically

sudo nano /etc/systemd/system/freeswitch.service

added the following contents and save

[Unit]
Description=freeswitch
Wants=network-online.target
Requires=syslog.socket network.target local-fs.target
After=syslog.socket network.target network-online.target local-fs.target

[Service]
Type=forking
Environment="DAEMON_OPTS=-nonat"
EnvironmentFile=-/etc/default/freeswitch
ExecStartPre=/bin/chown -R freeswitch:freeswitch /usr/local/freeswitch
ExecStart=/usr/bin/freeswitch -u freeswitch -g freeswitch -ncwait $DAEMON_OPTS
TimeoutSec=45s
Restart=always
RestartSec=90
StartLimitInterval=0
StartLimitBurst=6

User=root
Group=daemon
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
LimitSTACK=250000
LimitRTPRIO=infinity
LimitRTTIME=infinity
IOSchedulingClass=realtime
IOSchedulingPriority=2
CPUSchedulingPolicy=rr
CPUSchedulingPriority=89
UMask=0007
NoNewPrivileges=false

[Install]
WantedBy=multi-user.target

start the service

sudo systemctl start freeswitch.service

check its working with

sudo systemctl status freeswitch.service

enable the service so it starts each time at boot

sudo systemctl enable freeswitch.service

Configure Opensimulator

Grid Mode In grid mode, [FreeSwitchVoice] in OpenSim.ini and [FreeswitchService] in Robust.ini or Robust.HG.ini need to be configured. Configurations details are shown in both OpenSim.ini.example, Robust.ini.example and Robust.HG.ini.example. Here is an example configuration for OpenSim.ini.

opensim.ini

[FreeSwitchVoice]
Enabled = true
LocalServiceModule = OpenSim.Services.Connectors.dll:RemoteFreeswitchConnector
FreeswitchServiceURL = "${Const|BaseUrl}:${Const|FreeSwitchPort}/fsapi"


Add for Robust.ini/Robust.HG.ini

[FreeswitchService]
LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService
ServerAddress = "${Const|FreeswitchURL}"