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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 2 18:25:38 CDT 2009


Author: rmudgett
Date: Wed Sep  2 18:25:33 2009
New Revision: 215757

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=215757
Log:
Made chan_dahdi able to ignore incoming calls that are not in a MSN list for ISDN PTMP CPE spans.

Modified:
    trunk/CHANGES
    trunk/channels/chan_dahdi.c
    trunk/channels/sig_pri.c
    trunk/channels/sig_pri.h
    trunk/configs/chan_dahdi.conf.sample

Modified: trunk/CHANGES
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/CHANGES?view=diff&rev=215757&r1=215756&r2=215757
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Sep  2 18:25:33 2009
@@ -189,6 +189,8 @@
    will update the redirecting-to presentation (COLR) when it becomes available.
  * Added Reverse Charging Indication receipt & transmission (requires latest
    LibPRI).
+ * Added the ability to ignore calls that are not in a Multiple Subscriber
+   Number (MSN) list for PTMP CPE interfaces.
 
 Asterisk Manager Interface
 --------------------------

Modified: trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=215757&r1=215756&r2=215757
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Sep  2 18:25:33 2009
@@ -10843,6 +10843,7 @@
 						pris[span].pri.inbanddisconnect = conf->pri.pri.inbanddisconnect;
 #endif
 						pris[span].pri.facilityenable = conf->pri.pri.facilityenable;
+						ast_copy_string(pris[span].pri.msn_list, conf->pri.pri.msn_list, sizeof(pris[span].pri.msn_list));
 						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));
 						ast_copy_string(pris[span].pri.internationalprefix, conf->pri.pri.internationalprefix, sizeof(pris[span].pri.internationalprefix));
@@ -15614,6 +15615,9 @@
 					ast_log(LOG_ERROR, "Unknown switchtype '%s' at line %d.\n", v->value, v->lineno);
 					return -1;
 				}
+			} else if (!strcasecmp(v->name, "msn")) {
+				ast_copy_string(confp->pri.pri.msn_list, v->value,
+					sizeof(confp->pri.pri.msn_list));
 			} else if (!strcasecmp(v->name, "nsf")) {
 				if (!strcasecmp(v->value, "sdn"))
 					confp->pri.pri.nsf = PRI_NSF_SDN;

Modified: trunk/channels/sig_pri.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_pri.c?view=diff&rev=215757&r1=215756&r2=215757
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Wed Sep  2 18:25:33 2009
@@ -997,6 +997,39 @@
 	pri->dchanavail[index] |= DCHAN_NOTINALARM;
 	if (!before_start_pri)
 		pri_restart(pri->dchans[index]);
+}
+
+/*!
+ * \internal
+ * \brief Determine if the given extension matches one of the MSNs in the pattern list.
+ * \since 1.6.3
+ *
+ * \param msn_patterns Comma separated list of MSN patterns to match.
+ * \param exten Extension to match in the MSN list.
+ *
+ * \retval 1 if matches.
+ * \retval 0 if no match.
+ */
+static int sig_pri_msn_match(const char *msn_patterns, const char *exten)
+{
+	char *pattern;
+	char *msn_list;
+	char *list_tail;
+
+	msn_list = strdupa(msn_patterns);
+
+	list_tail = NULL;
+	pattern = strtok_r(msn_list, ",", &list_tail);
+	while (pattern) {
+		pattern = ast_strip(pattern);
+		if (!ast_strlen_zero(pattern) && ast_extension_match(pattern, exten)) {
+			/* Extension matched the pattern. */
+			return 1;
+		}
+		pattern = strtok_r(NULL, ",", &list_tail);
+	}
+	/* Did not match any pattern in the list. */
+	return 0;
 }
 
 /*!
@@ -1621,6 +1654,15 @@
 				break;
 #endif
 			case PRI_EVENT_RING:
+				if (!ast_strlen_zero(pri->msn_list)
+					&& !sig_pri_msn_match(pri->msn_list, e->ring.callednum)) {
+					/* The call is not for us so ignore it. */
+					ast_verb(3,
+						"Ignoring call to '%s' on span %d.  Its not in the MSN list: %s\n",
+						e->ring.callednum, pri->span, pri->msn_list);
+					pri_destroycall(pri->pri, e->ring.call);
+					break;
+				}
 				if (e->ring.channel == -1)
 					chanpos = pri_find_empty_chan(pri, 1);
 				else

Modified: trunk/channels/sig_pri.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_pri.h?view=diff&rev=215757&r1=215756&r2=215757
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Wed Sep  2 18:25:33 2009
@@ -195,6 +195,7 @@
 	char privateprefix[20];					/*!< for private dialplans */
 	char unknownprefix[20];					/*!< for unknown dialplans */
 	long resetinterval;						/*!< Interval (in seconds) for resetting unused channels */
+	char msn_list[AST_MAX_EXTENSION];		/*!< Comma separated list of MSNs to handle.  Empty if disabled. */
 	char idleext[AST_MAX_EXTENSION];		/*!< Where to idle extra calls */
 	char idlecontext[AST_MAX_CONTEXT];		/*!< What context to use for idle */
 	char idledial[AST_MAX_EXTENSION];		/*!< What to dial before dumping */

Modified: trunk/configs/chan_dahdi.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/configs/chan_dahdi.conf.sample?view=diff&rev=215757&r1=215756&r2=215757
==============================================================================
--- trunk/configs/chan_dahdi.conf.sample (original)
+++ trunk/configs/chan_dahdi.conf.sample Wed Sep  2 18:25:33 2009
@@ -66,6 +66,14 @@
 ; qsig:        Q.SIG
 ;
 ;switchtype=euroisdn
+;
+; MSNs for ISDN spans.  Asterisk will listen for the listed numbers on
+; incoming calls and ignore any calls not listed.
+; Here you can give a comma separated list of numbers or dialplan extension
+; patterns.  An empty list disables MSN matching to allow any incoming call.
+; Only set on PTMP CPE side of ISDN span if needed.
+; The default is an empty list.
+;msn=
 ;
 ; Some switches (AT&T especially) require network specific facility IE.
 ; Supported values are currently 'none', 'sdn', 'megacom', 'tollfreemegacom', 'accunet'




More information about the asterisk-commits mailing list