Skip to main content

mod_random — Random Application Execution

mod_random is a Linux-only infrastructure module in the src/mod/applications tree that acts as a continuous entropy source for the host operating system. It opens /dev/hwrandom (falling back to /dev/random) and feeds two streams of data into the kernel entropy pool via the RNDADDENTROPY ioctl: serialized FreeSWITCH events captured from SWITCH_EVENT_ALL, and silence-pattern audio buffers generated by switch_generate_sln_silence.

Operators running FreeSWITCH on virtual machines or embedded hardware where the kernel entropy pool drains quickly — causing getrandom() or /dev/urandom reads to block — can load this module to keep the pool supplied with call-derived randomness. It requires no configuration and exposes no dialplan applications or API commands.

Loading the Module

The module name for load and modules.conf.xml is mod_random.

It is not enabled in the default vanilla configuration; the entry in autoload_configs/modules.conf.xml is commented out:

<!--<load module="mod_random"/>-->

To activate it, uncomment that line or add it to your own modules.conf.xml, then either restart FreeSWITCH or run the following at fs_cli:

load mod_random

This module is Linux-only. On Windows the load function returns SWITCH_STATUS_NOTIMPL immediately and the module will not start.

Dependencies

mod_random uses the Linux kernel header linux/random.h for the RNDADDENTROPY ioctl. This header is part of the standard Linux kernel development package required to build FreeSWITCH on Linux and is not an additional external dependency. No third-party libraries are needed.

Source: src/mod/applications/mod_random