]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Recorded merge of revisions 195370 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 18 May 2009 20:54:29 +0000 (20:54 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 18 May 2009 20:54:29 +0000 (20:54 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

................
  r195370 | tilghman | 2009-05-18 15:52:33 -0500 (Mon, 18 May 2009) | 15 lines

  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)
  ........
................

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

apps/app_queue.c
apps/app_voicemail.c
include/asterisk/monitor.h
include/asterisk/smdi.h
res/res_smdi.c

index 479f8eca1dd79672b5e9d601a49e3b98b44deefb..024aad08ec2da36bfcff83dd6025b707482bf8dd 100644 (file)
@@ -3756,16 +3756,18 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                                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 {
index 286530a0641c1c174ebd5f54fa81c7e1008b878a..f30d802c5e0203b3f61b45e1727f7636581b390e 100644 (file)
@@ -10503,10 +10503,10 @@ static int load_config(int reload)
                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");
index 7f32b699413a270c052402df90761a3facdcdb9d..84d3696178cbc9a30bedf9c9fbec40fbefa2c2ff 100644 (file)
@@ -51,21 +51,21 @@ struct ast_channel_monitor {
 
 /* 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);
+                     const char *fname_base, int need_lock, int stream_action) attribute_weak;
 
 /* Stop monitoring a channel */
-int ast_monitor_stop(struct ast_channel *chan, int need_lock);
+int ast_monitor_stop(struct ast_channel *chan, int need_lock) attribute_weak;
 
 /* Change monitoring filename of a channel */
 int ast_monitor_change_fname(struct ast_channel *chan,
-                            const char *fname_base, int need_lock);
+                            const char *fname_base, int need_lock) attribute_weak;
 
-void ast_monitor_setjoinfiles(struct ast_channel *chan, int turnon);
+void ast_monitor_setjoinfiles(struct ast_channel *chan, int turnon) attribute_weak;
 
 /* Pause monitoring of a channel */
-int ast_monitor_pause(struct ast_channel *chan);
+int ast_monitor_pause(struct ast_channel *chan) attribute_weak;
 
 /* Unpause monitoring of a channel */
-int ast_monitor_unpause(struct ast_channel *chan);
+int ast_monitor_unpause(struct ast_channel *chan) attribute_weak;
 
 #endif /* _ASTERISK_MONITOR_H */
index 8f098abdd5c9e1161263b8ecfc5bc91c4d302c71..1351226af3a0e6a5e554cf41e1ac3ca149c4dcc7 100644 (file)
@@ -84,7 +84,7 @@ struct ast_smdi_md_message {
  */
 struct ast_smdi_interface;
 
-void ast_smdi_interface_unref(struct ast_smdi_interface *iface);
+void ast_smdi_interface_unref(struct ast_smdi_interface *iface) attribute_weak;
 
 /*! 
  * \brief Get the next SMDI message from the queue.
@@ -96,7 +96,7 @@ void ast_smdi_interface_unref(struct ast_smdi_interface *iface);
  *
  * \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);
+struct ast_smdi_md_message *ast_smdi_md_message_pop(struct ast_smdi_interface *iface) attribute_weak;
 
 /*!
  * \brief Get the next SMDI message from the queue.
@@ -110,7 +110,7 @@ struct ast_smdi_md_message *ast_smdi_md_message_pop(struct ast_smdi_interface *i
  * \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);
+struct ast_smdi_md_message *ast_smdi_md_message_wait(struct ast_smdi_interface *iface, int timeout) attribute_weak;
 
 /*!
  * \brief Put an SMDI message back in the front of the queue.
@@ -121,7 +121,7 @@ struct ast_smdi_md_message *ast_smdi_md_message_wait(struct ast_smdi_interface *
  * 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);
+void ast_smdi_md_message_putback(struct ast_smdi_interface *iface, struct ast_smdi_md_message *msg) attribute_weak;
 
 /*!
  * \brief Get the next SMDI message from the queue.
@@ -133,7 +133,7 @@ void ast_smdi_md_message_putback(struct ast_smdi_interface *iface, struct ast_sm
  *
  * \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);
+struct ast_smdi_mwi_message *ast_smdi_mwi_message_pop(struct ast_smdi_interface *iface) attribute_weak;
 
 /*!
  * \brief Get the next SMDI message from the queue.
@@ -147,9 +147,9 @@ struct ast_smdi_mwi_message *ast_smdi_mwi_message_pop(struct ast_smdi_interface
  * \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(struct ast_smdi_interface *iface, int timeout) attribute_weak;
 struct ast_smdi_mwi_message *ast_smdi_mwi_message_wait_station(struct ast_smdi_interface *iface, 
-       int timeout, const char *station);
+       int timeout, const char *station) attribute_weak;
 
 /*!
  * \brief Put an SMDI message back in the front of the queue.
@@ -160,7 +160,7 @@ struct ast_smdi_mwi_message *ast_smdi_mwi_message_wait_station(struct ast_smdi_i
  * 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);
+void ast_smdi_mwi_message_putback(struct ast_smdi_interface *iface, struct ast_smdi_mwi_message *msg) attribute_weak;
 
 /*!
  * \brief Find an SMDI interface with the specified name.
@@ -170,26 +170,26 @@ void ast_smdi_mwi_message_putback(struct ast_smdi_interface *iface, struct ast_s
  * 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);
+struct ast_smdi_interface *ast_smdi_interface_find(const char *iface_name) attribute_weak;
 
 /*!
  * \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);
+int ast_smdi_mwi_set(struct ast_smdi_interface *iface, const char *mailbox) attribute_weak;
 
 /*! 
  * \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);
+int ast_smdi_mwi_unset(struct ast_smdi_interface *iface, const char *mailbox) attribute_weak;
 
 /*! \brief ast_smdi_md_message destructor. */
-void ast_smdi_md_message_destroy(struct ast_smdi_md_message *msg);
+void ast_smdi_md_message_destroy(struct ast_smdi_md_message *msg) attribute_weak;
 
 /*! \brief ast_smdi_mwi_message destructor. */
-void ast_smdi_mwi_message_destroy(struct ast_smdi_mwi_message *msg);
+void ast_smdi_mwi_message_destroy(struct ast_smdi_mwi_message *msg) attribute_weak;
 
 #endif /* !ASTERISK_SMDI_H */
index 76f61fc5b815e16b0a722ed1f1b7fc8a2b59136b..53f174b3cca7166a0937162c379fb34eabbecd70 100644 (file)
@@ -1332,6 +1332,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;
@@ -1349,8 +1351,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_NOTICE, "No SMDI interfaces are available to listen on, not starting SMDI listener.\n");
                return AST_MODULE_LOAD_DECLINE;
        }