[asterisk-commits] rmudgett: branch rmudgett/mwi2 r307136 - in /team/rmudgett/mwi2: ./ channels/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 8 16:33:36 CST 2011


Author: rmudgett
Date: Tue Feb  8 16:33:31 2011
New Revision: 307136

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=307136
Log:
Initial attempt to fix MWI indicate missing the voicemail controlling number.

Since more information was needed to properly send the MWIIndicate
message, I needed to add a new API call to replace the insufficient call.

Modified:
    team/rmudgett/mwi2/channels/chan_dahdi.c
    team/rmudgett/mwi2/channels/sig_pri.c
    team/rmudgett/mwi2/channels/sig_pri.h
    team/rmudgett/mwi2/configs/chan_dahdi.conf.sample
    team/rmudgett/mwi2/configure.ac

Modified: team/rmudgett/mwi2/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/mwi2/channels/chan_dahdi.c?view=diff&rev=307136&r1=307135&r2=307136
==============================================================================
--- team/rmudgett/mwi2/channels/chan_dahdi.c (original)
+++ team/rmudgett/mwi2/channels/chan_dahdi.c Tue Feb  8 16:33:31 2011
@@ -12339,6 +12339,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_number,
+							conf->pri.pri.mwi_vm_number,
+							sizeof(pris[span].pri.mwi_vm_number));
 #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));
@@ -17301,6 +17304,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_number")) {
+				ast_copy_string(confp->pri.pri.mwi_vm_number, v->value,
+					sizeof(confp->pri.pri.mwi_vm_number));
 #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: team/rmudgett/mwi2/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/mwi2/channels/sig_pri.c?view=diff&rev=307136&r1=307135&r2=307136
==============================================================================
--- team/rmudgett/mwi2/channels/sig_pri.c (original)
+++ team/rmudgett/mwi2/channels/sig_pri.c Tue Feb  8 16:33:31 2011
@@ -7894,14 +7894,16 @@
  * \since 1.8
  *
  * \param pri Asterisk D channel control structure.
+ * \param vm_number Voicemail controlling number
  * \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,
@@ -7913,8 +7915,19 @@
 	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;
+	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) */
@@ -7946,7 +7959,8 @@
 		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);
+	sig_pri_send_mwi_indication(pri, pri->mwi_vm_number, mbox_number, mbox_context,
+		num_messages);
 }
 #endif	/* defined(HAVE_PRI_MWI) */
 
@@ -7981,8 +7995,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->mwi_vm_number, pri->mbox[idx].number,
+			pri->mbox[idx].context, num_messages);
 		ast_event_destroy(event);
 	}
 }

Modified: team/rmudgett/mwi2/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/mwi2/channels/sig_pri.h?view=diff&rev=307136&r1=307135&r2=307136
==============================================================================
--- team/rmudgett/mwi2/channels/sig_pri.h (original)
+++ team/rmudgett/mwi2/channels/sig_pri.h Tue Feb  8 16:33:31 2011
@@ -31,6 +31,10 @@
 #include "asterisk/ccss.h"
 #include <libpri.h>
 #include <dahdi/user.h>
+
+#if defined(HAVE_PRI_MWI)
+#define HAVE_PRI_MWI_V2		1	/* BUGBUG delete when branch merged. */
+#endif	/* !defined(HAVE_PRI_MWI) */
 
 #if defined(HAVE_PRI_CCSS)
 /*! PRI debug message flags when normal PRI debugging is turned on at the command line. */
@@ -430,6 +434,8 @@
 	 * \note String is split apart when span is started.
 	 */
 	char mwi_mailboxes[SIG_PRI_MAX_MWI_MAILBOX_STR];
+	/*! \brief Voicemail access controlling number for MWI. */
+	char mwi_vm_number[AST_MAX_EXTENSION];
 #endif	/* defined(HAVE_PRI_MWI) */
 	/*!
 	 * \brief Initial user tag for party id's sent from this device driver.

Modified: team/rmudgett/mwi2/configs/chan_dahdi.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/mwi2/configs/chan_dahdi.conf.sample?view=diff&rev=307136&r1=307135&r2=307136
==============================================================================
--- team/rmudgett/mwi2/configs/chan_dahdi.conf.sample (original)
+++ team/rmudgett/mwi2/configs/chan_dahdi.conf.sample Tue Feb  8 16:33:31 2011
@@ -581,13 +581,18 @@
 ; 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 number for MWI.  What number to call for
+; a user to retrieve voicemail messages.
+; The default is no number.
+;mwi_vm_number=
+
 ; Whether or not restrict outgoing caller ID (will be sent as ANI only, not
 ; available for the user)
 ; Mostly use with FXS ports

Modified: team/rmudgett/mwi2/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/mwi2/configure.ac?view=diff&rev=307136&r1=307135&r2=307136
==============================================================================
--- team/rmudgett/mwi2/configure.ac (original)
+++ team/rmudgett/mwi2/configure.ac Tue Feb  8 16:33:31 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])
@@ -1812,6 +1813,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])




More information about the asterisk-commits mailing list