Freeswitch on OpenBSD
This is a shallow fork of Freeswitch for use on OpenBSD.
Rationale
The upstream version of freeswitch has several characteristics which preclude it
from being included in OpenBSD Ports. This project aims to resolve the problems
so that it can be provided as a port.
- Library dependancies are bundled inside its source tree. Most of these
libraries are already available as ports from OpenBSD and they are generally
unsubstantially changed from their original upstream versions.
- Configuration, static resources, logging, binary modules, etc are installed
in non-standard locations.
- Upstream freeswitch has a history of breaking their build against (Open)BSD
targets on a regular basis and show dramatic ignorance of the environment.
- Upstream installation script is unweildy and unreliable.
- Slow down the rate at which changes are introduced and avoid introducing
bizarre featues unrelated to a reliable SIP softswitch.
- Provide a stable, tested version of freeswitch known to work on OpenBSD.
- Introduce OpenBSD security idioms.
Point
To make Freeswitch a first class citizen on OpenBSD and to eventually have a
real Freeswitch port included in OpenBSD.
Dependencies
We depend on the following OpenBSD ports:
apr
apr-util
curl
flac
jpeg
libidn
libnatpmp
libogg
libsndfile
libsrtp
libvorbis
lua (5.1.x, not 5.2)
miniupnpc
pcre
spandsp
speex
tiff
Additionally, FreeSWITCH depends on sqlite3 which is provided in base OpenBSD.
Building
Install the list of dependencies
Installation from source should be as simple as:
make && sudo make install
Running the build on an 5.6-current i386 VM the compile completes in 6 minutes
6m3.57s real 4m31.09s user 0m59.31s system
You will need to copy your configuration to /etc/freeswitch, a sample one is
included in git.
Also, for now you will need to get your sounds directly from upstream freeswitch
and install them to /usr/local/share/freeswitch/(sounds go here)
After the software is installed you can launch the daemon by calling:
fsd
No init script exists yet, please stay tuned.
What is Installed?
Here is what is installed
-Executables (/usr/local/bin)
fsd
fs_cli
-Libraries (/usr/local/lib)
libapr-shim
libesl
libfs
libfs++
-Modules (/usr/local/lib/fs_mod)
mod_callcenter.so
mod_cdr_csv.so
mod_commands.so
mod_conference.so
mod_console.so
mod_db.so
mod_dialplan_xml.so
mod_directory.so
mod_dptools.so
mod_esf.so
mod_event_socket.so
mod_expr.so
mod_fifo.so
mod_hash.so
mod_local_stream.so
mod_logfile.so
mod_loopback.so
mod_lua.so
mod_native_file.so
mod_sndfile.so
mod_sofia.so
mod_spandsp.so
mod_tone_stream.so
mod_valet_parking.so
mod_voicemail.so
Problems
Things to do
- Create init script to launch the daemon
- Enable modules
- mod_perl
- mod_flite
- mod_shout
- mod_bcg729
- Strip configuration to min required to operate
- Create port and tgz package
- Current launcher (switch.c) is pretty heavy (1000+ lines), perhaps re-write it
- Launcher should do only this (more or less):
- Load freeswitch.xml (or user specified equivalent)
- Setup signal handling
- Daemonize
- Audit code
- Change rand/srand to arc4random
- Change switch_* namespace string functions to intrinsics
- Change strcpy to strlcpy
- Remove APR shim (remove/reimplement functionality)
- Check all the calls to malloc,calloc,realloc,strdup,asprintf
- Enable rigorous malloc.conf features
Criticisms
- Configuration is loaded by directories? Can we not just specify freeswitch.xml
- Configuration is really heavy. A scan of the vanilla config folder from
the source tree shows there are 248 items weighing a heafty 667.5 kB.
- Launcher doesn't appear to use getopt for some reason?
- mime.types is hard coded
- What else is hard coded?
- ideally we should point at freeswitch.xml and it should specify
- wtf is a softswitch doing loading a giant list of mime types
- Can we not just specify the couple it needs by hand?