modules.conf

This file is not strictly required in an Asterisk installation; however, without any modules Asterisk won’t really be able to do anything, so for all practical purposes, you need a modules.conf file in your /etc/asterisk folder. If you simply define autoload=yes in your modules.conf file, Asterisk will search for all modules in the /usr/lib/asterisk/modules folder and load them at startup.

Although most modules do not use much in the way of resources, and they all load very quickly, it just seems cleaner to our minds to load only those modules that you are planning on using in your system. Additionally, there are security benefits to not loading modules that accept connections over a network.

In the past we felt that explicitly loading each desired module was the best way to handle this, but we have since found that this practice creates extra work. After every upgrade we found ourselves having to edit the modules.conf file to correct all the module differences between releases, and the whole process ended up being needlessly complicated. What we prefer to do these days is to allow Asterisk to automatically load the modules that it finds, but to explicitly tell Asterisk not to load any modules we do not want loaded by use of the noload directive. A sample modules.conf file can be found in the section called “modules.conf”.

The [modules] Section

The modules.conf file contains a single section. The options available in this section are listed in Table 4.5, “modules.conf [modules] section”. With the exception of autoload, all of the options may be specified more than once.

Note

A list of all loadable modules is available in Chapter 2, Asterisk Architecture, with notes on our opinion regarding the popularity/status of each of them.

Table 4.5. modules.conf [modules] section

OptionValue/ExampleNotes
autoloadyesInstead of explicitly listing which modules to load, you can use this directive to tell Asterisk to load all modules that it finds in the modules directory, with the exception of modules listed as not to be loaded using the noload directive. The default, and our recommendation, is to set this option to yes.
preloadres_odbc.soIndicates that a module should be loaded at the beginning of the module load order. This directive is much less relevant than it used to be; modules now have a load priority built into them that solves the problems that this directive was previously used to solve.
loadchan_sip.soDefines a module that should be loaded. This directive is only relevant if autoload is set to no.
noloadchan_alsa.soDefines a module that should not be loaded. This directive is only relevant if autoload is set to yes.
requirechan_sip.soDoes the same thing as load; additionally, Asterisk will exit if this module fails to load for some reason.
preload-requireres_odbc.soDoes the same thing as preload; additionally, Asterisk will exit if this module fails to load for some reason.