[asterisk-commits] rmudgett: branch rmudgett/external_mwi r403704 - in /team/rmudgett/external_m...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Dec 12 13:07:33 CST 2013
Author: rmudgett
Date: Thu Dec 12 13:07:26 2013
New Revision: 403704
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=403704
Log:
chan_dahdi: Add mwi_vm_boxes option to be compatible with older chan_dahdi.conf files.
Modified:
team/rmudgett/external_mwi/CHANGES
team/rmudgett/external_mwi/UPGRADE.txt
team/rmudgett/external_mwi/channels/chan_dahdi.c
team/rmudgett/external_mwi/channels/sig_pri.c
team/rmudgett/external_mwi/channels/sig_pri.h
team/rmudgett/external_mwi/configs/chan_dahdi.conf.sample
Modified: team/rmudgett/external_mwi/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/external_mwi/CHANGES?view=diff&rev=403704&r1=403703&r2=403704
==============================================================================
--- team/rmudgett/external_mwi/CHANGES (original)
+++ team/rmudgett/external_mwi/CHANGES Thu Dec 12 13:07:26 2013
@@ -67,6 +67,13 @@
-------------------------
* A new function, MIXMONITOR, has been added to allow access to individual
instances of MixMonitor on a channel.
+
+Channel Drivers
+------------------
+
+chan_dahdi
+------------------
+ * Added mwi_vm_boxes that also must be configured for ISDN MWI to be enabled.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 11 to Asterisk 12 --------------------
Modified: team/rmudgett/external_mwi/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/external_mwi/UPGRADE.txt?view=diff&rev=403704&r1=403703&r2=403704
==============================================================================
--- team/rmudgett/external_mwi/UPGRADE.txt (original)
+++ team/rmudgett/external_mwi/UPGRADE.txt Thu Dec 12 13:07:26 2013
@@ -26,6 +26,13 @@
system as mailbox at context. app_voicemail no longer assumes @default for
mailbox identifiers that do not specify a context.
+Channel Drivers
+------------------
+
+chan_dahdi
+------------------
+ * Added mwi_vm_boxes that also must be configured for ISDN MWI to be enabled.
+
===========================================================
===========================================================
Modified: team/rmudgett/external_mwi/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/external_mwi/channels/chan_dahdi.c?view=diff&rev=403704&r1=403703&r2=403704
==============================================================================
--- team/rmudgett/external_mwi/channels/chan_dahdi.c (original)
+++ team/rmudgett/external_mwi/channels/chan_dahdi.c Thu Dec 12 13:07:26 2013
@@ -17663,6 +17663,9 @@
} else if (!strcasecmp(v->name, "mwi_mailboxes")) {
ast_copy_string(confp->pri.pri.mwi_mailboxes, v->value,
sizeof(confp->pri.pri.mwi_mailboxes));
+ } else if (!strcasecmp(v->name, "mwi_vm_boxes")) {
+ ast_copy_string(confp->pri.pri.mwi_vm_boxes, v->value,
+ sizeof(confp->pri.pri.mwi_vm_boxes));
} else if (!strcasecmp(v->name, "mwi_vm_numbers")) {
ast_copy_string(confp->pri.pri.mwi_vm_numbers, v->value,
sizeof(confp->pri.pri.mwi_vm_numbers));
Modified: team/rmudgett/external_mwi/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/external_mwi/channels/sig_pri.c?view=diff&rev=403704&r1=403703&r2=403704
==============================================================================
--- team/rmudgett/external_mwi/channels/sig_pri.c (original)
+++ team/rmudgett/external_mwi/channels/sig_pri.c Thu Dec 12 13:07:26 2013
@@ -8845,25 +8845,25 @@
*
* \param pri PRI span control structure.
* \param vm_number Voicemail controlling number (NULL if not present).
+ * \param vm_box Voicemail mailbox number
* \param mbox_id Mailbox id
- * \param mbox_number Mailbox number
* \param num_messages Number of messages waiting.
*
* \return Nothing
*/
-static void sig_pri_send_mwi_indication(struct sig_pri_span *pri, const char *vm_number, const char *mbox_id, const char *mbox_number, int num_messages)
+static void sig_pri_send_mwi_indication(struct sig_pri_span *pri, const char *vm_number, const char *vm_box, const char *mbox_id, int num_messages)
{
struct pri_party_id voicemail;
struct pri_party_id mailbox;
ast_debug(1, "Send MWI indication for %s(%s) vm_number:%s num_messages:%d\n",
- mbox_id, mbox_number, S_OR(vm_number, "<not-present>"), num_messages);
+ vm_box, mbox_id, S_OR(vm_number, "<not-present>"), num_messages);
memset(&mailbox, 0, sizeof(mailbox));
mailbox.number.valid = 1;
mailbox.number.presentation = PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
mailbox.number.plan = (PRI_TON_UNKNOWN << 4) | PRI_NPI_UNKNOWN;
- ast_copy_string(mailbox.number.str, mbox_number, sizeof(mailbox.number.str));
+ ast_copy_string(mailbox.number.str, vm_box, sizeof(mailbox.number.str));
memset(&voicemail, 0, sizeof(voicemail));
voicemail.number.valid = 1;
@@ -8918,7 +8918,7 @@
if (!strcmp(pri->mbox[idx].uniqueid, mwi_state->uniqueid)) {
/* Found the mailbox. */
sig_pri_send_mwi_indication(pri, pri->mbox[idx].vm_number,
- pri->mbox[idx].uniqueid, pri->mbox[idx].number, mwi_state->new_msgs);
+ pri->mbox[idx].vm_box, pri->mbox[idx].uniqueid, mwi_state->new_msgs);
break;
}
}
@@ -8955,8 +8955,8 @@
}
mwi_state = stasis_message_data(msg);
- sig_pri_send_mwi_indication(pri, pri->mbox[idx].vm_number,
- pri->mbox[idx].uniqueid, pri->mbox[idx].number, mwi_state->new_msgs);
+ sig_pri_send_mwi_indication(pri, pri->mbox[idx].vm_number, pri->mbox[idx].vm_box,
+ pri->mbox[idx].uniqueid, mwi_state->new_msgs);
}
}
#endif /* defined(HAVE_PRI_MWI) */
@@ -9080,43 +9080,48 @@
}
/*
+ * Split the mwi_vm_boxes configuration string into the mbox[].vm_box:
+ * vm_box{,vm_box}
+ */
+ saveptr = pri->mwi_vm_boxes;
+ for (i = 0; i < ARRAY_LEN(pri->mbox); ++i) {
+ char *vm_box;
+
+ vm_box = strsep(&saveptr, ",");
+ if (vm_box) {
+ vm_box = ast_strip(vm_box);
+ if (ast_strlen_zero(vm_box)) {
+ vm_box = NULL;
+ }
+ }
+ pri->mbox[i].vm_box = vm_box;
+ }
+
+ /*
* Split the mwi_mailboxes configuration string into the mbox[]:
- * mailbox_number/mailbox_id{,mailbox_number/mailbox_id}
+ * vm_mailbox{,vm_mailbox}
*/
saveptr = pri->mwi_mailboxes;
for (i = 0; i < ARRAY_LEN(pri->mbox); ++i) {
- char *mbox_number;
char *mbox_id;
struct stasis_topic *mailbox_specific_topic;
mbox_id = strsep(&saveptr, ",");
- if (!mbox_id) {
- /* No more defined mailboxes. */
- break;
- }
- mbox_id = ast_strip(mbox_id);
-
- /* Split the mailbox_number and context */
- mbox_number = strsep(&mbox_id, "/");
- if (!mbox_id) {
- /* There is no mailbox id. Skip it. */
- ast_log(LOG_WARNING, "%s span %d invalid MWI mailbox reference '%s'.\n",
- sig_pri_cc_type_name, pri->span, mbox_number);
+ if (mbox_id) {
+ mbox_id = ast_strip(mbox_id);
+ if (ast_strlen_zero(mbox_id)) {
+ mbox_id = NULL;
+ }
+ }
+ pri->mbox[i].uniqueid = mbox_id;
+ if (!pri->mbox[i].vm_box || !mbox_id) {
+ /* The mailbox position is disabled. */
+ ast_debug(1, "%s span %d MWI position %d disabled. vm_box:%s mbox_id:%s.\n",
+ sig_pri_cc_type_name, pri->span, i,
+ pri->mbox[i].vm_box ?: "<missing>",
+ mbox_id ?: "<missing>");
continue;
}
-
- mbox_number = ast_strip(mbox_number);
- mbox_id = ast_strip(mbox_id);
- if (ast_strlen_zero(mbox_number) || ast_strlen_zero(mbox_id)) {
- /* There is no mailbox id or number. Skip it. */
- ast_log(LOG_WARNING, "%s span %d invalid MWI mailbox reference '%s/%s'.\n",
- sig_pri_cc_type_name, pri->span, mbox_number, mbox_id);
- continue;
- }
-
- /* Fill the mbox[] element. */
- pri->mbox[i].number = mbox_number;
- pri->mbox[i].uniqueid = mbox_id;
mailbox_specific_topic = ast_mwi_topic(mbox_id);
if (mailbox_specific_topic) {
@@ -9124,12 +9129,12 @@
}
if (!pri->mbox[i].sub) {
ast_log(LOG_ERROR, "%s span %d could not subscribe to MWI events for %s(%s).\n",
- sig_pri_cc_type_name, pri->span, mbox_number, mbox_id);
+ sig_pri_cc_type_name, pri->span, pri->mbox[i].vm_box, mbox_id);
}
#if defined(HAVE_PRI_MWI_V2)
if (ast_strlen_zero(pri->mbox[i].vm_number)) {
ast_log(LOG_WARNING, "%s span %d MWI voicemail number for %s(%s) is empty.\n",
- sig_pri_cc_type_name, pri->span, mbox_number, mbox_id);
+ sig_pri_cc_type_name, pri->span, pri->mbox[i].vm_box, mbox_id);
}
#endif /* defined(HAVE_PRI_MWI_V2) */
}
Modified: team/rmudgett/external_mwi/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/external_mwi/channels/sig_pri.h?view=diff&rev=403704&r1=403703&r2=403704
==============================================================================
--- team/rmudgett/external_mwi/channels/sig_pri.h (original)
+++ team/rmudgett/external_mwi/channels/sig_pri.h Thu Dec 12 13:07:26 2013
@@ -388,7 +388,7 @@
/*! Typical maximum length of mwi mailbox context */
#define SIG_PRI_MAX_MWI_CONTEXT_LEN 10
/*!
- * \brief Maximum mwi_vm_numbers string length.
+ * \brief Maximum mwi_vm_numbers and mwi_vm_boxes string length.
* \details
* max_length = #mailboxes * (vm_number + ',')
* The last ',' is a null terminator instead.
@@ -396,20 +396,20 @@
#define SIG_PRI_MAX_MWI_VM_NUMBER_STR (SIG_PRI_MAX_MWI_MAILBOXES \
* (SIG_PRI_MAX_MWI_VM_NUMBER_LEN + 1))
/*!
- * \brief Maximum length of vm-mailbox string.
+ * \brief Maximum length of vm_mailbox string.
* \details
- * max_length = vm-box + '@' + context.
+ * max_length = vm_box + '@' + context.
*/
#define SIG_PRI_MAX_MWI_VM_MAILBOX (SIG_PRI_MAX_MWI_MBOX_NUMBER_LEN \
+ 1 + SIG_PRI_MAX_MWI_CONTEXT_LEN)
/*!
* \brief Maximum mwi_mailboxs string length.
* \details
- * max_length = #mailboxes * (box + '/' + vm-mailbox + ',')
+ * max_length = #mailboxes * (vm_mailbox + ',')
* The last ',' is a null terminator instead.
*/
#define SIG_PRI_MAX_MWI_MAILBOX_STR (SIG_PRI_MAX_MWI_MAILBOXES \
- * (SIG_PRI_MAX_MWI_MBOX_NUMBER_LEN + 1 + SIG_PRI_MAX_MWI_VM_MAILBOX + 1))
+ * (SIG_PRI_MAX_MWI_VM_MAILBOX + 1))
struct sig_pri_mbox {
/*!
@@ -417,11 +417,11 @@
* \note NULL if mailbox not configured.
*/
struct stasis_subscription *sub;
- /*! \brief Mailbox number sent to span. */
- const char *number;
/*! \brief Mailbox uniqueid. */
const char *uniqueid;
- /*! \brief Voicemail controlling number. */
+ /*! \brief Mailbox number sent to span. */
+ const char *vm_box;
+ /*! \brief Voicemail access controlling number sent to span. */
const char *vm_number;
};
#endif /* defined(HAVE_PRI_MWI) */
@@ -513,10 +513,17 @@
/*!
* \brief Comma separated list of mailboxes to indicate MWI.
* \note Empty if disabled.
- * \note Format: box/vm-box at context{,box/vm-box at context}
+ * \note Format: vm_mailbox{,vm_mailbox}
* \note String is split apart when span is started.
*/
char mwi_mailboxes[SIG_PRI_MAX_MWI_MAILBOX_STR];
+ /*!
+ * \brief Comma separated list of mailbox numbers sent over ISDN span for MWI.
+ * \note Empty if disabled.
+ * \note Format: vm_box{,vm_box}
+ * \note String is split apart when span is started.
+ */
+ char mwi_vm_boxes[SIG_PRI_MAX_MWI_VM_NUMBER_STR];
/*!
* \brief Comma separated list of voicemail access controlling numbers for MWI.
* \note Format: vm_number{,vm_number}
Modified: team/rmudgett/external_mwi/configs/chan_dahdi.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/external_mwi/configs/chan_dahdi.conf.sample?view=diff&rev=403704&r1=403703&r2=403704
==============================================================================
--- team/rmudgett/external_mwi/configs/chan_dahdi.conf.sample (original)
+++ team/rmudgett/external_mwi/configs/chan_dahdi.conf.sample Thu Dec 12 13:07:26 2013
@@ -657,18 +657,24 @@
; Configure the ISDN span to indicate MWI for the list of mailboxes.
; You can give a comma separated list of up to 8 mailboxes per span.
; An empty list disables MWI.
+;
; The default is an empty list.
-;
-;mwi_mailboxes=mailbox_association{,mailbox_association}
-; A mailbox_association is of the form:
-; mailbox_association=box/vm-mailbox
-; box = ISDN mailbox number sent over the span.
-; vm-mailbox = Internal voicemail mailbox identifier (app_voicemail mailbox at context)
+;mwi_mailboxes=vm-mailbox{,vm-mailbox}
+; vm-mailbox = Internal voicemail mailbox identifier.
; Note: app_voicemail mailboxes must be in the form of mailbox at context.
-;mwi_mailboxes=501/501 at mailboxes,502/502 at mailboxes
-
-; Configure the ISDN span voicemail numbers for MWI mailboxes. What number
-; to call for a user to retrieve voicemail messages.
+;mwi_mailboxes=501 at mailboxes,502 at mailboxes
+
+; Configure the ISDN mailbox number sent over the span for MWI mailboxes.
+; The position of the number in the list corresponds to the position in
+; mwi_mailboxes. If either position in mwi_mailboxes or mwi_vm_boxes is
+; empty then that position is disabled.
+;
+; The default is an empty list.
+;mwi_vm_boxes=mailbox_number{,mailbox_number}
+;mwi_vm_boxes=501,502
+
+; Configure the ISDN span voicemail controlling numbers for MWI mailboxes.
+; What number to call for a user to retrieve voicemail messages.
;
; You can give a comma separated list of numbers. The position of the number
; corresponds to the position in mwi_mailboxes. If a position is empty then
@@ -677,7 +683,7 @@
; For example:
; mwi_vm_numbers=700,,800,,900
; is equivalent to:
-; mwi_vm_numbers=700,700,800,800,900
+; mwi_vm_numbers=700,700,800,800,900,900,900,900
;
; The default is no number.
;mwi_vm_numbers=
More information about the asterisk-commits
mailing list