Review Board 1.7.16

Add a new option "require" to modules.conf to make Asterisk fail if a module does not load

Review Request #426 - Created Nov. 12, 2009 and submitted

Olle E Johansson
If a module for some reason fail to load - compiled with the wrong build system, failure to load required library or something else, then Asterisk currently proceeds, regardless of configuration in modules.conf.

This patch adds "require=<module>" and "preload-require=<module>" but not "noload-require <module>" :-)

If the module doesn't load, Asterisk will print a message to stderr and then exit with the status of 2, so that scripts like safe_asterisk and similar can catch this situation. I don't want my Asterisk to run without chan_sip - AT ALL, which is a reason for this patch.
Tested with preload-require and require on my own development system and some old modules that gives strange load errors and fail to load.

Noticed that logging to ERROR doesn't always get logged, since Asterisk exits, so I added the fprintf(stderr,"....");
Ship it!
Posted (Nov. 12, 2009, 3:46 a.m.)
Looks good by me! The only suggestion I have is a matter of opinion, so if you disagree I certainly understand.
/trunk/main/loader.c (Diff revision 1)
It could be argued that order->required |= required; is a clearer way to express that you are trying to combine the requirement of a module to load.
The only reason I suggest this is that I had to read the lines a few times before the comment above made sense. runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to