diff options
-rw-r--r-- | CHANGES | 8 | ||||
-rw-r--r-- | apps/app_dial.c | 18 | ||||
-rw-r--r-- | apps/app_voicemail.c | 45 | ||||
-rw-r--r-- | include/asterisk/app.h | 2 | ||||
-rw-r--r-- | include/asterisk/module.h | 2 | ||||
-rw-r--r-- | main/app.c | 4 | ||||
-rw-r--r-- | main/asterisk.c | 8 | ||||
-rw-r--r-- | res/res_mwi_external.c | 13 |
8 files changed, 79 insertions, 21 deletions
@@ -226,6 +226,14 @@ res_pjsip_history information on filtering, view the current CLI help for the 'pjsip show history' command. +Voicemail +------------------ + * app_voicemail and res_mwi_external can now be built together. The default + remains to build app_voicemail and not res_mwi_external but if they are + both built, the load order will cause res_mwi_external to load first and + app_voicemail will be skipped. Use 'preload=app_voicemail.so' in + modules.conf to force app_voicemail to be the voicemail provider. + ------------------------------------------------------------------------------ --- Functionality changes from Asterisk 13.6.0 to Asterisk 13.7.0 ------------ ------------------------------------------------------------------------------ diff --git a/apps/app_dial.c b/apps/app_dial.c index 540f6621c..11591bdfb 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -2151,6 +2151,24 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast return -1; } + if (ast_check_hangup_locked(chan)) { + /* + * Caller hung up before we could dial. If dial is executed + * within an AGI then the AGI has likely eaten all queued + * frames before executing the dial in DeadAGI mode. With + * the caller hung up and no pending frames from the caller's + * read queue, dial would not know that the call has hung up + * until a called channel answers. It is rather annoying to + * whoever just answered the non-existent call. + * + * Dial should not continue execution in DeadAGI mode, hangup + * handlers, or the h exten. + */ + ast_verb(3, "Caller hung up before dial.\n"); + pbx_builtin_setvar_helper(chan, "DIALSTATUS", "CANCEL"); + return -1; + } + parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index f2f7bad64..cd552545e 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -48,7 +48,6 @@ /*** MODULEINFO <defaultenabled>yes</defaultenabled> - <conflict>res_mwi_external</conflict> <use type="module">res_adsi</use> <use type="module">res_smdi</use> <support_level>core</support_level> @@ -14702,10 +14701,14 @@ static int unload_module(void) * * Module loading including tests for configuration or dependencies. * This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, - * or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails - * tests return AST_MODULE_LOAD_FAILURE. If the module can not load the - * configuration file or other non-critical problem return - * AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS. + * or AST_MODULE_LOAD_SUCCESS. + * + * If a dependency, allocation or environment variable fails tests, return AST_MODULE_LOAD_FAILURE. + * + * If the module can't load the configuration file, can't register as a provider or + * has another issue not fatal to Asterisk itself, return AST_MODULE_LOAD_DECLINE. + * + * On success return AST_MODULE_LOAD_SUCCESS. */ static int load_module(void) { @@ -14714,7 +14717,7 @@ static int load_module(void) umask(my_umask); if (!(inprocess_container = ao2_container_alloc(573, inprocess_hash_fn, inprocess_cmp_fn))) { - return AST_MODULE_LOAD_DECLINE; + return AST_MODULE_LOAD_FAILURE; } /* compute the location of the voicemail spool directory */ @@ -14724,8 +14727,10 @@ static int load_module(void) ast_log(AST_LOG_WARNING, "failed to reference mwi subscription taskprocessor. MWI will not work\n"); } - if ((res = load_config(0))) - return res; + if ((res = load_config(0))) { + unload_module(); + return AST_MODULE_LOAD_DECLINE; + } res = ast_register_application_xml(app, vm_exec); res |= ast_register_application_xml(app2, vm_execmain); @@ -14746,10 +14751,26 @@ static int load_module(void) res |= AST_TEST_REGISTER(test_voicemail_vm_info); #endif - res |= ast_vm_register(&vm_table); - res |= ast_vm_greeter_register(&vm_greeter_table); if (res) { - return res; + ast_log(LOG_ERROR, "Failure registering applications, functions or tests\n"); + 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; + } + + /* ast_vm_greeter_register may return DECLINE if another module registered as a greeter */ + res = ast_vm_greeter_register(&vm_greeter_table); + if (res) { + ast_log(LOG_ERROR, "Failure registering as a greeter provider\n"); + unload_module(); + return AST_MODULE_LOAD_DECLINE; } ast_cli_register_multiple(cli_voicemail, ARRAY_LEN(cli_voicemail)); @@ -14762,7 +14783,7 @@ static int load_module(void) ast_realtime_require_field("voicemail", "uniqueid", RQ_UINTEGER3, 11, "password", RQ_CHAR, 10, SENTINEL); ast_realtime_require_field("voicemail_data", "filename", RQ_CHAR, 30, "duration", RQ_UINTEGER3, 5, SENTINEL); - return res; + return AST_MODULE_LOAD_SUCCESS; } static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num, char *outgoing_context) diff --git a/include/asterisk/app.h b/include/asterisk/app.h index 3975fda7d..d86b63338 100644 --- a/include/asterisk/app.h +++ b/include/asterisk/app.h @@ -580,6 +580,7 @@ int ast_vm_is_registered(void); * * \retval 0 on success. * \retval -1 on error. + * \retval AST_MODULE_LOAD_DECLINE if there's already another provider registered. */ int __ast_vm_register(const struct ast_vm_functions *vm_table, struct ast_module *module); @@ -648,6 +649,7 @@ int ast_vm_greeter_is_registered(void); * * \retval 0 on success. * \retval -1 on error. + * \retval AST_MODULE_LOAD_DECLINE if there's already another greeter registered. */ int __ast_vm_greeter_register(const struct ast_vm_greeter_functions *vm_table, struct ast_module *module); diff --git a/include/asterisk/module.h b/include/asterisk/module.h index 9fbeb5ebc..d5616e9d8 100644 --- a/include/asterisk/module.h +++ b/include/asterisk/module.h @@ -68,7 +68,7 @@ enum ast_module_unload_mode { enum ast_module_load_result { AST_MODULE_LOAD_SUCCESS = 0, /*!< Module loaded and configured */ AST_MODULE_LOAD_DECLINE = 1, /*!< Module is not configured */ - AST_MODULE_LOAD_SKIP = 2, /*!< Module was skipped for some reason */ + AST_MODULE_LOAD_SKIP = 2, /*!< Module was skipped for some reason (For loader.c use only. Should never be returned by modules)*/ AST_MODULE_LOAD_PRIORITY = 3, /*!< Module is not loaded yet, but is added to prioity heap */ AST_MODULE_LOAD_FAILURE = -1, /*!< Module could not be loaded properly */ }; diff --git a/main/app.c b/main/app.c index dabf15d37..36330ac11 100644 --- a/main/app.c +++ b/main/app.c @@ -494,7 +494,7 @@ int __ast_vm_register(const struct ast_vm_functions *vm_table, struct ast_module if (table) { ast_log(LOG_WARNING, "Voicemail provider already registered by %s.\n", table->module_name); - return -1; + return AST_MODULE_LOAD_DECLINE; } table = ao2_alloc_options(sizeof(*table), NULL, AO2_ALLOC_OPT_LOCK_NOLOCK); @@ -605,7 +605,7 @@ int __ast_vm_greeter_register(const struct ast_vm_greeter_functions *vm_table, s if (table) { ast_log(LOG_WARNING, "Voicemail greeter provider already registered by %s.\n", table->module_name); - return -1; + return AST_MODULE_LOAD_DECLINE; } table = ao2_alloc_options(sizeof(*table), NULL, AO2_ALLOC_OPT_LOCK_NOLOCK); diff --git a/main/asterisk.c b/main/asterisk.c index 7057b944e..a0b665231 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1,7 +1,7 @@ /* * Asterisk -- An open source telephony toolkit. * - * Copyright (C) 1999 - 2015, Digium, Inc. + * Copyright (C) 1999 - 2016, Digium, Inc. * * Mark Spencer <markster@digium.com> * @@ -53,7 +53,7 @@ * * \section copyright Copyright and Author * - * Copyright (C) 1999 - 2015, Digium, Inc. + * Copyright (C) 1999 - 2016, Digium, Inc. * Asterisk is a <a href="http://www.digium.com/en/company/view-policy.php?id=Trademark-Policy">registered trademark</a> * of <a rel="nofollow" href="http://www.digium.com">Digium, Inc</a>. * @@ -302,7 +302,7 @@ int daemon(int, int); /* defined in libresolv of all places */ /*! \brief Welcome message when starting a CLI interface */ #define WELCOME_MESSAGE \ - ast_verbose("Asterisk %s, Copyright (C) 1999 - 2015, Digium, Inc. and others.\n" \ + ast_verbose("Asterisk %s, Copyright (C) 1999 - 2016, Digium, Inc. and others.\n" \ "Created by Mark Spencer <markster@digium.com>\n" \ "Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.\n" \ "This is free software, with components licensed under the GNU General Public\n" \ @@ -3365,7 +3365,7 @@ static int show_version(void) static int show_cli_help(void) { - printf("Asterisk %s, Copyright (C) 1999 - 2015, Digium, Inc. and others.\n", ast_get_version()); + printf("Asterisk %s, Copyright (C) 1999 - 2016, Digium, Inc. and others.\n", ast_get_version()); printf("Usage: asterisk [OPTIONS]\n"); printf("Valid Options:\n"); printf(" -V Display version number and exit\n"); 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; } |