From bab2f90e8c83b6eb980a9fae5c06507af7c9aca5 Mon Sep 17 00:00:00 2001 From: hm Date: Mon, 12 Aug 2002 07:53:55 +0000 Subject: 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 --- sys/i4b/include/i4b_ioctl.h | 9 +++++++-- sys/i4b/include/i4b_l3l4.h | 3 +++ sys/i4b/layer3/i4b_q931.c | 31 ++++++++++++++++++++++++++++++- sys/i4b/layer4/i4b_l4.c | 3 +++ 4 files changed, 43 insertions(+), 3 deletions(-) (limited to 'sys/i4b') diff --git a/sys/i4b/include/i4b_ioctl.h b/sys/i4b/include/i4b_ioctl.h index 5f99628..9df6adb 100644 --- a/sys/i4b/include/i4b_ioctl.h +++ b/sys/i4b/include/i4b_ioctl.h @@ -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*/ diff --git a/sys/i4b/include/i4b_l3l4.h b/sys/i4b/include/i4b_l3l4.h index 89303d7..82ac047 100644 --- a/sys/i4b/include/i4b_l3l4.h +++ b/sys/i4b/include/i4b_l3l4.h @@ -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 */ diff --git a/sys/i4b/layer3/i4b_q931.c b/sys/i4b/layer3/i4b_q931.c index 52c5b87..a3647aa 100644 --- a/sys/i4b/layer3/i4b_q931.c +++ b/sys/i4b/layer3/i4b_q931.c @@ -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; diff --git a/sys/i4b/layer4/i4b_l4.c b/sys/i4b/layer4/i4b_l4.c index 1a7f7e8..517ee10 100644 --- a/sys/i4b/layer4/i4b_l4.c +++ b/sys/i4b/layer4/i4b_l4.c @@ -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; -- cgit v1.1