dect
/
asterisk
Archived
13
0
Fork 0

Made chan_dahdi able to ignore incoming calls that are not in a MSN list for ISDN PTMP CPE spans.

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215757 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
rmudgett 2009-09-02 23:25:33 +00:00
parent ed68a7c6fe
commit 9d636a0087
5 changed files with 57 additions and 0 deletions

View File

@ -189,6 +189,8 @@ libpri channel driver (chan_dahdi) DAHDI changes
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
--------------------------

View File

@ -10843,6 +10843,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
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 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
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;

View File

@ -999,6 +999,39 @@ void pri_event_noalarm(struct sig_pri_pri *pri, int index, int 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;
}
/*!
* \internal
* \brief Obtain the sig_pri owner channel lock if the owner exists.
@ -1621,6 +1654,15 @@ static void *pri_dchannel(void *vpri)
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

View File

@ -195,6 +195,7 @@ struct sig_pri_pri {
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 */

View File

@ -67,6 +67,14 @@
;
;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'
;