Mod_timerfd uses the Linux kernel timerfd API to create and use a kernel timer that delivers timer expire notifications via a file descriptor.
Requires kernel >= 2.6.25, libc >= 2.8, and FreeSWITCH commit 48b1193552983e37f1724bd9a87d48ade5de74e5 or later.
You must enable it in switch.conf.xml with the param enable-softtimer-timerfd=true Or, enable it per channel with:
<action application="set" data="rtp_timer_name=timerfd"/>
Testing TIMERFD feature in FreeSWITCH git
The TIMERFD feature is a linux specific feature to support timing in applications without using signals. I have no clue what specific advantages you get from this, but it's a new and modern way to do timing. So it must be very great :-)
Note that TIMERFD support is experimental and thus you should always use latest git when trying to use it.
To use the TIMERFD feature, you have to have a kernel with support for it. Check wether your kernel has such support with:
grep '^CONFIG_TIMERFD=' /boot/config-* OR zgrep CONFIG_TIMERFD= /proc/config.gz
If you kernel does not support TIMERFD feature, you will need to rebuild it or use a different build/kernel.
Secondly, you will need the FreeSWITCH support. There are two ways to get this, as native core support or as mod_timerfd module.
TIMERFD support as mod_timerfd
To check wether the module is available, do:
find /usr/local/freeswitch/mod/ -name mod_timerfd.*
To build the mod_timerfd in case it's not already there, add this line to your FreeSWITCH sources' modules.conf:
Then build the module with this command:
Finally install the module with this command:
Then you need to configure FreeSWITCH to actually load the mod_timerfd on startup. In /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml put a line like this:
Then restart FreeSWITCH:
Alternatively load the module from the CLI:
/usr/local/freeswitch/bin/fs_cli load mod_timerfd ^D
Verify wether timerfd timer is available when using mod_timerfd:
freeswitch@internal> show timer type,name,ikey timer,soft,CORE_SOFTTIMER_MODULE timer,timerfd,mod_timerfd 2 total.
TIMERFD support natively in FreeSWITCH core
In the file /usr/local/freeswitch/conf/autoload_configs/switch.conf.xml you have to put this:
<param name="enable-softtimer-timerfd" value="true"/>
FreeSWITCH should then use TIMERFD to implement normal soft timer.
WARNING! Don't use both TIMERFD support methods. I accidentally tried and got huge performance loss on incoming calls while RINGING. I got a severe lag in Xorg. As soon as call was hungup, the lag was gone. I think to use both methods at the same time is not ment to be done.