Asterisk tutorial: Loading modules

Содержание

In this post, you will find information that will tell you how to load, reload or remove specific modules. You will also learn how they are grouped and how to add additional modules.

1) Initial informations

At the beginning it is worth mentioning where we can find the configuration files and directories related to the module configuration. If you have installed Asterisk to the default directories, you should find the following files:

  • /etc/asterisk/modules.conf module configuration file
  • /usr/lib/asterisk/modulues modules directory

If you installed the control panel using our installer, the folder for 64-bit systems with modules will be /usr/lib64/asterisk/modules .

The modules themselves are divided into the following categories:

  • Applications
  • Bridging
  • Call Detail Records
  • Channel Drivers
  • Codecs
  • Formats
  • Functions
  • Core/PBX
  • Resources

If you cannot find the file modules.conf , try executing:

In the middle of the modules directory, you should find a ton of files with a .so extension. Since they were generated by our installer, it should be possible to load each of them.

2) Using ‘autoload=yes’

The easiest way to load all available modules is to use autoload. This can be done in modules.conf .

Instead of manually editing /etc/asterisk/modules.conf , you can also do this:

However, automatically loading all modules with autoload = yes has some consequences. If any of the modules has not been properly loaded, the CLI will start throwing a lot of errors.

For example, if you created only basic files using make basic-pbx , and then turn on autoload = yes , you will see a lot of errors, e.g.

  • if you want to use autoload=yes ,
  • you have configured the required configuration files,
  • but you still get errors with modules you are not using

you may use noload , to skip loading chosen modules.

The example configuration prompts, for example, to disable the res_hep modules.

If you want to limit the number of errors thrown by Asterisk created with make basic-pbx , just create (even empty) files that are missing or you can copy sample files.

If you don’t have the sample files (generated by make samples during installation), you can follow this post to see how to generate these files.

3) Manually loading modules with ‘autoload=no’

I think a great starting point is to use the modules.conf file generated by make basic-pbx .

Inside of the file, you’ll notice that oposite rules apply. By default, no modules are loaded and must be added manually. In the mentioned file you will notice that the modules are divided into 9 categories. Each of them corresponds to what was available when installing the control panel in make menuselect .

Loading a misconfigures module will throw an error, but Asterisk will turn on normally. If you prefer to keep Asterisk inactive when a specific module fails, you can use require as shown below.

4) Examples of additional modules

Although basic PBX includes everything you need to run an Asterisk with basic functionality, you may want to load additional modules. Below we will discuss how to add some of them.


Источник: hotkey404.com