Mod posix timer

From FreeSWITCH Wiki
Jump to: navigation, search

mod_posix_timer uses the POSIX timers API (timer_create, timer_settime, timer_delete) to create and use a kernel timer that delivers timer expire notifications via a sigevent.

This timer works on older Linux kernels like 2.6.18.

You can enable it per channel with:

 <action application="set" data="rtp_timer_name=posix"/>

or per Sofia profile with:

  <param name="rtp-timer-name" value="posix"/>

Testing POSIX timer feature in FreeSwitch git

Note that POSIX timer support is experimental and thus you should always use latest git when trying to use it.

POSIX timer support in mod_posix_timer

To check whether the module is running, do:

freeswitch@internal> show modules mod_posix_timer
type,name,ikey,filename
timer,posix,mod_posix_timer,/usr/local/freeswitch/mod/mod_posix_timer.so

1 total.

If the module is not running, check if it is available:

 find /usr/local/freeswitch/mod/ -name mod_posix_timer.*

To build the mod_posix_timer in case it's not already there, add this line to freeswitch/modules.conf:

 timers/mod_posix_timer

Then build the module with this command:

 make mod_posix_timer

Finally install the module with this command:

 make mod_posix_timer-install

Then you need to configure FreeSWITCH to load mod_posix_timer on startup. In /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml put a line like this:

 <load module="mod_posix_timer"/>

Then restart FreeSWITCH:

 /etc/init.d/freeswitch restart

Alternatively load the module from the CLI:

 /usr/local/freeswitch/bin/fs_cli
 freeswitch@internal> load mod_posix_timer

Verify that mod_posix_timer is loaded:

 freeswitch@internal> show timer
 type,name,ikey
 timer,soft,CORE_SOFTTIMER_MODULE
 timer,posix,mod_posix_timer
 
 2 total.