[asterisk-commits] tilghman: trunk r195370 - in /trunk: ./ apps/ include/asterisk/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 18 15:52:38 CDT 2009
Author: tilghman
Date: Mon May 18 15:52:33 2009
New Revision: 195370
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=195370
Log:
Recorded merge of revisions 195366 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r195366 | tilghman | 2009-05-18 15:24:13 -0500 (Mon, 18 May 2009) | 8 lines
Add a similar dependency on SMDI for voicemail as already exists for ADSI.
(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)
........
Modified:
trunk/ (props changed)
trunk/apps/app_queue.c
trunk/apps/app_voicemail.c
trunk/include/asterisk/monitor.h
trunk/include/asterisk/smdi.h
trunk/res/res_monitor.c
trunk/res/res_smdi.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_queue.c?view=diff&rev=195370&r1=195369&r2=195370
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Mon May 18 15:52:33 2009
@@ -4092,16 +4092,18 @@
else
which = peer;
ast_channel_unlock(qe->chan);
- if (monitorfilename)
- ast_monitor_start(which, qe->parent->monfmt, monitorfilename, 1, X_REC_IN | X_REC_OUT);
- else if (qe->chan->cdr)
- ast_monitor_start(which, qe->parent->monfmt, qe->chan->cdr->uniqueid, 1, X_REC_IN | X_REC_OUT);
- else {
- /* Last ditch effort -- no CDR, make up something */
- snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
- ast_monitor_start(which, qe->parent->monfmt, tmpid, 1, X_REC_IN | X_REC_OUT);
+ if (ast_monitor_start) {
+ if (monitorfilename) {
+ ast_monitor_start(which, qe->parent->monfmt, monitorfilename, 1, X_REC_IN | X_REC_OUT);
+ } else if (qe->chan->cdr && ast_monitor_start) {
+ ast_monitor_start(which, qe->parent->monfmt, qe->chan->cdr->uniqueid, 1, X_REC_IN | X_REC_OUT);
+ } else if (ast_monitor_start) {
+ /* Last ditch effort -- no CDR, make up something */
+ snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
+ ast_monitor_start(which, qe->parent->monfmt, tmpid, 1, X_REC_IN | X_REC_OUT);
+ }
}
- if (!ast_strlen_zero(monexec)) {
+ if (!ast_strlen_zero(monexec) && ast_monitor_setjoinfiles) {
ast_monitor_setjoinfiles(which, 1);
}
} else {
Modified: trunk/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=195370&r1=195369&r2=195370
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Mon May 18 15:52:33 2009
@@ -10687,10 +10687,10 @@
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");
Modified: trunk/include/asterisk/monitor.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/include/asterisk/monitor.h?view=diff&rev=195370&r1=195369&r2=195370
==============================================================================
--- trunk/include/asterisk/monitor.h (original)
+++ trunk/include/asterisk/monitor.h Mon May 18 15:52:33 2009
@@ -24,6 +24,7 @@
#define _ASTERISK_MONITOR_H
#include "asterisk/channel.h"
+#include "asterisk/optional_api.h"
enum AST_MONITORING_STATE {
AST_MONITOR_RUNNING,
@@ -50,22 +51,27 @@
};
/* Start monitoring a channel */
-int ast_monitor_start(struct ast_channel *chan, const char *format_spec,
- const char *fname_base, int need_lock, int stream_action);
+AST_OPTIONAL_API(int, ast_monitor_start, (struct ast_channel *chan, const char
+ *format_spec, const char *fname_base, int need_lock, int stream_action),
+ { return -1; });
/* Stop monitoring a channel */
-int ast_monitor_stop(struct ast_channel *chan, int need_lock);
+AST_OPTIONAL_API(int, ast_monitor_stop, (struct ast_channel *chan, int
+ need_lock), { return -1; });
/* Change monitoring filename of a channel */
-int ast_monitor_change_fname(struct ast_channel *chan,
- const char *fname_base, int need_lock);
+AST_OPTIONAL_API(int, ast_monitor_change_fname, (struct ast_channel *chan,
+ const char *fname_base, int need_lock), { return -1; });
-void ast_monitor_setjoinfiles(struct ast_channel *chan, int turnon);
+AST_OPTIONAL_API(void, ast_monitor_setjoinfiles, (struct ast_channel *chan,
+ int turnon), { return; });
/* Pause monitoring of a channel */
-int ast_monitor_pause(struct ast_channel *chan);
+AST_OPTIONAL_API(int, ast_monitor_pause, (struct ast_channel *chan),
+ { return -1; });
/* Unpause monitoring of a channel */
-int ast_monitor_unpause(struct ast_channel *chan);
+AST_OPTIONAL_API(int, ast_monitor_unpause, (struct ast_channel *chan),
+ { return -1; });
#endif /* _ASTERISK_MONITOR_H */
Modified: trunk/include/asterisk/smdi.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/include/asterisk/smdi.h?view=diff&rev=195370&r1=195369&r2=195370
==============================================================================
--- trunk/include/asterisk/smdi.h (original)
+++ trunk/include/asterisk/smdi.h Mon May 18 15:52:33 2009
@@ -37,6 +37,7 @@
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/astobj.h"
+#include "asterisk/optional_api.h"
#define SMDI_MESG_DESK_NUM_LEN 3
#define SMDI_MESG_DESK_TERM_LEN 4
@@ -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,8 @@
* 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 +138,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 +153,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 +168,8 @@
* 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 +179,31 @@
* 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 */
Modified: trunk/res/res_monitor.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/res/res_monitor.c?view=diff&rev=195370&r1=195369&r2=195370
==============================================================================
--- trunk/res/res_monitor.c (original)
+++ trunk/res/res_monitor.c Mon May 18 15:52:33 2009
@@ -38,6 +38,7 @@
#include "asterisk/module.h"
#include "asterisk/manager.h"
#include "asterisk/cli.h"
+#define AST_API_MODULE
#include "asterisk/monitor.h"
#include "asterisk/app.h"
#include "asterisk/utils.h"
Modified: trunk/res/res_smdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/res/res_smdi.c?view=diff&rev=195370&r1=195369&r2=195370
==============================================================================
--- trunk/res/res_smdi.c (original)
+++ trunk/res/res_smdi.c Mon May 18 15:52:33 2009
@@ -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"
@@ -1332,6 +1333,8 @@
.read = smdi_msg_read,
};
+static int unload_module(void);
+
static int load_module(void)
{
int res;
@@ -1349,8 +1352,10 @@
/* 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_NOTICE, "No SMDI interfaces are available to listen on, not starting SMDI listener.\n");
return AST_MODULE_LOAD_DECLINE;
}
More information about the asterisk-commits
mailing list