User Tools

Site Tools


FreeSWITCH on OpenWrt intro

This page is meant to provide some basic information about FreeSWITCH on OpenWrt. Visit the official FreeSWITCH wiki to find out more about FreeSWITCH in particular.

Telephony systems like FreeSWITCH are targeted by criminals to commit toll fraud. If you fall victim to toll fraud this can cost you a lot of money. You are responsible for the security of your sytem. Make sure all security measures are in place before bringing FreeSWITCH online.

freeswitch-stable init command line switches

In /etc/default/freeswitch you can change the command line switches that are used when starting FreeSWITCH. E.g. you can set which user FreeSWITCH should switch to and the directories to use for recordings and logs.

The file also contains the line ENABLE_FREESWITCH=“yes”, which is commented out by default. If the variable ENABLE_FREESWITCH is not set to yes, the init script will not start FreeSWITCH.

freeswitch-stable packages


FreeSWITCH has a multitude of modules. OpenWrt typically runs on hardware that is somewhat restricted, i.e. memory, storage and processing power are limited. Luckily only a few packages are needed for basic functionality (depending on what you want it to do). Here is a list of some modules that you might be interested in:

FreeTDM modules

FreeSWITCH supports select TDM hardware. At the heart of this sits libfreetdm-stable. It will be pulled in automatically when you install the endpoint driver freeswitch-stable-mod-freetdm, which is used by FreeSWITCH to interconnect with all protocols supported by FreeTDM.

FreeTDM itself is modular as well. OpenWrt packages the following FreeTDM modules:

  • libfreetdm-stable-ftmod-analog: signaling module; provides support for FXS/FXO
  • libfreetdm-stable-ftmod-analog-em: signaling module; not solely for analog, supports E1/T1 analog and digital cards using CASE&M signaling
  • libfreetdm-stable-ftmod-libpri: signaling module; provides support for ISDN over PRI/BRI
  • libfreetdm-stable-ftmod-pritap: PRI tapping
  • libfreetdm-stable-ftmod-skel: example module
  • libfreetdm-stable-ftmod-zt: I/O module; takes care of reading and writing raw data bytes and executing low level control commands on the telephony hardware

Don't forget to install kmod-dahdi. It provides the kernel driver for the TDM hardware.


There are also a number of utilities available. Lets just mention the one that is probably the most important:

  • freeswitch-stable-util-fs-cli: allows CLI access to a FreeSWITCH server, either local or remote (uses the event socket interface mentioned above)


The FreeSWITCH source contains a number of folders with configuration examples. These are packaged as well:

  • freeswitch-stable-example-curl
  • freeswitch-stable-example-insideout

Any of these will install the corresponding sample configuration to /usr/share/freeswitch/examples.


freeswitch-stable-misc-hotplug contains a hotplug script. It will start FreeSWITCH when a user-selectable interface comes up. The script can be influenced by editing /etc/default/freeswitch. It is advisable to disable the FreeSWITCH autostart with /etc/init.d/freeswitch disable to avoid FreeSWITCH beeing started twice when booting.

Here is what is visible in the OpenWrt log when the the hotplug script gets called:

Sun Sep 9 10:06:17 2018 user.notice freeswitch-hotplug: stopping freeswitch Sun Sep 9 10:06:28 2018 user.notice freeswitch-hotplug: freeswitch stopped Sun Sep 9 10:06:28 2018 user.notice freeswitch-hotplug: /mnt/usb mounted Sun Sep 9 10:06:28 2018 user.notice freeswitch-hotplug: ntpd stratum 3 Sun Sep 9 10:06:28 2018 user.notice freeswitch-hotplug: ntpd to system time offset +/- 0 ms Sun Sep 9 10:06:28 2018 user.notice freeswitch-hotplug: system time in sync Sun Sep 9 10:06:29 2018 user.notice freeswitch-hotplug: started freeswitch due to “ifup wan” event

FreeSWITCH was already running when the WAN interface went up (so this could have been a DSL connection going down and then up again).

The first thing that happens is that FreeSWITCH is stopped if it is already running. Then the script checks if a device is mounted at /mnt/usb (if you don't specify a mount point this will be skipped, obviously). Next it tests if the system time is in sync (if you enabled the ntpd check).

Finally FreeSWITCH is started again. Be aware that restarting FreeSWITCH can take a few minutes, because it will go through its databases and check different states, e.g. of calls and registrations. Check with top. While it starts up it uses all available CPU cycles (100% if it can). Once it successfully completed its initialization the CPU usage goes down to normal levels.

docs/guide-user/services/voip/freeswitch.txt · Last modified: 2018/09/09 08:39 by micmac1