Asterisk Error Loading Modules Problem Fix

Introduction

You might face this error when installing Asterisk on Ubuntu where some modules such as app_stack.so, cdr_odbc.so, and others do not load on Asterisk startup. You will learn how a small workaround to fix this problem.

Problem Description

In your Asterisk CLI you might be getting something like this:

[Feb  5 00:39:27] WARNING[5900][C-0000000b]: pbx.c:4869 pbx_extension_helper: No application 'Gosub' for extension (perment, 447599955557, 1)
== Spawn extension (context, XXXXXXXXXX, 1) exited non-zero on 'Local/XXXXXXXXXX@context-0000000b;2'
            

And in the logs under /var/log/asterisk/ you might be getting something like:

[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'cdr_odbc.so': /usr/lib/asterisk/modules/cdr_odbc.so: undefined symbol: SQLRowCount
[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'pbx_ael.so': /usr/lib/asterisk/modules/pbx_ael.so: undefined symbol: ael2_parse
[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'res_config_odbc.so': /usr/lib/asterisk/modules/res_config_odbc.so: undefined symbol: _ast_odbc_request_obj2
[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'chan_agent.so': /usr/lib/asterisk/modules/chan_agent.so: undefined symbol: ast_monitor_start
[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'func_aes.so': /usr/lib/asterisk/modules/func_aes.so: undefined symbol: ast_aes_set_encrypt_key
[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'app_queue.so': /usr/lib/asterisk/modules/app_queue.so: undefined symbol: ast_monitor_start
[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'app_stack.so': /usr/lib/asterisk/modules/app_stack.so: undefined symbol: ast_agi_unregister
[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'res_agi.so': /usr/lib/asterisk/modules/res_agi.so: undefined symbol: ast_speech_change
[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'cel_odbc.so': /usr/lib/asterisk/modules/cel_odbc.so: undefined symbol: SQLColumns
[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'cdr_adaptive_odbc.so': /usr/lib/asterisk/modules/cdr_adaptive_odbc.so: undefined symbol: SQLColumns
[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'app_speech_utils.so': /usr/lib/asterisk/modules/app_speech_utils.so: undefined symbol: ast_speech_dtmf
[Feb  5 00:51:35] WARNING[6202] loader.c: Error loading module 'func_odbc.so': /usr/lib/asterisk/modules/func_odbc.so: undefined symbol: SQLRowCount
            

Fixing the problem

Loading the modules manually:

This problem can be fixed by loading these modules manually after Asterisk starts. This can be done by entering the Asterisk CLI mode with asterisk -rvvv and then running module load {module name}

Example run would be as follows:

server*CLI> module load app_stack.so
Loaded app_stack.so
  == AGI Command 'gosub' registered
  == Registered application 'StackPop'
  == Registered application 'Return'
  == Registered application 'GosubIf'
  == Registered application 'Gosub'
  == Registered custom function 'LOCAL'
  == Registered custom function 'LOCAL_PEEK'
  == Registered custom function 'STACK_PEEK'
 Loaded app_stack.so => (Dialplan subroutines (Gosub, Return, etc))
            

However, with the above fix, you will have to do that every time asterisk starts up or you reboot your server. For a permanent fix you will need to have the modules loaded automatically on startup.

Loading the modules automatically on Asterisk startup:

To fix this problem completely and make sure the modules does not fail to load on startup all you have to do is edit /etc/asterisk/modules.conf to load the res_agi module before autoloading the others because they depend on it.

To do that you should run vim /etc/asterisk/modules.conf and add load => res_agi.so right before the autoload=yes line. Your modules.conf file should start with something like:

[modules]
load => res_agi.so
autoload=yes
            

Conclusion

After the above changes you will have to restart your Asterisk for them to take effect. This can be done by simply running service asterisk restart and you should be good to go.

Resource: https://bugs.launchpad.net/ubuntu/+source/asterisk/+bug/1314058

Try this tutorial on a Cloud VoIP Server.

Includes 512MB RAM, 20GB SSD Disk, and Unlimited Transfer for $20/mo! Learn more