]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add a similar dependency on SMDI for voicemail as already exists for ADSI.
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 18 May 2009 20:24:13 +0000 (20:24 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 18 May 2009 20:24:13 +0000 (20:24 +0000)
(closes issue #14846)
 Reported by: pj
 Patches:
       20090413__bug14846__1.4.diff.txt uploaded by tilghman (license 14)
       20090507__issue14846__1.6.0.diff.txt uploaded by tilghman (license 14)
       20090507__issue14846__1.6.1.diff.txt uploaded by tilghman (license 14)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@195366 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c
res/res_smdi.c

index f3e423ec1c19fe35896265f695dbc523a4e856b4..0509559bb377a8c8bfa9eb143ea9c41307ec7ce6 100644 (file)
@@ -8862,7 +8862,10 @@ static int load_module(void)
 {
        int res;
        char *adsi_loaded = ast_module_helper("", "res_adsi.so", 0, 0, 0, 0);
+       char *smdi_loaded = ast_module_helper("", "res_smdi.so", 0, 0, 0, 0);
        free(adsi_loaded);
+       free(smdi_loaded);
+
        if (!adsi_loaded) {
                /* If embedded, res_adsi may be known as "res_adsi" not "res_adsi.so" */
                adsi_loaded = ast_module_helper("", "res_adsi", 0, 0, 0, 0);
@@ -8873,6 +8876,16 @@ static int load_module(void)
                }
        }
 
+       if (!smdi_loaded) {
+               /* If embedded, res_smdi may be known as "res_smdi" not "res_smdi.so" */
+               smdi_loaded = ast_module_helper("", "res_smdi", 0, 0, 0, 0);
+               ast_free(smdi_loaded);
+               if (!smdi_loaded) {
+                       ast_log(LOG_ERROR, "app_voicemail.so depends upon res_smdi.so\n");
+                       return AST_MODULE_LOAD_DECLINE;
+               }
+       }
+
        my_umask = umask(0);
        umask(my_umask);
        res = ast_register_application(app, vm_exec, synopsis_vm, descrip_vm);
index e3da188c982dce2f151facea5e3a59cf66b1ed1c..4c942772025044ff2b0fd41a8c228cc1c88a9b42 100644 (file)
@@ -1337,6 +1337,8 @@ static struct ast_custom_function smdi_msg_function = {
        .read = smdi_msg_read,
 };
 
+static int unload_module(void);
+
 static int load_module(void)
 {
        int res;
@@ -1354,8 +1356,10 @@ static int load_module(void)
        /* load the config and start the listener threads*/
        res = smdi_load(0);
        if (res < 0) {
+               unload_module();
                return res;
        } else if (res == 1) {
+               unload_module();
                ast_log(LOG_WARNING, "No SMDI interfaces are available to listen on, not starting SMDI listener.\n");
                return AST_MODULE_LOAD_DECLINE;
        }