The voicemail module of our Asterisk server suddenly stopped working after an update which prompted a barrage of reports from the end users. Of course, like what any good Geekysaur would do, we did what we do best — find a solution!
First things first, the Asterisk full log. We are looking for any mention of “VoiceMail” and found No application 'VoiceMail' for extension (macro-vm, s-BUSY, 3). This tells us that the VoiceMail module is probably not loaded.
Next, let’s try loading the module!
module load app_voicemail.so # This could be any app you're having an issue with.
After trying to load the module, we were faced with the following error:
WARNING: loader.c:876 inspect_module: Module 'app_voicemail.so' was not compiled with the same compile-time options as this version of Asterisk.
WARNING: loader.c:877 inspect_module: Module 'app_voicemail.so' will not be initialized as it may cause instability.
WARNING: loader.c:967 load_resource: Module 'app_voicemail.so' could not be loaded.
Again, this could be any application file and is not specific to app_voicemail.so.
What does this tell us? It looks like the update caused an issue with the compiled applications which means we may have to re-compile the modules.
How do we do this? Read on! Note that this only works for compiled Asterisk installations and ./configure, make menuselect, and make SHOULD have previously been done on this directory.
- Go to the directory where the source code for your compiled Asterisk server is. For me, it was in cd /usr/src/asterisk-11.11.0.
- Go to the cd apps directory.
- Find and edit the offending application C file. In my case, since I was having issues with app_voicemail.so, I edited app_voicemail.c.
- Add the following to the top of your C file:
Vim123#ifndef AST_MODULE#define AST_MODULE "app_voicemail" # Change this with your own.#endif
- Then let’s recompile the module using this command:
Shell1gcc -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -Iinclude -I../include -D_REENTRANT -D_GNU_SOURCE -O6 -march=i686 -fomit-frame-pointer -Wno-missing-prototypes -Wno-missing-declarations -DCRYPTO -fPIC -c -o app_voicemail.o app_voicemail.c
Again, change app_voicemail.o and app_voicemail.c with your own.
- Now, let’s link the objects! DO NOT FORGET this step!
Shell1gcc -shared -Xlinker -x -o app_voicemail.so app_voicemail.o
I’d like to say, don’t forget to change app_voicemail.x with your own, but you know that already!
That’s it! That’s all you need to do to recompile an Asterisk module. Now we just have to run module load app_voicemail.so again like mentioned earlier and it would be working like a charm!
How did it go for you? Did this help? Did you do anything different or added some steps to make this better? Hit up your fellow Geekysaurs in the comments below!