};
/*!
+ * \brief Determine if a voicemail provider is registered.
+ * \since 13.0.0
+ *
+ * \retval 0 if no privider registered.
+ * \retval 1 if a privider is registered.
+ */
+int ast_vm_is_registered(void);
+
+/*!
* \brief Set voicemail function callbacks
*
* \param vm_table Voicemail function table to install.
/*! Voicemail not registered warning */
static int vm_warnings;
+int ast_vm_is_registered(void)
+{
+ struct ast_vm_functions *table;
+ int is_registered;
+
+ table = ao2_global_obj_ref(vm_provider);
+ is_registered = table ? 1 : 0;
+ ao2_cleanup(table);
+ return is_registered;
+}
+
int __ast_vm_register(const struct ast_vm_functions *vm_table, struct ast_module *module)
{
RAII_VAR(struct ast_vm_functions *, table, NULL, ao2_cleanup);
* envelope files on the file system
*/
#define VM_API_TEST_SETUP do { \
- if (test_vm_api_test_setup()) { \
+ if (!ast_vm_is_registered()) { \
+ ast_test_status_update(test, "No voicemail provider registered.\n"); \
+ return AST_TEST_FAIL; \
+ } else if (test_vm_api_test_setup()) { \
VM_API_TEST_CLEANUP; \
ast_test_status_update(test, "Failed to set up necessary mock objects for voicemail API test\n"); \
return AST_TEST_FAIL; \