Skip to main content

Chapter 5: Module Loading and Management

Functionality in FreeSWITCH comes from modules. This chapter documents how modules are selected for loading at startup, the special early and late load files, and how to load, unload, and reload modules from the console.

Build-time vs Runtime Module Selection

FreeSWITCH separates module availability into two distinct stages: compilation and runtime loading.

Build time -- build/modules.conf.in (or a local modules.conf created from it) controls which modules the build system compiles. A line without a leading # causes the corresponding .so shared library to be built and installed. A commented line means the shared library is not built.

Runtime -- autoload_configs/modules.conf.xml controls which installed modules FreeSWITCH actually loads at startup. A <load> element tells FreeSWITCH to open the named shared library from the modules directory.

The relationship is a strict prerequisite: a module must be compiled and installed before it can appear in modules.conf.xml. Enabling a <load> for a module that was not built results in a load error logged at startup; FreeSWITCH continues starting but that module is unavailable. The inverse is harmless: a module can be compiled but left commented out in modules.conf.xml, in which case the .so exists on disk but is not loaded.

A common workflow: edit build/modules.conf.in, recompile (make && make install), then enable the corresponding <load> line in modules.conf.xml.

build/modules.conf.most is a broader alternative build manifest that enables the majority of optional modules. It is not used by the default build; copy or reference it when you want to build a more complete module set in one step.

modules.conf.xml

modules.conf.xml lists the modules loaded at startup. It is a single <modules> block of <load> elements, one per module:

<configuration name="modules.conf" description="Modules">
<modules>
<load module="mod_console"/>
<load module="mod_sofia"/>
<load module="mod_dptools"/>
</modules>
</configuration>

To enable a module, add or uncomment its <load> line. To disable one, comment the line out or remove it. Changes take effect on restart, or immediately with the runtime commands below. A module loads only if it is installed; enabling a <load> line for a module that is not built produces a load error in the log.

The Default Load Set

The tables below list every uncommented <load> in the shipped modules.conf.xml, organized by the comment categories used in that file. Each entry carries a one-line role description.

Loggers

ModuleRole
mod_consoleWrites log output to the foreground terminal or fs_cli
mod_logfileWrites log output to rotating files on disk

Multi-Faceted

ModuleRole
mod_enumENUM telephone number lookups; also provides a dialplan interface and API commands

Event Handlers

ModuleRole
mod_cdr_csvWrites call detail records to CSV files using a configurable template
mod_event_socketExposes the FreeSWITCH event system over a TCP socket for external control

Endpoints

ModuleRole
mod_sofiaSIP endpoint using the Sofia-SIP stack; the primary signaling module
mod_loopbackInternal loopback endpoint for back-to-back call legs within the switch
mod_rtcWebRTC DTLS-SRTP transport layer shared by mod_verto and SIP-over-WSS
mod_vertoWebRTC endpoint using the Verto JSON-RPC signaling protocol

Applications

ModuleRole
mod_signalwireSignalWire cloud connectivity and token provisioning
mod_commandsCore API command set (originate, uuid_kill, status, etc.)
mod_conferenceMulti-party audio and video conferencing engine
mod_dbKey-value store backed by an internal database; used by dialplan and scripts
mod_dptoolsStandard dialplan applications (answer, bridge, playback, record, etc.)
mod_exprExpression evaluation library used in dialplan conditions
mod_fifoFirst-in-first-out call queue application
mod_hashIn-memory hash table accessible from dialplan and API
mod_voicemailIntegrated voicemail system with IVR, storage, and MWI
mod_esfMulticast paging support (Polycom-compatible group page)
mod_fsvFreeSWITCH video file format recorder and player
mod_valet_parkingNamed call-park slots with retrieval by extension
mod_httapiHTTP-based application interface; fetches dialplan instructions from a web server

Dialplan Interfaces

ModuleRole
mod_dialplan_xmlProcesses dialplan from dialplan/*.xml (the default and most-used interpreter)
mod_dialplan_asteriskProcesses Asterisk-style extensions.conf dialplan syntax

Codec Interfaces

ModuleRole
mod_spandspDSP functions: T.38 fax, G.711 A-law/u-law, tone detection, and transcoding helpers
mod_g723_1G.723.1 narrowband codec (5.3 kbps and 6.3 kbps)
mod_g729G.729 narrowband codec (8 kbps); free software implementation
mod_amrAMR narrowband codec for mobile and VoIP interoperability
mod_b64Base64 codec pass-through used for transparent relay of encoded payloads
mod_opusOpus wideband/fullband codec; primary codec for WebRTC

File Format Interfaces

ModuleRole
mod_avAudio and video file read/write via libavformat (MP4, WebM, and others)
mod_sndfileAudio file read/write via libsndfile (WAV, AIFF, AU, and others)
mod_native_filePlays audio files without transcoding by matching the file's native format
mod_pngSends a PNG image as a video frame; used for video hold slides
mod_local_streamStreams audio from a directory of files in rotation (music on hold source)
mod_tone_streamGenerates tones and tone sequences from a description string

Languages

ModuleRole
mod_luaEmbeds the Lua 5.x runtime for dialplan scripts and event handlers

Say

ModuleRole
mod_say_enEnglish language phrase rendering (numbers, dates, currency, spelling)

Optional Modules (Shipped Commented Out)

The following modules are present in modules.conf.xml as commented-out <load> lines. Enable them by uncommenting the line (and ensuring the module is compiled).

Most of these modules have a dedicated page in Part 9: Module Reference, which documents each one's configuration file, the dialplan applications and API commands it registers, and the channel variables it uses.

Loggers

ModuleRole
mod_graylog2Centralized log shipping to a Graylog2 GELF endpoint
mod_syslogSend log output to the system syslog daemon

XML Interfaces

ModuleRole
mod_xml_rpcExposes an HTTP/XML-RPC management interface; used by some web admin panels
mod_xml_curlFetches dialplan, directory, and configuration XML from an HTTP server at runtime
mod_xml_cdrPosts call detail records as XML to an HTTP endpoint
mod_xml_scgiFetches XML documents via the SCGI protocol

Event Handlers

ModuleRole
mod_amqpPublishes events to an AMQP broker (RabbitMQ)
mod_cdr_sqliteWrites CDR records to a local SQLite database
mod_event_multicastBroadcasts events over UDP multicast to peer FreeSWITCH nodes
mod_erlang_eventEvent interface for Erlang nodes via the Erlang port mapper
mod_smppSMPP SMS gateway integration
mod_snmpExposes switch statistics via SNMP

Directory Interfaces

ModuleRole
mod_ldapAuthenticates and looks up users from an LDAP directory

Endpoints

ModuleRole
mod_alsaALSA audio endpoint for local sound card access on Linux
mod_skinnyCisco SCCP (Skinny) endpoint for Cisco desk phones
mod_rtmpRTMP streaming endpoint
mod_dingalingJingle/XMPP endpoint
mod_freetdmTDM telephony endpoint for hardware span cards via FreeTDM

Applications

ModuleRole
mod_curlMakes HTTP requests from dialplan; fetches or posts data to web services
mod_directoryCompany directory application with DTMF name search
mod_distributorRoutes calls across a weighted list of gateways
mod_lcrLeast-cost routing engine with database-backed rate tables
mod_easyrouteLightweight DID routing from a database table
mod_fskFSK modem for caller ID and data signaling
mod_spySilent call monitoring application
mod_smsSMS message routing and handling application
mod_randomGenerates random numbers for use in dialplan variables
mod_translateNumber translation using regular expression or database rules
mod_mongoMongoDB integration for dialplan and data storage

Dialplan Interfaces

ModuleRole
mod_dialplan_directoryLooks up dialplan routing from the user directory

Codec Interfaces

ModuleRole
mod_ilbciLBC narrowband codec (13.3 kbps and 15.2 kbps)
mod_sirenG.722.1 (Siren) wideband codec for Polycom interoperability

File Format Interfaces

ModuleRole
mod_opusfileReads Ogg Opus files for playback
mod_shoutReads and writes MP3 streams and files via libshout and libmp3lame; Icecast source
mod_shell_streamStreams audio from the output of an arbitrary shell command

Timers

ModuleRole
mod_timerfdHigh-resolution timer using Linux timerfd kernel interface
mod_posix_timerPOSIX interval timer as an alternative timing source

Languages

ModuleRole
mod_v8Embeds the V8 JavaScript engine for dialplan scripting
mod_perlEmbeds the Perl runtime for dialplan scripts
mod_python3Embeds the Python 3 runtime for dialplan scripts
mod_javaEmbeds the JVM for dialplan scripts

ASR/TTS

ModuleRole
mod_fliteText-to-speech using the CMU Flite engine
mod_pocketsphinxAutomatic speech recognition using the PocketSphinx engine
mod_tts_commandlineTTS via an external command-line program

Say

ModuleRole
mod_say_ruRussian language phrase rendering
mod_say_zhChinese language phrase rendering
mod_say_svSwedish language phrase rendering

Additional say modules available in the build system (not listed in the default modules.conf.xml) include mod_say_de, mod_say_es, mod_say_es_ar, mod_say_fa, mod_say_fr, mod_say_he, mod_say_hr, mod_say_hu, mod_say_it, mod_say_ja, mod_say_nl, mod_say_pl, mod_say_pt, mod_say_th.

Third-party Applications

ModuleRole
mod_nibblebillReal-time per-leg billing with configurable deduction intervals
mod_callcenterACD queue with agent skill routing, wrap-up, and reporting

Early and Late Loading

Two companion files control modules that must load before or after the main set. FreeSWITCH processes them in this order:

  1. pre_load_modules.conf.xml
  2. modules.conf.xml
  3. post_load_modules.conf.xml

Each file uses identical <load module="..."/> syntax.

pre_load_modules.conf.xml -- The shipped default loads one module:

<configuration name="pre_load_modules.conf" description="Modules">
<modules>
<!-- Databases -->
<!-- <load module="mod_mariadb"/> -->
<load module="mod_pgsql"/>
</modules>
</configuration>

mod_pgsql provides the PostgreSQL database backend. Because other modules (including core subsystems) may open database connections during their own initialization, the database driver must be available before the main load sequence begins. mod_mariadb is a commented-out alternative for MariaDB or MySQL backends; enable it instead of mod_pgsql to use a MariaDB or MySQL backend, or alongside it to use both.

Enable mod_xml_curl here when FreeSWITCH fetches configuration, directory, and dialplan documents from an HTTP server: the XML interface must be registered before the modules that consume those documents initialize, which requires early loading.

post_load_modules.conf.xml -- Empty by default. Use it for modules that depend on the full module set being initialized first. No shipped modules require this currently.

FileDefault contentTypical use
pre_load_modules.conf.xmlmod_pgsql enabledDatabase backends, XML providers
modules.conf.xmlFull working PBX setAll standard modules
post_load_modules.conf.xmlEmptyModules with late-init dependencies

Module Categories

A module's category determines the kind of interface it provides and which configuration file it reads. Categories are an organizing concept; a single module can register more than one interface. For example mod_enum provides a dialplan interface, an application, and an API command.

CategoryInterface provided
endpointsCall signaling protocols
applicationsDialplan applications and API commands
dialplansDialplan interpreters
codecsAudio and video codecs
formatsFile and stream readers and writers
event_handlersExternal event interfaces and CDR backends
loggersLog destinations
languagesEmbedded scripting runtimes
sayPhrase rendering per language
asr_ttsSpeech recognition and synthesis
timersTiming sources
databasesExternal database backends
directoriesExternal directory backends
xml_intDynamic XML providers

Managing Modules at Runtime

You can load, unload, and reload modules from fs_cli without restarting.

CommandEffect
load mod_nameLoad a module now
unload mod_nameUnload a module now
reload mod_nameUnload and load a module, re-reading its configuration
reloadxmlReparse the XML document without touching loaded modules
show modulesList currently loaded modules

reloadxml refreshes the configuration document but does not load or unload modules. Use reload mod_name when a module caches its own configuration and you have changed it. The per-module reload requirement is noted in each module's chapter.