add support properly displaying and logging incoming telephone numbers (MSNs)
by looking at the "type of number" field and providing configurable hooks to correct the numbers accordingly. See keywords add-prefix, prefix-national and prefix-international in isdnd.rc(5). This feature was implemented by Christian Ullrich <chris@chrullrich.de>
This commit is contained in:
parent
d7567ff763
commit
866a3fa2bf
@ -6,7 +6,7 @@ $FreeBSD$
|
||||
isdn4bsd
|
||||
========
|
||||
|
||||
Version 1.03.00 / August 2002
|
||||
Version 1.04.00 / August 2002
|
||||
|
||||
written by:
|
||||
|
||||
@ -182,7 +182,7 @@ BSD/OS:
|
||||
changes and improvements.
|
||||
|
||||
- For installation instructions have a look at the isdn4bsd handbook
|
||||
available online at http://people.freebsd.org/~hm/
|
||||
available online at http://people.freebsd.org/~hm/i4b-home/
|
||||
|
||||
- isdn4bsd has a homepage at http://www.freebsd-support.de/i4b/ where i
|
||||
will try to maintain links to docs, updates and errata.
|
||||
@ -201,7 +201,7 @@ BSD/OS:
|
||||
------------------------------
|
||||
|
||||
Read the installation instructions in the isdn4bsd handbook which is
|
||||
available online at http://people.freebsd.org/~hm/
|
||||
available online at http://people.freebsd.org/~hm/i4b-home/
|
||||
|
||||
In case they are incomplete, unclear, wrong or outdated, please send me an
|
||||
update for inclusion into a future distribution!
|
||||
@ -239,7 +239,7 @@ to or other equipment like ISDN simulators (which i don't get access to
|
||||
for free): in this case you are the only person being able to trace down
|
||||
the bug and fix it.
|
||||
|
||||
There is a web page for i4b at http://www.freebsd-support.de/i4b available
|
||||
There is a web page for i4b at http://www.freebsd-support.de/i4b/ available
|
||||
where i will put bugfixes, updates and contributions. In particular it has
|
||||
an "errata" page, where you should look in case you have problems with i4b.
|
||||
|
||||
@ -331,7 +331,7 @@ get isdn4bsd where you can get FreeBSD: http://www.freebsd.org
|
||||
|
||||
Isdn4bsd has its own homepage at
|
||||
|
||||
http://www.freebsd-support.de/i4b
|
||||
http://www.freebsd-support.de/i4b/
|
||||
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
$FreeBSD$
|
||||
|
||||
last edit-date: [Sat Jun 2 13:46:20 2001]
|
||||
last edit-date: [Mon Aug 12 09:42:53 2002]
|
||||
|
||||
|
||||
1. Documentation
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
The i4b handbook which describes the setup and configuration of
|
||||
isdn4bsd under FreeBSD in detail can be found at
|
||||
http://people.freebsd.org/~hm/
|
||||
http://people.freebsd.org/~hm/i4b-home/
|
||||
|
||||
The i4b homepage is http://www.freebsd-support.de/i4b/
|
||||
|
||||
|
@ -1,8 +1,17 @@
|
||||
$FreeBSD$
|
||||
|
||||
ReleaseNotes for isdn4bsd last edit-date: [Sun Aug 11 17:39:06 2002]
|
||||
ReleaseNotes for isdn4bsd last edit-date: [Mon Aug 12 09:47:59 2002]
|
||||
================================================================================
|
||||
|
||||
release 1.04
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
- add support properly displaying and logging incoming telephone numbers (MSNs)
|
||||
by looking at the "type of number" field and providing configurable hooks
|
||||
to correct the numbers accordingly. See keywords add-prefix, prefix-national
|
||||
and prefix-international in isdnd.rc(5).
|
||||
This feature was implemented by Christian Ullrich <chris@chrullrich.de>
|
||||
|
||||
release 1.03
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@ -172,6 +172,8 @@ Sergio de Souza Prallon for the contribution of the itjc driver which
|
||||
Steve Looman for the driver for a Compaq Microcom 610 ISDN card
|
||||
and for the subaddressing implementation
|
||||
|
||||
Christian Ullrich for the "type of number" patchset
|
||||
|
||||
|
||||
------------------------------------------
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Sun Aug 11 12:39:58 2002]
|
||||
* last edit-date: [Sun Aug 11 19:19:08 2002]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
* version and release number for isdn4bsd package
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define VERSION 1 /* version number */
|
||||
#define REL 3 /* release number */
|
||||
#define REL 4 /* release number */
|
||||
#define STEP 0 /* release step */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -344,6 +344,11 @@ typedef struct {
|
||||
char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */
|
||||
char src_telno[TELNO_MAX]; /* source telno */
|
||||
char src_subaddr[SUBADDR_MAX]; /* src subaddr */
|
||||
int dst_ton; /* dest. type of number */
|
||||
int src_ton; /* src. type of number */
|
||||
#define TON_OTHER 0 /* other type of number */
|
||||
#define TON_INTERNAT 1 /* international number */
|
||||
#define TON_NATIONAL 2 /* national number */
|
||||
int scr_ind;/* screening indicator */
|
||||
#define SCR_NONE 0 /* no screening indicator transmitted */
|
||||
#define SCR_USR_NOSC 1 /* screening user provided, not screened*/
|
||||
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Sun Aug 11 12:39:58 2002]
|
||||
* last edit-date: [Sun Aug 11 19:19:08 2002]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
* version and release number for isdn4bsd package
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define VERSION 1 /* version number */
|
||||
#define REL 3 /* release number */
|
||||
#define REL 4 /* release number */
|
||||
#define STEP 0 /* release step */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -344,6 +344,11 @@ typedef struct {
|
||||
char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */
|
||||
char src_telno[TELNO_MAX]; /* source telno */
|
||||
char src_subaddr[SUBADDR_MAX]; /* src subaddr */
|
||||
int dst_ton; /* dest. type of number */
|
||||
int src_ton; /* src. type of number */
|
||||
#define TON_OTHER 0 /* other type of number */
|
||||
#define TON_INTERNAT 1 /* international number */
|
||||
#define TON_NATIONAL 2 /* national number */
|
||||
int scr_ind;/* screening indicator */
|
||||
#define SCR_NONE 0 /* no screening indicator transmitted */
|
||||
#define SCR_USR_NOSC 1 /* screening user provided, not screened*/
|
||||
|
@ -153,6 +153,9 @@ typedef struct
|
||||
u_char src_telno[TELNO_MAX]; /* source number */
|
||||
u_char src_subaddr[SUBADDR_MAX]; /* source subaddr */
|
||||
|
||||
int dst_ton; /* destination type of number */
|
||||
int src_ton; /* source type of number */
|
||||
|
||||
int scr_ind; /* screening ind for incoming call */
|
||||
int prs_ind; /* presentation ind for incoming call */
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
* last edit-date: [Sat Mar 9 19:36:45 2002]
|
||||
* last edit-date: [Sun Aug 11 19:18:08 2002]
|
||||
*
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -427,6 +427,20 @@ i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
|
||||
cd->scr_ind = (msg_ptr[3] & 0x03) + SCR_USR_NOSC;
|
||||
cd->prs_ind = ((msg_ptr[3] >> 5) & 0x03) + PRS_ALLOWED;
|
||||
}
|
||||
|
||||
/* type of number (source) */
|
||||
switch ((msg_ptr[2] & 0x70) >> 4)
|
||||
{
|
||||
case 1:
|
||||
cd->src_ton = TON_INTERNAT;
|
||||
break;
|
||||
case 2:
|
||||
cd->src_ton = TON_NATIONAL;
|
||||
break;
|
||||
default:
|
||||
cd->src_ton = TON_OTHER;
|
||||
break;
|
||||
}
|
||||
NDBGL3(L3_P_MSG, "IEI_CALLINGPN = %s", cd->src_telno);
|
||||
break;
|
||||
|
||||
@ -439,6 +453,21 @@ i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
|
||||
case IEI_CALLEDPN: /* called party number */
|
||||
memcpy(cd->dst_telno, &msg_ptr[3], min(TELNO_MAX, msg_ptr[1]-1));
|
||||
cd->dst_telno[min(TELNO_MAX, msg_ptr[1] - 1)] = '\0';
|
||||
|
||||
/* type of number (destination) */
|
||||
switch ((msg_ptr[2] & 0x70) >> 4)
|
||||
{
|
||||
case 1:
|
||||
cd->dst_ton = TON_INTERNAT;
|
||||
break;
|
||||
case 2:
|
||||
cd->dst_ton = TON_NATIONAL;
|
||||
break;
|
||||
default:
|
||||
cd->dst_ton = TON_OTHER;
|
||||
break;
|
||||
}
|
||||
|
||||
NDBGL3(L3_P_MSG, "IEI_CALLED = %s", cd->dst_telno);
|
||||
break;
|
||||
|
||||
|
@ -391,6 +391,9 @@ i4b_l4_connect_ind(call_desc_t *cd)
|
||||
else
|
||||
strcpy(mp->src_subaddr, TELNO_EMPTY);
|
||||
|
||||
mp->src_ton = cd->src_ton;
|
||||
mp->dst_ton = cd->dst_ton;
|
||||
|
||||
strcpy(mp->display, cd->display);
|
||||
|
||||
mp->scr_ind = cd->scr_ind;
|
||||
|
@ -659,6 +659,10 @@ time_t starttime = 0;
|
||||
|
||||
char holidayfile[MAXPATHLEN] = HOLIDAY_FILE_DEF; /* holiday filename */
|
||||
|
||||
int addprefix = 0;
|
||||
char prefixnational[TELNO_MAX] = "";
|
||||
char prefixinternational[TELNO_MAX] = "";
|
||||
|
||||
#else /* !MAIN */
|
||||
|
||||
int isdnfd;
|
||||
@ -743,6 +747,10 @@ time_t starttime;
|
||||
|
||||
char holidayfile[MAXPATHLEN];
|
||||
|
||||
int addprefix;
|
||||
char prefixnational[TELNO_MAX];
|
||||
char prefixinternational[TELNO_MAX];
|
||||
|
||||
#endif /* MAIN */
|
||||
|
||||
char * bdrivername ( int drivertype );
|
||||
|
@ -24,9 +24,9 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.\" last edit-date: [Sun Aug 11 13:03:49 2002]
|
||||
.\" last edit-date: [Sun Aug 11 20:07:38 2002]
|
||||
.\"
|
||||
.Dd March 26, 2002
|
||||
.Dd August 11, 2002
|
||||
.Dt ISDND.RC 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -101,6 +101,17 @@ See also system keyword
|
||||
.Em rotatesuffix .
|
||||
If this keyword is omitted the system default is used.
|
||||
(optional)
|
||||
.It Li add-prefix
|
||||
If set to
|
||||
.Em on ,
|
||||
for incoming numbers, have a look at the "type of number" indicator and
|
||||
adjust the number as specified by the
|
||||
.Em prefix-national
|
||||
and
|
||||
.Em prefix-international
|
||||
keywords described later.
|
||||
If this keyword is omitted, the system default (off) is used.
|
||||
(optional)
|
||||
.It Li aliasing
|
||||
If this parameter is set to
|
||||
.Em on ,
|
||||
@ -203,6 +214,20 @@ The supported access rights are:
|
||||
.It Ar callin
|
||||
.It Ar callout
|
||||
.El
|
||||
.It Li prefix-international
|
||||
In conjunction with the
|
||||
.Em add-prefix
|
||||
switch (see above), specify the prefix number string for incoming numbers
|
||||
with the international number tag. If aliases are used, they have to be
|
||||
adjusted accordingly.
|
||||
(optional)
|
||||
.It Li prefix-national
|
||||
In conjunction with the
|
||||
.Em add-prefix
|
||||
switch (see above), specify the prefix number string for incoming numbers
|
||||
with the national number tag. If aliases are used, they have to be
|
||||
adjusted accordingly.
|
||||
(optional)
|
||||
.It Li ratesfile
|
||||
Specifies the name of the ratesfile.
|
||||
If this keyword is omitted the system
|
||||
|
@ -64,6 +64,14 @@ msg_connect_ind(msg_connect_ind_t *mp)
|
||||
#define SRC (aliasing == 0 ? mp->src_telno : src_tela)
|
||||
#define DST (aliasing == 0 ? mp->dst_telno : dst_tela)
|
||||
|
||||
/* Add prefixes. All preexisting alias files are useless
|
||||
if this is on. */
|
||||
if(addprefix)
|
||||
{
|
||||
add_number_prefix(mp->src_telno, mp->src_ton);
|
||||
add_number_prefix(mp->dst_telno, mp->dst_ton);
|
||||
}
|
||||
|
||||
if(aliasing)
|
||||
{
|
||||
src_tela = get_alias(mp->src_telno);
|
||||
|
@ -361,6 +361,11 @@ cfg_setval(int keyword)
|
||||
strcpy(acctfile, yylval.str);
|
||||
DBGL(DL_RCCF, (log(LL_DBG, "system: acctfile = %s", yylval.str)));
|
||||
break;
|
||||
|
||||
case ADDPREFIX:
|
||||
addprefix = yylval.booln;
|
||||
DBGL(DL_RCCF, (log(LL_DBG, "system: add-prefix = %d", yylval.booln)));
|
||||
break;
|
||||
|
||||
case ALERT:
|
||||
if(yylval.num < MINALERT)
|
||||
@ -910,6 +915,16 @@ cfg_setval(int keyword)
|
||||
set_isppp_auth(entrycount);
|
||||
break;
|
||||
|
||||
case PREFIXINTERNATIONAL:
|
||||
strncpy(prefixinternational, yylval.str, sizeof(prefixinternational)-1);
|
||||
DBGL(DL_RCCF, (log(LL_DBG, "system: prefix-international = %s", prefixinternational)));
|
||||
break;
|
||||
|
||||
case PREFIXNATIONAL:
|
||||
strncpy(prefixnational, yylval.str, sizeof(prefixnational)-1);
|
||||
DBGL(DL_RCCF, (log(LL_DBG, "system: prefix-national = %s", prefixnational)));
|
||||
break;
|
||||
|
||||
case PROTOCOL:
|
||||
DBGL(DL_RCCF, (log(LL_DBG, "controller %d: protocol = %s", controllercount, yylval.str)));
|
||||
if(!(strcmp(yylval.str, "dss1")))
|
||||
|
@ -73,6 +73,7 @@ int controllercount = -1;
|
||||
|
||||
%token ACCTALL
|
||||
%token ACCTFILE
|
||||
%token ADDPREFIX
|
||||
%token ALERT
|
||||
%token ALIASFNAME
|
||||
%token ALIASING
|
||||
@ -141,6 +142,8 @@ int controllercount = -1;
|
||||
%token PPP_SEND_AUTH
|
||||
%token PPP_SEND_NAME
|
||||
%token PPP_SEND_PASSWORD
|
||||
%token PREFIXNATIONAL
|
||||
%token PREFIXINTERNATIONAL
|
||||
%token PROTOCOL
|
||||
%token RATESFILE
|
||||
%token RATETYPE
|
||||
@ -349,6 +352,7 @@ sysfilekeyword: RATESFILE { $$ = RATESFILE; }
|
||||
sysboolkeyword: USEACCTFILE { $$ = USEACCTFILE; }
|
||||
| ALIASING { $$ = ALIASING; }
|
||||
| ACCTALL { $$ = ACCTALL; }
|
||||
| ADDPREFIX { $$ = ADDPREFIX; }
|
||||
| BEEPCONNECT { $$ = BEEPCONNECT; }
|
||||
| EXTCALLATTR { $$ = EXTCALLATTR; }
|
||||
| ISDNTIME { $$ = ISDNTIME; }
|
||||
@ -361,6 +365,8 @@ sysnumkeyword: MONITORPORT { $$ = MONITORPORT; }
|
||||
|
||||
sysstrkeyword: MAILER { $$ = MAILER; }
|
||||
| MAILTO { $$ = MAILTO; }
|
||||
| PREFIXNATIONAL { $$ = PREFIXNATIONAL; }
|
||||
| PREFIXINTERNATIONAL { $$ = PREFIXINTERNATIONAL; }
|
||||
| ROTATESUFFIX { $$ = ROTATESUFFIX; }
|
||||
| REGEXPR { $$ = REGEXPR; }
|
||||
| REGPROG { $$ = REGPROG; }
|
||||
|
@ -87,6 +87,7 @@ int lineno;
|
||||
|
||||
acctall { return ACCTALL; }
|
||||
acctfile { return ACCTFILE; }
|
||||
add-prefix { return ADDPREFIX; }
|
||||
alert { return ALERT; }
|
||||
aliasing { return ALIASING; }
|
||||
aliasfile { return ALIASFNAME; }
|
||||
@ -157,6 +158,8 @@ ppp-expect-password { return PPP_EXPECT_PASSWORD; }
|
||||
ppp-send-auth { return PPP_SEND_AUTH; }
|
||||
ppp-send-name { return PPP_SEND_NAME; }
|
||||
ppp-send-password { return PPP_SEND_PASSWORD; }
|
||||
prefix-international { return PREFIXINTERNATIONAL; }
|
||||
prefix-national { return PREFIXNATIONAL; }
|
||||
protocol { return PROTOCOL; }
|
||||
ratesfile { return RATESFILE; }
|
||||
ratetype { return RATETYPE; }
|
||||
|
@ -1135,4 +1135,32 @@ dayok:
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*
|
||||
* prepend national or international prefix to a number
|
||||
*--------------------------------------------------------------------------*/
|
||||
int add_number_prefix(char *number, int type_of_number)
|
||||
{
|
||||
char tmp[TELNO_MAX];
|
||||
char *prefix;
|
||||
int result = 0;
|
||||
|
||||
if (type_of_number == TON_NATIONAL || type_of_number == TON_INTERNAT)
|
||||
{
|
||||
if (type_of_number == TON_NATIONAL)
|
||||
prefix = prefixnational;
|
||||
else
|
||||
prefix = prefixinternational;
|
||||
|
||||
/* Add prefix only if not already there */
|
||||
if (strncmp(number, prefix, strlen(prefix)) != 0)
|
||||
{
|
||||
snprintf(tmp, sizeof(tmp)-1, "%s%s", prefix, number);
|
||||
strncpy(number, tmp, TELNO_MAX-1);
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
Loading…
x
Reference in New Issue
Block a user