summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2015-12-30 09:49:03 -0700
committerGeorge Joseph <george.joseph@fairview5.com>2016-01-04 17:31:24 -0600
commit6d18fe151c0e88924737c8b7a986a7278fd120bc (patch)
tree2aae54dfd57384a4d71424034ee568be9c7cef68 /res
parent839f328601ff0a98a6c6b4fb6ca73445f264588f (diff)
voicemail: Move app_voicemail / res_mwi_external conflict to runtime
The menuselect conflict between app_voicemail and res_mwi_external makes it hard to package 1 version of Asterisk. There no actual build dependencies between the 2 so moving this check to runtime seems like a better solution. The ast_vm_register and ast_vm_greeter_register functions in app.c were modified to return AST_MODULE_LOAD_DECLINE instead of -1 if there is already a voicemail module registered. The modules' load_module functions were then modified to return DECLINE instead of -1 to the loader. Since -1 is interpreted by the loader as AST_MODULE_LOAD_FAILURE, the modules were incorrectly causing Asterisk to stop so this needed to be cleaned up anyway. Now you can build both and use modules.conf to decide which voicemail implementation to load. The default menuselect options still build app_voicemail and not res_mwi_external but if both ARE built, res_mwi_external will load first and become the voicemail provider unless modules.conf rules prevent it. This is noted in CHANGES. Change-Id: I7d98d4e8a3b87b8df9e51c2608f0da6ddfb89247
Diffstat (limited to 'res')
-rw-r--r--res/res_mwi_external.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/res/res_mwi_external.c b/res/res_mwi_external.c
index 97228220f..3499885a5 100644
--- a/res/res_mwi_external.c
+++ b/res/res_mwi_external.c
@@ -33,7 +33,6 @@
/*** MODULEINFO
<defaultenabled>no</defaultenabled>
- <conflict>app_voicemail</conflict>
<support_level>core</support_level>
***/
@@ -935,12 +934,22 @@ static int unload_module(void)
static int load_module(void)
{
+ int res;
+
if (mwi_sorcery_init()
|| ast_sorcery_observer_add(mwi_sorcery, MWI_MAILBOX_TYPE, &mwi_observers)
#if defined(MWI_DEBUG_CLI)
|| ast_cli_register_multiple(mwi_cli, ARRAY_LEN(mwi_cli))
#endif /* defined(MWI_DEBUG_CLI) */
- || ast_vm_register(&vm_table)) {
+ ) {
+ unload_module();
+ return AST_MODULE_LOAD_DECLINE;
+ }
+
+ /* ast_vm_register may return DECLINE if another module registered for vm */
+ res = ast_vm_register(&vm_table);
+ if (res) {
+ ast_log(LOG_ERROR, "Failure registering as a voicemail provider\n");
unload_module();
return AST_MODULE_LOAD_DECLINE;
}