Index: apps/app_voicemail.c
===================================================================
--- apps/app_voicemail.c (revision 187763)
+++ apps/app_voicemail.c (working copy)
@@ -40,10 +40,6 @@
* with a plan to clean this up.
*/
-/*** MODULEINFO
- res_smdi
- ***/
-
/*** MAKEOPTS
@@ -10619,14 +10615,16 @@
if ((val = ast_variable_retrieve(cfg, "general", "smdienable")) && ast_true(val)) {
ast_debug(1, "Enabled SMDI voicemail notification\n");
if ((val = ast_variable_retrieve(cfg, "general", "smdiport"))) {
- smdi_iface = ast_smdi_interface_find(val);
+ smdi_iface = ast_smdi_interface_find ? ast_smdi_interface_find(val) : NULL;
} else {
ast_debug(1, "No SMDI interface set, trying default (/dev/ttyS0)\n");
- smdi_iface = ast_smdi_interface_find("/dev/ttyS0");
+ smdi_iface = ast_smdi_interface_find ? ast_smdi_interface_find("/dev/ttyS0") : NULL;
}
if (!smdi_iface) {
ast_log(AST_LOG_ERROR, "No valid SMDI interface specfied, disabling SMDI voicemail notification\n");
}
+ } else {
+ smdi_iface = NULL;
}
/* Silence treshold */
Index: include/asterisk/smdi.h
===================================================================
--- include/asterisk/smdi.h (revision 187763)
+++ include/asterisk/smdi.h (working copy)
@@ -34,6 +34,7 @@
#include
#include
+#include "asterisk/optional_api.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/astobj.h"
@@ -84,7 +85,8 @@
*/
struct ast_smdi_interface;
-void ast_smdi_interface_unref(struct ast_smdi_interface *iface);
+AST_OPTIONAL_API(void, ast_smdi_interface_unref, (struct ast_smdi_interface *iface),
+ { return; });
/*!
* \brief Get the next SMDI message from the queue.
@@ -96,7 +98,8 @@
*
* \return the next SMDI message, or NULL if there were no pending messages.
*/
-struct ast_smdi_md_message *ast_smdi_md_message_pop(struct ast_smdi_interface *iface);
+AST_OPTIONAL_API(struct ast_smdi_md_message *, ast_smdi_md_message_pop,
+ (struct ast_smdi_interface *iface), { return NULL; });
/*!
* \brief Get the next SMDI message from the queue.
@@ -110,7 +113,8 @@
* \return the next SMDI message, or NULL if there were no pending messages and
* the timeout has expired.
*/
-struct ast_smdi_md_message *ast_smdi_md_message_wait(struct ast_smdi_interface *iface, int timeout);
+AST_OPTIONAL_API(struct ast_smdi_md_message *, ast_smdi_md_message_wait,
+ (struct ast_smdi_interface *iface, int timeout), { return NULL; });
/*!
* \brief Put an SMDI message back in the front of the queue.
@@ -121,7 +125,9 @@
* should be used if a message was popped but is not going to be processed for
* some reason, and the message needs to be returned to the queue.
*/
-void ast_smdi_md_message_putback(struct ast_smdi_interface *iface, struct ast_smdi_md_message *msg);
+AST_OPTIONAL_API(void, ast_smdi_md_message_putback,
+ (struct ast_smdi_interface *iface, struct ast_smdi_md_message *msg),
+ { return; });
/*!
* \brief Get the next SMDI message from the queue.
@@ -133,7 +139,8 @@
*
* \return the next SMDI message, or NULL if there were no pending messages.
*/
-struct ast_smdi_mwi_message *ast_smdi_mwi_message_pop(struct ast_smdi_interface *iface);
+AST_OPTIONAL_API(struct ast_smdi_mwi_message *, ast_smdi_mwi_message_pop,
+ (struct ast_smdi_interface *iface), { return NULL; });
/*!
* \brief Get the next SMDI message from the queue.
@@ -147,9 +154,11 @@
* \return the next SMDI message, or NULL if there were no pending messages and
* the timeout has expired.
*/
-struct ast_smdi_mwi_message *ast_smdi_mwi_message_wait(struct ast_smdi_interface *iface, int timeout);
-struct ast_smdi_mwi_message *ast_smdi_mwi_message_wait_station(struct ast_smdi_interface *iface,
- int timeout, const char *station);
+AST_OPTIONAL_API(struct ast_smdi_mwi_message *, ast_smdi_mwi_message_wait,
+ (struct ast_smdi_interface *iface, int timeout), { return NULL; });
+AST_OPTIONAL_API(struct ast_smdi_mwi_message *, ast_smdi_mwi_message_wait_station,
+ (struct ast_smdi_interface *iface, int timeout, const char *station),
+ { return NULL; });
/*!
* \brief Put an SMDI message back in the front of the queue.
@@ -160,7 +169,9 @@
* should be used if a message was popped but is not going to be processed for
* some reason, and the message needs to be returned to the queue.
*/
-void ast_smdi_mwi_message_putback(struct ast_smdi_interface *iface, struct ast_smdi_mwi_message *msg);
+AST_OPTIONAL_API(void, ast_smdi_mwi_message_putback,
+ (struct ast_smdi_interface *iface, struct ast_smdi_mwi_message *msg),
+ { return; });
/*!
* \brief Find an SMDI interface with the specified name.
@@ -170,26 +181,32 @@
* actually returns an ASTOBJ reference and should be released using
* #ASTOBJ_UNREF(iface, ast_smdi_interface_destroy).
*/
-struct ast_smdi_interface *ast_smdi_interface_find(const char *iface_name);
+AST_OPTIONAL_API(struct ast_smdi_interface *, ast_smdi_interface_find,
+ (const char *iface_name), { return NULL; });
/*!
* \brief Set the MWI indicator for a mailbox.
* \param iface the interface to use.
* \param mailbox the mailbox to use.
*/
-int ast_smdi_mwi_set(struct ast_smdi_interface *iface, const char *mailbox);
+AST_OPTIONAL_API(int, ast_smdi_mwi_set,
+ (struct ast_smdi_interface *iface, const char *mailbox),
+ { return -1; });
/*!
* \brief Unset the MWI indicator for a mailbox.
* \param iface the interface to use.
* \param mailbox the mailbox to use.
*/
-int ast_smdi_mwi_unset(struct ast_smdi_interface *iface, const char *mailbox);
+AST_OPTIONAL_API(int, ast_smdi_mwi_unset,
+ (struct ast_smdi_interface *iface, const char *mailbox), { return -1; });
/*! \brief ast_smdi_md_message destructor. */
-void ast_smdi_md_message_destroy(struct ast_smdi_md_message *msg);
+AST_OPTIONAL_API(void, ast_smdi_md_message_destroy,
+ (struct ast_smdi_md_message *msg), { return; });
/*! \brief ast_smdi_mwi_message destructor. */
-void ast_smdi_mwi_message_destroy(struct ast_smdi_mwi_message *msg);
+AST_OPTIONAL_API(void, ast_smdi_mwi_message_destroy,
+ (struct ast_smdi_mwi_message *msg), { return; });
#endif /* !ASTERISK_SMDI_H */
Index: res/res_smdi.c
===================================================================
--- res/res_smdi.c (revision 187763)
+++ res/res_smdi.c (working copy)
@@ -43,6 +43,7 @@
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/utils.h"
+#define AST_API_MODULE
#include "asterisk/smdi.h"
#include "asterisk/config.h"
#include "asterisk/astobj.h"