[asterisk-commits] rmudgett: trunk r314116 - in /trunk: ./ channels/ configs/ include/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 18 14:48:04 CDT 2011


Author: rmudgett
Date: Mon Apr 18 14:48:00 2011
New Revision: 314116

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=314116
Log:
Problems with ISDN MWI to phones.

The "controlling user number" is always the number of the voice mail box
which is identical with the subscriber number itself.  This number which
is listed in the ISDN phone MWI menu cannot be called back to contact the
voice mail box.  The controlling user number should be made configurable.

JIRA ABE-2738
JIRA SWP-2846

Modified:
    trunk/channels/chan_dahdi.c
    trunk/channels/sig_pri.c
    trunk/channels/sig_pri.h
    trunk/configs/chan_dahdi.conf.sample
    trunk/configure
    trunk/configure.ac
    trunk/include/asterisk/autoconfig.h.in

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=314116&r1=314115&r2=314116
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Mon Apr 18 14:48:00 2011
@@ -12457,6 +12457,9 @@
 						ast_copy_string(pris[span].pri.mwi_mailboxes,
 							conf->pri.pri.mwi_mailboxes,
 							sizeof(pris[span].pri.mwi_mailboxes));
+						ast_copy_string(pris[span].pri.mwi_vm_numbers,
+							conf->pri.pri.mwi_vm_numbers,
+							sizeof(pris[span].pri.mwi_vm_numbers));
 #endif	/* defined(HAVE_PRI_MWI) */
 						ast_copy_string(pris[span].pri.idledial, conf->pri.pri.idledial, sizeof(pris[span].pri.idledial));
 						ast_copy_string(pris[span].pri.idleext, conf->pri.pri.idleext, sizeof(pris[span].pri.idleext));
@@ -17511,6 +17514,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_numbers")) {
+				ast_copy_string(confp->pri.pri.mwi_vm_numbers, v->value,
+					sizeof(confp->pri.pri.mwi_vm_numbers));
 #endif	/* defined(HAVE_PRI_MWI) */
 			} else if (!strcasecmp(v->name, "append_msn_to_cid_tag")) {
 				confp->pri.pri.append_msn_to_user_tag = ast_true(v->value);

Modified: trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.c?view=diff&rev=314116&r1=314115&r2=314116
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Mon Apr 18 14:48:00 2011
@@ -8145,18 +8145,20 @@
  * \since 1.8
  *
  * \param pri PRI span control structure.
+ * \param vm_number Voicemail controlling number (NULL if not present).
  * \param mbox_number Mailbox number
  * \param mbox_context Mailbox context
  * \param num_messages Number of messages waiting.
  *
  * \return Nothing
  */
-static void sig_pri_send_mwi_indication(struct sig_pri_span *pri, const char *mbox_number, const char *mbox_context, int num_messages)
-{
+static void sig_pri_send_mwi_indication(struct sig_pri_span *pri, const char *vm_number, const char *mbox_number, const char *mbox_context, int num_messages)
+{
+	struct pri_party_id voicemail;
 	struct pri_party_id mailbox;
 
-	ast_debug(1, "Send MWI indication for %s@%s num_messages:%d\n", mbox_number,
-		mbox_context, num_messages);
+	ast_debug(1, "Send MWI indication for %s@%s vm_number:%s num_messages:%d\n",
+		mbox_number, mbox_context, S_OR(vm_number, "<not-present>"), num_messages);
 
 	memset(&mailbox, 0, sizeof(mailbox));
 	mailbox.number.valid = 1;
@@ -8164,8 +8166,21 @@
 	mailbox.number.plan = (PRI_TON_UNKNOWN << 4) | PRI_NPI_UNKNOWN;
 	ast_copy_string(mailbox.number.str, mbox_number, sizeof(mailbox.number.str));
 
+	memset(&voicemail, 0, sizeof(voicemail));
+	voicemail.number.valid = 1;
+	voicemail.number.presentation = PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
+	voicemail.number.plan = (PRI_TON_UNKNOWN << 4) | PRI_NPI_UNKNOWN;
+	if (vm_number) {
+		ast_copy_string(voicemail.number.str, vm_number, sizeof(voicemail.number.str));
+	}
+
 	ast_mutex_lock(&pri->lock);
+#if defined(HAVE_PRI_MWI_V2)
+	pri_mwi_indicate_v2(pri->pri, &mailbox, &voicemail, 1 /* speech */, num_messages,
+		NULL, NULL, -1, 0);
+#else	/* !defined(HAVE_PRI_MWI_V2) */
 	pri_mwi_indicate(pri->pri, &mailbox, 1 /* speech */, num_messages, NULL, NULL, -1, 0);
+#endif	/* !defined(HAVE_PRI_MWI_V2) */
 	ast_mutex_unlock(&pri->lock);
 }
 #endif	/* defined(HAVE_PRI_MWI) */
@@ -8187,6 +8202,7 @@
 	const char *mbox_context;
 	const char *mbox_number;
 	int num_messages;
+	int idx;
 
 	mbox_number = ast_event_get_ie_str(event, AST_EVENT_IE_MAILBOX);
 	if (ast_strlen_zero(mbox_number)) {
@@ -8197,7 +8213,20 @@
 		return;
 	}
 	num_messages = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
-	sig_pri_send_mwi_indication(pri, mbox_number, mbox_context, num_messages);
+
+	for (idx = 0; idx < ARRAY_LEN(pri->mbox); ++idx) {
+		if (!pri->mbox[idx].sub) {
+			/* Mailbox slot is empty */
+			continue;
+		}
+		if (!strcmp(pri->mbox[idx].number, mbox_number)
+			&& !strcmp(pri->mbox[idx].context, mbox_context)) {
+			/* Found the mailbox. */
+			sig_pri_send_mwi_indication(pri, pri->mbox[idx].vm_number, mbox_number,
+				mbox_context, num_messages);
+			break;
+		}
+	}
 }
 #endif	/* defined(HAVE_PRI_MWI) */
 
@@ -8219,8 +8248,8 @@
 
 	for (idx = 0; idx < ARRAY_LEN(pri->mbox); ++idx) {
 		if (!pri->mbox[idx].sub) {
-			/* There are no more mailboxes on this span. */
-			break;
+			/* Mailbox slot is empty */
+			continue;
 		}
 
 		event = ast_event_get_cached(AST_EVENT_MWI,
@@ -8232,8 +8261,8 @@
 			continue;
 		}
 		num_messages = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
-		sig_pri_send_mwi_indication(pri, pri->mbox[idx].number, pri->mbox[idx].context,
-			num_messages);
+		sig_pri_send_mwi_indication(pri, pri->mbox[idx].vm_number, pri->mbox[idx].number,
+			pri->mbox[idx].context, num_messages);
 		ast_event_destroy(event);
 	}
 }
@@ -8318,8 +8347,7 @@
 	int i;
 #if defined(HAVE_PRI_MWI)
 	char *saveptr;
-	char *mbox_number;
-	char *mbox_context;
+	char *prev_vm_number;
 	struct ast_str *mwi_description = ast_str_alloca(64);
 #endif	/* defined(HAVE_PRI_MWI) */
 
@@ -8337,14 +8365,40 @@
 
 #if defined(HAVE_PRI_MWI)
 	/*
+	 * Split the mwi_vm_numbers configuration string into the mbox[].vm_number:
+	 * vm_number{,vm_number}
+	 */
+	prev_vm_number = NULL;
+	saveptr = pri->mwi_vm_numbers;
+	for (i = 0; i < ARRAY_LEN(pri->mbox); ++i) {
+		char *vm_number;
+
+		vm_number = strsep(&saveptr, ",");
+		if (vm_number) {
+			vm_number = ast_strip(vm_number);
+		}
+		if (ast_strlen_zero(vm_number)) {
+			/* There was no number so reuse the previous number. */
+			vm_number = prev_vm_number;
+		} else {
+			/* We have a new number. */
+			prev_vm_number = vm_number;
+		}
+		pri->mbox[i].vm_number = vm_number;
+	}
+
+	/*
 	 * Split the mwi_mailboxes configuration string into the mbox[]:
 	 * mailbox_number[@context]{,mailbox_number[@context]}
 	 */
-	i = 0;
 	saveptr = pri->mwi_mailboxes;
-	while (i < ARRAY_LEN(pri->mbox)) {
+	for (i = 0; i < ARRAY_LEN(pri->mbox); ++i) {
+		char *mbox_number;
+		char *mbox_context;
+
 		mbox_number = strsep(&saveptr, ",");
 		if (!mbox_number) {
+			/* No more defined mailboxes. */
 			break;
 		}
 		/* Split the mailbox_number and context */
@@ -8364,6 +8418,8 @@
 		}
 
 		/* Fill the mbox[] element. */
+		pri->mbox[i].number = mbox_number;
+		pri->mbox[i].context = mbox_context;
 		ast_str_set(&mwi_description, -1, "%s span %d[%d] MWI mailbox %s@%s",
 			sig_pri_cc_type_name, pri->span, i, mbox_number, mbox_context);
 		pri->mbox[i].sub = ast_event_subscribe(AST_EVENT_MWI, sig_pri_mwi_event_cb,
@@ -8374,11 +8430,13 @@
 		if (!pri->mbox[i].sub) {
 			ast_log(LOG_ERROR, "%s span %d could not subscribe to MWI events for %s@%s.",
 				sig_pri_cc_type_name, pri->span, mbox_number, mbox_context);
-			continue;
-		}
-		pri->mbox[i].number = mbox_number;
-		pri->mbox[i].context = mbox_context;
-		++i;
+		}
+#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_context);
+		}
+#endif	/* defined(HAVE_PRI_MWI_V2) */
 	}
 #endif	/* defined(HAVE_PRI_MWI) */
 

Modified: trunk/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.h?view=diff&rev=314116&r1=314115&r2=314116
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Mon Apr 18 14:48:00 2011
@@ -359,12 +359,22 @@
 #if defined(HAVE_PRI_MWI)
 /*! Maximum number of mailboxes per span. */
 #define SIG_PRI_MAX_MWI_MAILBOXES			8
+/*! Typical maximum length of mwi voicemail controlling number */
+#define SIG_PRI_MAX_MWI_VM_NUMBER_LEN		10	/* digits in number */
 /*! Typical maximum length of mwi mailbox number */
 #define SIG_PRI_MAX_MWI_MBOX_NUMBER_LEN		10	/* digits in number */
 /*! Typical maximum length of mwi mailbox context */
 #define SIG_PRI_MAX_MWI_CONTEXT_LEN			10
 /*!
- * \brief Maximum mwi_mailbox string length.
+ * \brief Maximum mwi_vm_numbers string length.
+ * \details
+ * max_length = #mailboxes * (vm_number + ',')
+ * The last ',' is a null terminator instead.
+ */
+#define SIG_PRI_MAX_MWI_VM_NUMBER_STR	(SIG_PRI_MAX_MWI_MAILBOXES \
+	* (SIG_PRI_MAX_MWI_VM_NUMBER_LEN + 1))
+/*!
+ * \brief Maximum mwi_mailboxs string length.
  * \details
  * max_length = #mailboxes * (mbox_number + '@' + context + ',')
  * The last ',' is a null terminator instead.
@@ -382,6 +392,8 @@
 	const char *number;
 	/*! \brief Mailbox context. */
 	const char *context;
+	/*! \brief Voicemail controlling number. */
+	const char *vm_number;
 };
 #endif	/* defined(HAVE_PRI_MWI) */
 
@@ -453,6 +465,12 @@
 	 * \note String is split apart when span is started.
 	 */
 	char mwi_mailboxes[SIG_PRI_MAX_MWI_MAILBOX_STR];
+	/*!
+	 * \brief Comma separated list of voicemail access controlling numbers for MWI.
+	 * \note Format: vm_number{,vm_number}
+	 * \note String is split apart when span is started.
+	 */
+	char mwi_vm_numbers[SIG_PRI_MAX_MWI_VM_NUMBER_STR];
 #endif	/* defined(HAVE_PRI_MWI) */
 	/*!
 	 * \brief Initial user tag for party id's sent from this device driver.

Modified: trunk/configs/chan_dahdi.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/chan_dahdi.conf.sample?view=diff&rev=314116&r1=314115&r2=314116
==============================================================================
--- trunk/configs/chan_dahdi.conf.sample (original)
+++ trunk/configs/chan_dahdi.conf.sample Mon Apr 18 14:48:00 2011
@@ -581,13 +581,28 @@
 ; Allow incoming ISDN call waiting calls.
 ; A call waiting call is a SETUP message with no B channel selected.
 ;allow_call_waiting_calls=no
-;
+
 ; 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_number[@context]{,mailbox_number[@context]}
 ;
+; Configure the ISDN span voicemail 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
+; the last number is reused.
+;
+; For example:
+;  mwi_vm_numbers=700,,800,,900
+; is equivalent to:
+;  mwi_vm_numbers=700,700,800,800,900
+;
+; The default is no number.
+;mwi_vm_numbers=
+
 ; Whether or not restrict outgoing caller ID (will be sent as ANI only, not
 ; available for the user)
 ; Mostly use with FXS ports

Modified: trunk/configure.ac
URL: http://svnview.digium.com/svn/asterisk/trunk/configure.ac?view=diff&rev=314116&r1=314115&r2=314116
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Mon Apr 18 14:48:00 2011
@@ -414,6 +414,7 @@
 AST_EXT_LIB_SETUP([POPT], [popt], [popt])
 AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
+AST_EXT_LIB_SETUP_DEPENDENT([PRI_MWI_V2], [ISDN PRI Message Waiting Indication (Fixed)], [PRI], [pri])
 AST_EXT_LIB_SETUP_DEPENDENT([PRI_DISPLAY_TEXT], [ISDN PRI user display text IE contents during call], [PRI], [pri])
 AST_EXT_LIB_SETUP_DEPENDENT([PRI_MWI], [ISDN PRI Message Waiting Indication], [PRI], [pri])
 AST_EXT_LIB_SETUP_DEPENDENT([PRI_MCID], [ISDN PRI Malicious Call ID], [PRI], [pri])
@@ -1822,6 +1823,7 @@
 AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
 
 AST_EXT_LIB_CHECK([PRI], [pri], [pri_connected_line_update], [libpri.h])
+AST_EXT_LIB_CHECK([PRI_MWI_V2], [pri], [pri_mwi_indicate_v2], [libpri.h])
 AST_EXT_LIB_CHECK([PRI_DISPLAY_TEXT], [pri], [pri_display_text], [libpri.h])
 AST_EXT_LIB_CHECK([PRI_MWI], [pri], [pri_mwi_indicate], [libpri.h])
 AST_EXT_LIB_CHECK([PRI_MCID], [pri], [pri_mcid_enable], [libpri.h])

Modified: trunk/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/autoconfig.h.in?view=diff&rev=314116&r1=314115&r2=314116
==============================================================================
--- trunk/include/asterisk/autoconfig.h.in (original)
+++ trunk/include/asterisk/autoconfig.h.in Mon Apr 18 14:48:00 2011
@@ -592,6 +592,10 @@
 /* Define to 1 if you have the ISDN PRI Message Waiting Indication library. */
 #undef HAVE_PRI_MWI
 
+/* Define to 1 if you have the ISDN PRI Message Waiting Indication (Fixed)
+   library. */
+#undef HAVE_PRI_MWI_V2
+
 /* Define to 1 if you have the ISDN progress with cause library. */
 #undef HAVE_PRI_PROG_W_CAUSE
 
@@ -1113,9 +1117,6 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* Define to 1 if the C compiler supports function prototypes. */
-#undef PROTOTYPES
-
 /* Define to necessary symbol if this constant uses a non-standard name on
    your system. */
 #undef PTHREAD_CREATE_JOINABLE
@@ -1134,11 +1135,6 @@
 
 /* Define to the type of arg 5 for `select'. */
 #undef SELECT_TYPE_ARG5
-
-/* Define to 1 if the `setvbuf' function takes the buffering type as its
-   second argument and the buffer pointer as the third, as on System V before
-   release 3. */
-#undef SETVBUF_REVERSED
 
 /* The size of `char *', as computed by sizeof. */
 #undef SIZEOF_CHAR_P
@@ -1175,23 +1171,33 @@
 /* Define to a type of the same size as fd_set.fds_bits[[0]] */
 #undef TYPEOF_FD_SET_FDS_BITS
 
-/* Define to 1 if on AIX 3.
-   System headers sometimes define this.
-   We just want to avoid a redefinition error message.  */
+/* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
 #endif
-
-/* Define to 1 if running on Darwin. */
-#undef _DARWIN_UNLIMITED_SELECT
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
 /* Enable GNU extensions on systems that have them.  */
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
 #endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Define to 1 if running on Darwin. */
+#undef _DARWIN_UNLIMITED_SELECT
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
 
 /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
 #undef _LARGEFILE_SOURCE
@@ -1208,20 +1214,6 @@
 
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
-
-/* Enable extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-
-/* Define like PROTOTYPES; this can be used by system headers. */
-#undef __PROTOTYPES
 
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const




More information about the asterisk-commits mailing list