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.
/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 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:
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:
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:
The FreeSWITCH source contains a number of folders with configuration examples. These are packaged as well:
Any of these will install the corresponding sample configuration to
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.