summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/i386/include/i4b_ioctl.h21
-rw-r--r--sys/i4b/include/i4b_ioctl.h21
-rw-r--r--sys/i4b/include/i4b_l3l4.h2
-rw-r--r--sys/i4b/layer3/i4b_l2if.c26
-rw-r--r--sys/i4b/layer3/i4b_q931.c10
-rw-r--r--sys/i4b/layer3/i4b_q931.h20
-rw-r--r--sys/i4b/layer4/i4b_i4bdrv.c3
-rw-r--r--sys/i4b/layer4/i4b_l4.c28
-rw-r--r--usr.sbin/i4b/isdnd/curses.c14
-rw-r--r--usr.sbin/i4b/isdnd/dial.c35
-rw-r--r--usr.sbin/i4b/isdnd/exec.c12
-rw-r--r--usr.sbin/i4b/isdnd/fsm.c8
-rw-r--r--usr.sbin/i4b/isdnd/isdnd.h29
-rw-r--r--usr.sbin/i4b/isdnd/isdnd.rc.557
-rw-r--r--usr.sbin/i4b/isdnd/monitor.c14
-rw-r--r--usr.sbin/i4b/isdnd/msghdl.c18
-rw-r--r--usr.sbin/i4b/isdnd/rc_config.c63
-rw-r--r--usr.sbin/i4b/isdnd/rc_parse.y14
-rw-r--r--usr.sbin/i4b/isdnd/rc_scan.l9
-rw-r--r--usr.sbin/i4b/isdnd/support.c78
-rw-r--r--usr.sbin/i4b/isdnd/timer.c8
-rw-r--r--usr.sbin/i4b/isdndecode/layer3.c8
-rw-r--r--usr.sbin/i4b/isdnphone/main.c18
23 files changed, 376 insertions, 140 deletions
diff --git a/sys/i386/include/i4b_ioctl.h b/sys/i386/include/i4b_ioctl.h
index 561a131..9f06b10 100644
--- a/sys/i386/include/i4b_ioctl.h
+++ b/sys/i386/include/i4b_ioctl.h
@@ -29,27 +29,19 @@
*
* $FreeBSD$
*
- * last edit-date: [Sun Mar 17 10:09:55 2002]
+ * last edit-date: [Tue Mar 26 14:44:15 2002]
*
*---------------------------------------------------------------------------*/
#ifndef _I4B_IOCTL_H_
#define _I4B_IOCTL_H_
-#if 0
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-#ifndef _MACHINE_TYPES_H_
-#include <machine/types.h>
-#endif /* _MACHINE_TYPES_H_ */
-#endif /* __FreeBSD__ */
-#endif
-
/*---------------------------------------------------------------------------*
* version and release number for isdn4bsd package
*---------------------------------------------------------------------------*/
#define VERSION 1 /* version number */
-#define REL 1 /* release number */
-#define STEP 1 /* release step */
+#define REL 2 /* release number */
+#define STEP 0 /* release step */
/*---------------------------------------------------------------------------*
* date/time format in i4b log messages
@@ -172,6 +164,7 @@
* max length of some strings
*---------------------------------------------------------------------------*/
#define TELNO_MAX 41 /* max length of a telephone number (+ '\0') */
+#define SUBADDR_MAX 21 /* max length of a subaddress (+ '\0') */
#define DISPLAY_MAX 91 /* max length of display information (+ '\0') */
#define DATETIME_MAX 21 /* max length of datetime information (+ '\0')*/
#define KEYPAD_MAX 35 /* max length of a keypad string (+ '\0') */
@@ -341,7 +334,9 @@ typedef struct {
#define CHAN_NO (-2) /* call waiting (CW) for incoming */
int bprot; /* b channel protocot, see BPROT_XXX */
char dst_telno[TELNO_MAX]; /* destination telno */
+ char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */
char src_telno[TELNO_MAX]; /* source telno */
+ char src_subaddr[SUBADDR_MAX]; /* src subaddr */
int scr_ind;/* screening indicator */
#define SCR_NONE 0 /* no screening indicator transmitted */
#define SCR_USR_NOSC 1 /* screening user provided, not screened*/
@@ -412,7 +407,9 @@ typedef struct {
int driver; /* driver type */
int driver_unit; /* driver unit number */
int cmdlen; /* length of string */
+ int subaddrlen; /* length of subaddr */
char cmd[TELNO_MAX]; /* the number to dial */
+ char subaddr[SUBADDR_MAX]; /* dest subaddr */
} msg_dialoutnumber_ind_t;
/*---------------------------------------------------------------------------*
@@ -572,7 +569,9 @@ typedef struct {
#define ULEN_METHOD_STATIC 0 /* use unitlen_time value (see above) */
#define ULEN_METHOD_DYNAMIC 1 /* use AOCD */
char dst_telno[TELNO_MAX]; /* destination telephone no */
+ char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */
char src_telno[TELNO_MAX]; /* source telephone number */
+ char src_subaddr[SUBADDR_MAX]; /* source subaddr */
char keypad[KEYPAD_MAX]; /* keypad string */
} msg_connect_req_t;
diff --git a/sys/i4b/include/i4b_ioctl.h b/sys/i4b/include/i4b_ioctl.h
index 561a131..9f06b10 100644
--- a/sys/i4b/include/i4b_ioctl.h
+++ b/sys/i4b/include/i4b_ioctl.h
@@ -29,27 +29,19 @@
*
* $FreeBSD$
*
- * last edit-date: [Sun Mar 17 10:09:55 2002]
+ * last edit-date: [Tue Mar 26 14:44:15 2002]
*
*---------------------------------------------------------------------------*/
#ifndef _I4B_IOCTL_H_
#define _I4B_IOCTL_H_
-#if 0
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-#ifndef _MACHINE_TYPES_H_
-#include <machine/types.h>
-#endif /* _MACHINE_TYPES_H_ */
-#endif /* __FreeBSD__ */
-#endif
-
/*---------------------------------------------------------------------------*
* version and release number for isdn4bsd package
*---------------------------------------------------------------------------*/
#define VERSION 1 /* version number */
-#define REL 1 /* release number */
-#define STEP 1 /* release step */
+#define REL 2 /* release number */
+#define STEP 0 /* release step */
/*---------------------------------------------------------------------------*
* date/time format in i4b log messages
@@ -172,6 +164,7 @@
* max length of some strings
*---------------------------------------------------------------------------*/
#define TELNO_MAX 41 /* max length of a telephone number (+ '\0') */
+#define SUBADDR_MAX 21 /* max length of a subaddress (+ '\0') */
#define DISPLAY_MAX 91 /* max length of display information (+ '\0') */
#define DATETIME_MAX 21 /* max length of datetime information (+ '\0')*/
#define KEYPAD_MAX 35 /* max length of a keypad string (+ '\0') */
@@ -341,7 +334,9 @@ typedef struct {
#define CHAN_NO (-2) /* call waiting (CW) for incoming */
int bprot; /* b channel protocot, see BPROT_XXX */
char dst_telno[TELNO_MAX]; /* destination telno */
+ char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */
char src_telno[TELNO_MAX]; /* source telno */
+ char src_subaddr[SUBADDR_MAX]; /* src subaddr */
int scr_ind;/* screening indicator */
#define SCR_NONE 0 /* no screening indicator transmitted */
#define SCR_USR_NOSC 1 /* screening user provided, not screened*/
@@ -412,7 +407,9 @@ typedef struct {
int driver; /* driver type */
int driver_unit; /* driver unit number */
int cmdlen; /* length of string */
+ int subaddrlen; /* length of subaddr */
char cmd[TELNO_MAX]; /* the number to dial */
+ char subaddr[SUBADDR_MAX]; /* dest subaddr */
} msg_dialoutnumber_ind_t;
/*---------------------------------------------------------------------------*
@@ -572,7 +569,9 @@ typedef struct {
#define ULEN_METHOD_STATIC 0 /* use unitlen_time value (see above) */
#define ULEN_METHOD_DYNAMIC 1 /* use AOCD */
char dst_telno[TELNO_MAX]; /* destination telephone no */
+ char dst_subaddr[SUBADDR_MAX]; /* dest subaddr */
char src_telno[TELNO_MAX]; /* source telephone number */
+ char src_subaddr[SUBADDR_MAX]; /* source subaddr */
char keypad[KEYPAD_MAX]; /* keypad string */
} msg_connect_req_t;
diff --git a/sys/i4b/include/i4b_l3l4.h b/sys/i4b/include/i4b_l3l4.h
index b4da38a..290a724 100644
--- a/sys/i4b/include/i4b_l3l4.h
+++ b/sys/i4b/include/i4b_l3l4.h
@@ -147,7 +147,9 @@ typedef struct
int call_state; /* from incoming SETUP */
u_char dst_telno[TELNO_MAX]; /* destination number */
+ u_char dst_subaddr[SUBADDR_MAX]; /* destination subaddr */
u_char src_telno[TELNO_MAX]; /* source number */
+ u_char src_subaddr[SUBADDR_MAX]; /* source subaddr */
int scr_ind; /* screening ind for incoming call */
int prs_ind; /* presentation ind for incoming call */
diff --git a/sys/i4b/layer3/i4b_l2if.c b/sys/i4b/layer3/i4b_l2if.c
index 2c94c31..fda3bc7 100644
--- a/sys/i4b/layer3/i4b_l2if.c
+++ b/sys/i4b/layer3/i4b_l2if.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Oct 18 13:29:19 2001]
+ * last edit-date: [Tue Mar 26 15:03:59 2002]
*
*---------------------------------------------------------------------------*/
@@ -422,7 +422,9 @@ i4b_l3_tx_setup(call_desc_t *cd)
u_char *ptr;
int len;
int slen = strlen(cd->src_telno);
+ int sslen = strlen(cd->src_subaddr);
int dlen = strlen(cd->dst_telno);
+ int dslen = strlen(cd->dst_subaddr);
int klen = strlen(cd->keypad);
/*
@@ -437,7 +439,9 @@ i4b_l3_tx_setup(call_desc_t *cd)
len = I_FRAME_HDRLEN +
MSG_SETUP_LEN +
(slen ? (3+slen) : 0) +
+ (sslen ? (3+sslen) : 0) +
(dlen ? (3+dlen) : 0) +
+ (dslen ? (3+dslen) : 0) +
(klen ? (2+klen) : 0) +
(cd->bprot == BPROT_NONE ? 1 : 0);
@@ -521,6 +525,15 @@ i4b_l3_tx_setup(call_desc_t *cd)
ptr += slen;
}
+ if(sslen)
+ {
+ *ptr++ = IEI_CALLINGPS; /* calling subaddr */
+ *ptr++ = IEI_CALLINGPS_LEN+sslen; /* calling subaddr len */
+ *ptr++ = SUBADDR_TYPE_NSAP; /* type = NSAP */
+ strncpy(ptr, cd->src_subaddr, sslen);
+ ptr += sslen;
+ }
+
if(dlen)
{
*ptr++ = IEI_CALLEDPN; /* called party no */
@@ -529,6 +542,15 @@ i4b_l3_tx_setup(call_desc_t *cd)
strncpy(ptr, cd->dst_telno, dlen);
ptr += dlen;
}
+
+ if(dslen)
+ {
+ *ptr++ = IEI_CALLEDPS; /* calling party subaddr */
+ *ptr++ = IEI_CALLEDPS_LEN+dslen;/* calling party subaddr len */
+ *ptr++ = SUBADDR_TYPE_NSAP; /* type = NSAP */
+ strncpy(ptr, cd->dst_subaddr, dslen);
+ ptr += dslen;
+ }
DL_Data_Req(ctrl_desc[cd->controller].unit, m);
}
diff --git a/sys/i4b/layer3/i4b_q931.c b/sys/i4b/layer3/i4b_q931.c
index 89d7a07..52c5b87 100644
--- a/sys/i4b/layer3/i4b_q931.c
+++ b/sys/i4b/layer3/i4b_q931.c
@@ -431,17 +431,21 @@ i4b_decode_q931_cs0_ie(int unit, call_desc_t *cd, int msg_len, u_char *msg_ptr)
break;
case IEI_CALLINGPS: /* calling party subaddress */
- NDBGL3(L3_P_MSG, "IEI_CALLINGPS");
+ memcpy(cd->src_subaddr, &msg_ptr[3], min(SUBADDR_MAX, msg_ptr[1]-1));
+ cd->src_subaddr[min(SUBADDR_MAX, msg_ptr[1] - 1)] = '\0';
+ NDBGL3(L3_P_MSG, "IEI_CALLINGPS = %s", cd->src_subaddr);
break;
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';
+ cd->dst_telno[min(TELNO_MAX, msg_ptr[1] - 1)] = '\0';
NDBGL3(L3_P_MSG, "IEI_CALLED = %s", cd->dst_telno);
break;
case IEI_CALLEDPS: /* called party subaddress */
- NDBGL3(L3_P_MSG, "IEI_CALLEDPS");
+ memcpy(cd->dst_subaddr, &msg_ptr[3], min(SUBADDR_MAX, msg_ptr[1]-1));
+ cd->dst_subaddr[min(SUBADDR_MAX, msg_ptr[1] - 1)] = '\0';
+ NDBGL3(L3_P_MSG, "IEI_CALLEDPS = %s", cd->dst_subaddr);
break;
case IEI_REDIRNO: /* redirecting number */
diff --git a/sys/i4b/layer3/i4b_q931.h b/sys/i4b/layer3/i4b_q931.h
index e00a8b4..e09f023b 100644
--- a/sys/i4b/layer3/i4b_q931.h
+++ b/sys/i4b/layer3/i4b_q931.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Oct 18 13:29:01 2001]
+ * last edit-date: [Tue Mar 26 15:04:33 2002]
*
*---------------------------------------------------------------------------*/
@@ -79,12 +79,12 @@
#define IT_CAP_SPEECH 0x80 /* BC: information xfer capability */
#define IT_CAP_UNR_DIG_INFO 0x88 /* BC: information xfer capability */
-#define IT_RATE_64K 0x90 /* BC: information xfer rate */
-#define IT_UL1_G711A 0xa3 /* layer1 proto G.711 A-law */
+#define IT_RATE_64K 0x90 /* BC: information xfer rate */
+#define IT_UL1_G711A 0xa3 /* layer1 proto G.711 A-law */
#define IEI_CHANNELID_LEN 0x01 /* length of channel id */
-#define CHANNELID_B1 0x81 /* channel = B1 (outgoing) */
-#define CHANNELID_B2 0x82 /* channel = B2 (outgoing) */
+#define CHANNELID_B1 0x81 /* channel = B1 (outgoing) */
+#define CHANNELID_B2 0x82 /* channel = B2 (outgoing) */
#define CHANNELID_ANY 0x83 /* channel = any channel (outgoing) */
#define IE_CHAN_ID_NO 0x00 /* no channel (incoming) */
@@ -94,9 +94,13 @@
#define NUMBER_TYPEPLAN 0x81 /* type of number/numbering plan */
-#define IEI_CALLINGPN_LEN 1 /* without number string ! */
+#define IEI_CALLINGPN_LEN 1 /* without number string ! */
+#define IEI_CALLEDPN_LEN 1 /* without number string ! */
-#define IEI_CALLEDPN_LEN 1 /* without number string ! */
+#define IEI_CALLINGPS_LEN 1
+#define IEI_CALLEDPS_LEN 1
+
+#define SUBADDR_TYPE_NSAP 0x80 /* subaddr: type=NSAP */
/* CONNECT_ACK */
diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c
index 7000add..e0c4d6a 100644
--- a/sys/i4b/layer4/i4b_i4bdrv.c
+++ b/sys/i4b/layer4/i4b_i4bdrv.c
@@ -292,6 +292,9 @@ i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
strcpy(cd->dst_telno, mcr->dst_telno);
strcpy(cd->src_telno, mcr->src_telno);
+ strcpy(cd->dst_subaddr, mcr->dst_subaddr);
+ strcpy(cd->src_subaddr, mcr->src_subaddr);
+
if(mcr->keypad[0] != '\0')
strcpy(cd->keypad, mcr->keypad);
else
diff --git a/sys/i4b/layer4/i4b_l4.c b/sys/i4b/layer4/i4b_l4.c
index 0980862..1f5163b 100644
--- a/sys/i4b/layer4/i4b_l4.c
+++ b/sys/i4b/layer4/i4b_l4.c
@@ -204,6 +204,7 @@ i4b_l4_dialoutnumber(int driver, int driver_unit, int cmdlen, char *cmd)
if((m = i4b_Dgetmbuf(sizeof(msg_dialoutnumber_ind_t))) != NULL)
{
msg_dialoutnumber_ind_t *md = (msg_dialoutnumber_ind_t *)m->m_data;
+ int i;
md->header.type = MSG_DIALOUTNUMBER_IND;
md->header.cdid = -1;
@@ -211,11 +212,20 @@ i4b_l4_dialoutnumber(int driver, int driver_unit, int cmdlen, char *cmd)
md->driver = driver;
md->driver_unit = driver_unit;
- if(cmdlen > TELNO_MAX)
- cmdlen = TELNO_MAX;
+ for (i = 0; i < cmdlen; i++)
+ if (cmd[i] == '*')
+ break;
- md->cmdlen = cmdlen;
- bcopy(cmd, md->cmd, cmdlen);
+ /* XXX: TELNO_MAX is _with_ tailing '\0', so max is actually TELNO_MAX - 1 */
+ md->cmdlen = (i < TELNO_MAX - 1 ? i : TELNO_MAX - 1);
+ /* skip the (first) '*' */
+ md->subaddrlen = (cmdlen - i - 1 < SUBADDR_MAX - 1 ? cmdlen - i - 1 : SUBADDR_MAX - 1);
+
+ bcopy(cmd, md->cmd, md->cmdlen);
+ if (md->subaddrlen != -1)
+ bcopy(cmd+i+1, md->subaddr, md->subaddrlen);
+
+ NDBGL4(L4_TIMO, "cmd[%d]=%s, subaddr[%d]=%s", md->cmdlen, md->cmd, md->subaddrlen, md->subaddr);
i4bputqueue(m);
}
}
@@ -365,11 +375,21 @@ i4b_l4_connect_ind(call_desc_t *cd)
else
strcpy(mp->dst_telno, TELNO_EMPTY);
+ if(strlen(cd->dst_subaddr) > 0)
+ strcpy(mp->dst_subaddr, cd->dst_subaddr);
+ else
+ strcpy(mp->dst_subaddr, TELNO_EMPTY);
+
if(strlen(cd->src_telno) > 0)
strcpy(mp->src_telno, cd->src_telno);
else
strcpy(mp->src_telno, TELNO_EMPTY);
+ if(strlen(cd->src_subaddr) > 0)
+ strcpy(mp->src_subaddr, cd->src_subaddr);
+ else
+ strcpy(mp->src_subaddr, TELNO_EMPTY);
+
strcpy(mp->display, cd->display);
mp->scr_ind = cd->scr_ind;
diff --git a/usr.sbin/i4b/isdnd/curses.c b/usr.sbin/i4b/isdnd/curses.c
index cd4191f..19e7af7 100644
--- a/usr.sbin/i4b/isdnd/curses.c
+++ b/usr.sbin/i4b/isdnd/curses.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b daemon - curses fullscreen output
* -------------------------------------
*
- * $Id: curses.c,v 1.36 2000/10/09 12:53:29 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Jun 1 16:24:43 2000]
+ * last edit-date: [Tue Mar 26 14:35:33 2002]
*
*---------------------------------------------------------------------------*/
@@ -408,16 +406,16 @@ display_connect(cfg_entry_t *cep)
if(aliasing)
{
if(cep->direction == DIR_IN)
- snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->real_phone_incoming));
+ snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->real_phone_incoming.number));
else
- snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->remote_phone_dialout));
+ snprintf(buffer, sizeof(buffer), "%s", get_alias(cep->remote_phone_dialout.number));
}
else
{
if(cep->direction == DIR_IN)
- snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->real_phone_incoming);
+ snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->real_phone_incoming.number);
else
- snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->remote_phone_dialout);
+ snprintf(buffer, sizeof(buffer), "%s/%s", cep->name, cep->remote_phone_dialout.number);
}
buffer[H_IFN - H_TELN - 1] = '\0';
diff --git a/usr.sbin/i4b/isdnd/dial.c b/usr.sbin/i4b/isdnd/dial.c
index 0bb362c..5ccbd33 100644
--- a/usr.sbin/i4b/isdnd/dial.c
+++ b/usr.sbin/i4b/isdnd/dial.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Oct 18 11:05:01 2001]
+ * last edit-date: [Tue Mar 26 14:35:19 2002]
*
*---------------------------------------------------------------------------*/
@@ -55,16 +55,18 @@ select_first_dialno(cfg_entry_t *cep)
if(cep->remote_numbers_count == 1)
{
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[0].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: only one no, no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number);
+ strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: only one no, no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = 0;
return;
}
if(cep->remote_numbers_handling == RNH_FIRST)
{
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[0].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use first, no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number);
+ strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use first, no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = 0;
return;
}
@@ -77,8 +79,9 @@ select_first_dialno(cfg_entry_t *cep)
{
if(cep->remote_numbers_handling == RNH_LAST)
{
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[i].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use last, no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[i].number);
+ strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[i].subaddr);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use last, no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = i;
return;
}
@@ -87,8 +90,9 @@ select_first_dialno(cfg_entry_t *cep)
if(++i >= cep->remote_numbers_count)
i = 0;
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[i].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use next, no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[i].number);
+ strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[i].subaddr);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: use next, no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = i;
return;
}
@@ -97,8 +101,8 @@ select_first_dialno(cfg_entry_t *cep)
if(++i >= cep->remote_numbers_count)
i = 0;
}
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[0].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: no last found (use 0), no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_first_dialno: no last found (use 0), no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = 0;
}
@@ -116,8 +120,9 @@ select_next_dialno(cfg_entry_t *cep)
if(cep->remote_numbers_count == 1)
{
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[0].number);
- DBGL(DL_DIAL, (log(LL_DBG, "select_next_dialno: only one no, no = %s", cep->remote_phone_dialout)));
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[0].number);
+ strcpy(cep->remote_phone_dialout.subaddr, cep->remote_numbers[0].subaddr);
+ DBGL(DL_DIAL, (log(LL_DBG, "select_next_dialno: only one no, no = %s", cep->remote_phone_dialout.number)));
cep->last_remote_number = 0;
return;
}
@@ -133,7 +138,7 @@ select_next_dialno(cfg_entry_t *cep)
if(cep->last_remote_number >= cep->remote_numbers_count)
cep->last_remote_number = 0;
- strcpy(cep->remote_phone_dialout, cep->remote_numbers[cep->last_remote_number].number);
+ strcpy(cep->remote_phone_dialout.number, cep->remote_numbers[cep->last_remote_number].number);
DBGL(DL_DIAL, (log(LL_DBG, "select_next_dialno: index=%d, no=%s",
cep->last_remote_number,
diff --git a/usr.sbin/i4b/isdnd/exec.c b/usr.sbin/i4b/isdnd/exec.c
index 6c9ed62..17bc88e 100644
--- a/usr.sbin/i4b/isdnd/exec.c
+++ b/usr.sbin/i4b/isdnd/exec.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Mon Nov 19 15:21:38 2001]
+ * last edit-date: [Tue Mar 26 14:35:46 2002]
*
*---------------------------------------------------------------------------*/
@@ -228,13 +228,13 @@ exec_answer(cfg_entry_t *cep)
/* if destination telephone number avail, add it as argument */
- if(*cep->local_phone_incoming)
- argv[4] = cep->local_phone_incoming;
+ if(*cep->local_phone_incoming.number)
+ argv[4] = cep->local_phone_incoming.number;
/* if source telephone number avail, add it as argument */
- if(*cep->real_phone_incoming)
- argv[6] = cep->real_phone_incoming;
+ if(*cep->real_phone_incoming.number)
+ argv[6] = cep->real_phone_incoming.number;
if(*cep->display)
{
diff --git a/usr.sbin/i4b/isdnd/fsm.c b/usr.sbin/i4b/isdnd/fsm.c
index fc1d2f4..e555fa8 100644
--- a/usr.sbin/i4b/isdnd/fsm.c
+++ b/usr.sbin/i4b/isdnd/fsm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Sat Jul 21 18:25:48 2001]
+ * last edit-date: [Tue Mar 26 14:35:56 2002]
*
*---------------------------------------------------------------------------*/
@@ -210,7 +210,7 @@ F_DFL(cfg_entry_t *cep)
{
cep->dial_count++;
- if(cep->dial_count < cep->dialretries || cep->dialretries == -1) /* Added by FST <mailto:fsteevie@dds.nl> for unlimited dialing (sorry, but I needed it) */
+ if(cep->dial_count < cep->dialretries || cep->dialretries == -1)
{
/* inside normal retry cycle */
@@ -288,7 +288,7 @@ F_ACBR(cfg_entry_t *cep)
{
cep->dial_count++;
- if(cep->dial_count < cep->dialretries || cep->dialretries == -1) /* Added by FST <mailto:fsteevie@dds.nl> for unlimited dialing (sorry, but I needed it) */
+ if(cep->dial_count < cep->dialretries || cep->dialretries == -1)
{
/* inside normal retry cycle */
diff --git a/usr.sbin/i4b/isdnd/isdnd.h b/usr.sbin/i4b/isdnd/isdnd.h
index 8fdf80d..91285f3 100644
--- a/usr.sbin/i4b/isdnd/isdnd.h
+++ b/usr.sbin/i4b/isdnd/isdnd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Dec 27 10:16:53 2001]
+ * last edit-date: [Tue Mar 26 14:36:20 2002]
*
*---------------------------------------------------------------------------*/
@@ -208,7 +208,16 @@ enum events
* this struct describes the numbers to try to dial out
*---------------------------------------------------------------------------*/
typedef struct {
+ char number[TELNO_MAX]; /* number */
+ char subaddr[SUBADDR_MAX]; /* subaddr */
+} number_t;
+
+/*---------------------------------------------------------------------------*
+ * this struct describes the numbers to try to dial out
+ *---------------------------------------------------------------------------*/
+typedef struct {
char number[TELNO_MAX]; /* remote number to dial */
+ char subaddr[SUBADDR_MAX]; /* remote subaddr */
int flag; /* usage flag */
#define RNF_IDLE 0
#define RNF_SUCC 1 /* last dial was ok */
@@ -219,6 +228,7 @@ typedef struct {
*---------------------------------------------------------------------------*/
typedef struct {
char number[TELNO_MAX]; /* calling party number */
+ char subaddr[SUBADDR_MAX];/* calling party subaddr */
} incoming_number_t;
/*---------------------------------------------------------------------------*
@@ -250,20 +260,23 @@ typedef struct cfg_entry {
int usrdeviceunit; /* userland unit to use */
int remote_numbers_count; /* number of remote numbers */
+ int remote_subaddr_count; /* number of remote subaddr */
#define MAXRNUMBERS 8 /* max remote numbers */
remote_number_t remote_numbers[MAXRNUMBERS]; /* remote numbers to dial */
+
int remote_numbers_handling; /* how to handle the remote dialing */
#define RNH_NEXT 0 /* use next number after last successfull */
#define RNH_LAST 1 /* use last successfull for next call */
#define RNH_FIRST 2 /* always use first number for next call */
- char local_phone_dialout[TELNO_MAX]; /* our number to tell remote*/
- char local_phone_incoming[TELNO_MAX]; /* answer calls for this local number */
+ number_t local_phone_dialout; /* our number to tell remote*/
+ number_t local_phone_incoming; /* answer calls for this local number */
#define MAX_INCOMING 8
int incoming_numbers_count; /* number of incoming allowed numbers */
+ int incoming_subaddr_count; /* number of incoming allowed subaddr */
incoming_number_t remote_phone_incoming[MAX_INCOMING]; /* answer calls from this remote machine */
int dialin_reaction; /* what to do with incoming calls */
@@ -340,6 +353,8 @@ typedef struct cfg_entry {
#define DIR_INONLY 1
#define DIR_OUTONLY 2
+ int usesubaddr; /* use subaddresses */
+
int budget_callbackperiod; /* length of a budget period (s)*/
int budget_callbackncalls; /* call budget for a period */
char *budget_callbacks_file; /* filename to store callback stats */
@@ -438,11 +453,11 @@ typedef struct cfg_entry {
int hangup; /* flag, hangup connection asap */
- char real_phone_incoming[TELNO_MAX]; /* real remote telno in case of wildcard */
+ number_t real_phone_incoming; /* real remote telno in case of wildcard */
int last_remote_number; /* index of last used dialout number*/
- char remote_phone_dialout[TELNO_MAX]; /* used remote number to dial */
+ number_t remote_phone_dialout; /* used remote number to dial */
int direction; /* incoming or outgoing */
#define DIR_IN 0
@@ -752,7 +767,7 @@ int exec_answer ( cfg_entry_t *cep );
int exec_connect_prog ( cfg_entry_t *cep, const char *prog, int link_down );
pid_t exec_prog ( char *prog, char **arglist );
cfg_entry_t * find_by_device_for_dialout ( int drivertype, int driverunit );
-cfg_entry_t *find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, char *cmd);
+cfg_entry_t *find_by_device_for_dialoutnumber(msg_dialoutnumber_ind_t *mp);
cfg_entry_t *find_by_device_for_keypad(int drivertype, int driverunit, int cmdlen, char *cmd);
cfg_entry_t * find_matching_entry_incoming ( msg_connect_ind_t *mp );
cfg_entry_t * find_active_entry_by_driver ( int drivertype, int driverunit );
diff --git a/usr.sbin/i4b/isdnd/isdnd.rc.5 b/usr.sbin/i4b/isdnd/isdnd.rc.5
index 4ede33e..1533b93 100644
--- a/usr.sbin/i4b/isdnd/isdnd.rc.5
+++ b/usr.sbin/i4b/isdnd/isdnd.rc.5
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+.\" Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -24,9 +24,9 @@
.\"
.\" $FreeBSD$
.\"
-.\" last edit-date: [Sat Jul 21 13:27:41 2001]
+.\" last edit-date: [Tue Mar 26 14:35:02 2002]
.\"
-.Dd July 21, 2001
+.Dd March 26, 2002
.Dt ISDND.RC 5
.Os
.Sh NAME
@@ -577,6 +577,15 @@ out to a remote site, the number specified here is put into the
This keyword is mandatory for the
.Em ipr
user-land interfaces.
+.It Li local-subaddr-dialout
+The local subaddress used when the local site dials out.
+When dialing
+out to a remote site, the subaddress specified here is put into the
+.Em "Calling Party Subaddress Information Element" .
+.Pp
+This keyword is mandatory for the
+.Em ipr
+user-land interfaces.
.It Li local-phone-incoming
The local telephone number used for verifying the destination of incoming
calls.
@@ -590,6 +599,19 @@ got from the telephone exchange.
This keyword is mandatory for the
.Em ipr
interfaces.
+.It Li local-subaddr-incoming
+The local subaddress used for verifying the destination of incoming
+calls.
+When a remote site dials in, this subaddress is used to verify that it
+is the local site which the remote site wants to connect to.
+It is compared
+with the
+.Em "Called Party Subaddress Information Element"
+got from the telephone exchange.
+.Pp
+This keyword is mandatory for the
+.Em ipr
+interfaces.
.It Li name
Defines a symbolic name for this configuration entry.
Its purpose is to
@@ -757,6 +779,17 @@ This keyword is mandatory for the
interfaces.
It may be specified more than once to try to dial to several
numbers until one succeeds.
+.It Li remote-subaddr-dialout
+The remote subaddress used when the local site dials out.
+When dialing
+out to a remote site, the subaddress specified here is put into the
+.Em "Called Party Subaddress Information Element" .
+.Pp
+This keyword is mandatory for the
+.Em ipr
+interfaces.
+It may be specified more than once to linked it to the
+remote-phone-dialout numbers until one succeeds.
.It Li remote-phone-incoming
The remote telephone number used to verify an incoming call.
When a remote site
@@ -770,6 +803,19 @@ got from the telephone exchange.
This keyword is mandatory for the ipr interfaces.
.Pp
This keyword may have a wildcard parameter '*' to permit anyone dialing in.
+.It Li remote-subaddr-incoming
+The remote subaddress used to verify an incoming call.
+When a remote site
+dials in, this subaddress is used to verify that it is the correct remote site
+which is herewith authorized to connect into the local system.
+This parameter
+is compared against the
+.Em "Calling Party Subaddress Information Element"
+got from the telephone exchange.
+.Pp
+This keyword is mandatory for the ipr interfaces.
+.Pp
+This keyword may have a wildcard parameter '*' to permit anyone dialing in.
.It Li unitlength
The length of a charging unit in seconds.
This is used in conjunction with
@@ -834,6 +880,11 @@ dialing activities in case of transient failures (such as busy lines).
This parameter is optional and is set to
.Em off
by default.
+.It Li usesubaddr
+is used to enable the use of subaddresses.
+This parameter is optional and is set to
+.Em off
+by default.
.It Li valid
.Em Note :
this feature is considered experimental!
diff --git a/usr.sbin/i4b/isdnd/monitor.c b/usr.sbin/i4b/isdnd/monitor.c
index bd934d1..45952eb 100644
--- a/usr.sbin/i4b/isdnd/monitor.c
+++ b/usr.sbin/i4b/isdnd/monitor.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998,1999 Martin Husemann. All rights reserved.
+ * Copyright (c) 1998, 1999 Martin Husemann. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,11 +33,9 @@
* i4b daemon - network monitor server module
* ------------------------------------------
*
- * $Id: monitor.c,v 1.30 2000/10/09 12:53:29 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Mon Dec 13 21:47:44 1999]
+ * last edit-date: [Tue Mar 26 14:37:03 2002]
*
*---------------------------------------------------------------------------*/
@@ -1071,13 +1069,13 @@ monitor_evnt_connect(cfg_entry_t *cep)
if(cep->direction == DIR_OUT)
{
- I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->remote_phone_dialout);
- I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_dialout);
+ I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->remote_phone_dialout.number);
+ I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_dialout.number);
}
else
{
- I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->real_phone_incoming);
- I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_incoming);
+ I4B_PUT_STR(evnt, I4B_MON_CONNECT_REMPHONE, cep->real_phone_incoming.number);
+ I4B_PUT_STR(evnt, I4B_MON_CONNECT_LOCPHONE, cep->local_phone_incoming.number);
}
monitor_broadcast(mask, evnt, sizeof evnt);
}
diff --git a/usr.sbin/i4b/isdnd/msghdl.c b/usr.sbin/i4b/isdnd/msghdl.c
index d53f578..0d5364a 100644
--- a/usr.sbin/i4b/isdnd/msghdl.c
+++ b/usr.sbin/i4b/isdnd/msghdl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Oct 18 11:13:29 2001]
+ * last edit-date: [Tue Mar 26 14:37:25 2002]
*
*---------------------------------------------------------------------------*/
@@ -831,7 +831,7 @@ msg_dialoutnumber(msg_dialoutnumber_ind_t *mp)
DBGL(DL_DRVR, (log(LL_DBG, "msg_dialoutnumber: dial req from %s, unit %d", bdrivername(mp->driver), mp->driver_unit)));
- if((cep = find_by_device_for_dialoutnumber(mp->driver, mp->driver_unit, mp->cmdlen, mp->cmd)) == NULL)
+ if((cep = find_by_device_for_dialoutnumber(mp)) == NULL)
{
DBGL(DL_DRVR, (log(LL_DBG, "msg_dialoutnumber: config entry reserved or no match")));
return;
@@ -1216,8 +1216,12 @@ sendm_connect_req(cfg_entry_t *cep)
else
mcr.unitlen_method = ULEN_METHOD_STATIC;
- strcpy(mcr.dst_telno, cep->remote_phone_dialout);
- strcpy(mcr.src_telno, cep->local_phone_dialout);
+ strcpy(mcr.dst_telno, cep->remote_phone_dialout.number);
+ if(cep->usesubaddr)
+ strcpy(mcr.dst_subaddr, cep->remote_phone_dialout.subaddr);
+ strcpy(mcr.src_telno, cep->local_phone_dialout.number);
+ if(cep->usesubaddr)
+ strcpy(mcr.src_subaddr, cep->local_phone_dialout.subaddr);
strcpy(mcr.keypad, cep->keypad);
cep->last_dial_time = time(NULL);
@@ -1236,8 +1240,8 @@ sendm_connect_req(cfg_entry_t *cep)
log(LL_CHD, "%05d %s dialing out from %s to %s",
cep->cdid,
cep->name,
- aliasing ? get_alias(cep->local_phone_dialout) : cep->local_phone_dialout,
- aliasing ? get_alias(cep->remote_phone_dialout) : cep->remote_phone_dialout);
+ aliasing ? get_alias(cep->local_phone_dialout.number) : cep->local_phone_dialout.number,
+ aliasing ? get_alias(cep->remote_phone_dialout.number) : cep->remote_phone_dialout.number);
return(ret);
}
diff --git a/usr.sbin/i4b/isdnd/rc_config.c b/usr.sbin/i4b/isdnd/rc_config.c
index 9d27231..09a2c2e 100644
--- a/usr.sbin/i4b/isdnd/rc_config.c
+++ b/usr.sbin/i4b/isdnd/rc_config.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Wed Dec 26 12:57:07 2001]
+ * last edit-date: [Tue Mar 26 14:37:38 2002]
*
*---------------------------------------------------------------------------*/
@@ -219,6 +219,8 @@ set_config_defaults(void)
cep->state = ST_IDLE;
cep->aoc_valid = AOC_INVALID;
+
+ cep->usesubaddr = 0;
}
}
@@ -769,12 +771,22 @@ cfg_setval(int keyword)
case LOCAL_PHONE_DIALOUT:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: local_phone_dialout = %s", entrycount, yylval.str)));
- strcpy(cfg_entry_tab[entrycount].local_phone_dialout, yylval.str);
+ strcpy(cfg_entry_tab[entrycount].local_phone_dialout.number, yylval.str);
+ break;
+
+ case LOCAL_SUBADDR_DIALOUT:
+ DBGL(DL_RCCF, (log(LL_DBG, "entry %d: local_subaddr_dialout = %s", entrycount, yylval.str)));
+ strcpy(cfg_entry_tab[entrycount].local_phone_dialout.subaddr, yylval.str);
break;
case LOCAL_PHONE_INCOMING:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: local_phone_incoming = %s", entrycount, yylval.str)));
- strcpy(cfg_entry_tab[entrycount].local_phone_incoming, yylval.str);
+ strcpy(cfg_entry_tab[entrycount].local_phone_incoming.number, yylval.str);
+ break;
+
+ case LOCAL_SUBADDR_INCOMING:
+ DBGL(DL_RCCF, (log(LL_DBG, "entry %d: local_subaddr_incoming = %s", entrycount, yylval.str)));
+ strcpy(cfg_entry_tab[entrycount].local_phone_incoming.subaddr, yylval.str);
break;
case MAILER:
@@ -941,6 +953,21 @@ cfg_setval(int keyword)
break;
+ case REMOTE_SUBADDR_DIALOUT:
+ if(cfg_entry_tab[entrycount].remote_subaddr_count >= MAXRNUMBERS)
+ {
+ log(LL_ERR, "ERROR parsing config file: too many remote subaddresses at line %d!", lineno);
+ config_error_flag++;
+ break;
+ }
+
+ DBGL(DL_RCCF, (log(LL_DBG, "entry %d: remote_subaddr_dialout #%d = %s",
+ entrycount, cfg_entry_tab[entrycount].remote_numbers_count, yylval.str)));
+
+ strcpy(cfg_entry_tab[entrycount].remote_numbers[cfg_entry_tab[entrycount].remote_numbers_count].subaddr, yylval.str);
+
+ break;
+
case REMOTE_NUMBERS_HANDLING:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: remdial_handling = %s", entrycount, yylval.str)));
if(!(strcmp(yylval.str, "next")))
@@ -972,6 +999,21 @@ cfg_setval(int keyword)
}
break;
+ case REMOTE_SUBADDR_INCOMING:
+ {
+ int n;
+ n = cfg_entry_tab[entrycount].incoming_numbers_count;
+ if (n >= MAX_INCOMING)
+ {
+ log(LL_ERR, "ERROR parsing config file: too many \"remote_subaddr_incoming\" entries at line %d!", lineno);
+ config_error_flag++;
+ break;
+ }
+ DBGL(DL_RCCF, (log(LL_DBG, "entry %d: remote_subaddr_incoming #%d = %s", entrycount, n, yylval.str)));
+ strcpy(cfg_entry_tab[entrycount].remote_phone_incoming[n].subaddr, yylval.str);
+ }
+ break;
+
case RATESFILE:
strcpy(ratesfile, yylval.str);
DBGL(DL_RCCF, (log(LL_DBG, "system: ratesfile = %s", yylval.str)));
@@ -1136,6 +1178,11 @@ cfg_setval(int keyword)
DBGL(DL_RCCF, (log(LL_DBG, "system: useacctfile = %d", yylval.booln)));
break;
+ case USESUBADDR:
+ cfg_entry_tab[entrycount].usesubaddr = yylval.booln;
+ DBGL(DL_RCCF, (log(LL_DBG, "entry %d: usesubaddr = %d", entrycount, yylval.booln)));
+ break;
+
case USEDOWN:
DBGL(DL_RCCF, (log(LL_DBG, "entry %d: usedown = %d", entrycount, yylval.booln)));
cfg_entry_tab[entrycount].usedown = yylval.booln;
@@ -1280,7 +1327,7 @@ check_config(void)
log(LL_ERR, "check_config: remote-phone-dialout not set in entry %d!", i);
error++;
}
- if(strlen(cep->local_phone_dialout) == 0)
+ if(strlen(cep->local_phone_dialout.number) == 0)
{
log(LL_ERR, "check_config: local-phone-dialout not set in entry %d!", i);
error++;
@@ -1291,7 +1338,7 @@ check_config(void)
if(cep->inout != DIR_OUTONLY)
{
- if(strlen(cep->local_phone_incoming) == 0)
+ if(strlen(cep->local_phone_incoming.number) == 0)
{
log(LL_ERR, "check_config: local-phone-incoming not set in entry %d!", i);
error++;
@@ -1616,7 +1663,7 @@ print_config(void)
fprintf(PFILE, "remote-phone-dialout = %s\t\t# telephone number for dialing out to remote\n", cep->remote_numbers[0].number);
}
- fprintf(PFILE, "local-phone-dialout = %s\t\t# show this number to remote when dialling out\n", cep->local_phone_dialout);
+ fprintf(PFILE, "local-phone-dialout = %s\t\t# show this number to remote when dialling out\n", cep->local_phone_dialout.number);
fprintf(PFILE, "dialout-type = %s\n", cep->dialouttype ? "calledback\t\t# i am called back by remote" : "normal\t\t# i am not called back by remote");
}
@@ -1624,7 +1671,7 @@ print_config(void)
{
int n;
- fprintf(PFILE, "local-phone-incoming = %s\t\t# incoming calls must match this (mine) telephone number\n", cep->local_phone_incoming);
+ fprintf(PFILE, "local-phone-incoming = %s\t\t# incoming calls must match this (mine) telephone number\n", cep->local_phone_incoming.number);
for (n = 0; n < cep->incoming_numbers_count; n++)
fprintf(PFILE, "remote-phone-incoming = %s\t\t# this is a valid remote number to call me\n",
cep->remote_phone_incoming[n].number);
diff --git a/usr.sbin/i4b/isdnd/rc_parse.y b/usr.sbin/i4b/isdnd/rc_parse.y
index 529a6a8..6630de9 100644
--- a/usr.sbin/i4b/isdnd/rc_parse.y
+++ b/usr.sbin/i4b/isdnd/rc_parse.y
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1997 Joerg Wunsch. All rights reserved.
*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Fri Jul 20 19:14:23 2001]
+ * last edit-date: [Tue Mar 26 14:37:50 2002]
*
*---------------------------------------------------------------------------*/
@@ -117,7 +117,9 @@ int controllercount = -1;
%token ISDNTXDELIN
%token ISDNTXDELOUT
%token LOCAL_PHONE_DIALOUT
+%token LOCAL_SUBADDR_DIALOUT
%token LOCAL_PHONE_INCOMING
+%token LOCAL_SUBADDR_INCOMING
%token LOGEVENTS
%token MAILER
%token MAILTO
@@ -147,7 +149,9 @@ int controllercount = -1;
%token REGPROG
%token REMOTE_NUMBERS_HANDLING
%token REMOTE_PHONE_DIALOUT
+%token REMOTE_SUBADDR_DIALOUT
%token REMOTE_PHONE_INCOMING
+%token REMOTE_SUBADDR_INCOMING
%token RESTRICTEDCMD
%token ROTATESUFFIX
%token RTPRIO
@@ -156,6 +160,7 @@ int controllercount = -1;
%token UNITLENGTH
%token UNITLENGTHSRC
%token USEACCTFILE
+%token USESUBADDR
%token USEDOWN
%token USRDEVICENAME
%token USRDEVICEUNIT
@@ -427,7 +432,9 @@ strkeyword: ANSWERPROG { $$ = ANSWERPROG; }
| DISCONNECTPROG { $$ = DISCONNECTPROG; }
| IDLE_ALG_OUT { $$ = IDLE_ALG_OUT; }
| LOCAL_PHONE_INCOMING { $$ = LOCAL_PHONE_INCOMING; }
+ | LOCAL_SUBADDR_INCOMING { $$ = LOCAL_SUBADDR_INCOMING; }
| LOCAL_PHONE_DIALOUT { $$ = LOCAL_PHONE_DIALOUT; }
+ | LOCAL_SUBADDR_DIALOUT { $$ = LOCAL_SUBADDR_DIALOUT; }
| NAME { $$ = NAME; }
| PPP_EXPECT_AUTH { $$ = PPP_EXPECT_AUTH; }
| PPP_EXPECT_NAME { $$ = PPP_EXPECT_NAME; }
@@ -438,7 +445,9 @@ strkeyword: ANSWERPROG { $$ = ANSWERPROG; }
| REACTION { $$ = REACTION; }
| REMOTE_NUMBERS_HANDLING { $$ = REMOTE_NUMBERS_HANDLING; }
| REMOTE_PHONE_INCOMING { $$ = REMOTE_PHONE_INCOMING; }
+ | REMOTE_SUBADDR_INCOMING { $$ = REMOTE_SUBADDR_INCOMING; }
| REMOTE_PHONE_DIALOUT { $$ = REMOTE_PHONE_DIALOUT; }
+ | REMOTE_SUBADDR_DIALOUT { $$ = REMOTE_SUBADDR_DIALOUT; }
| UNITLENGTHSRC { $$ = UNITLENGTHSRC; }
| USRDEVICENAME { $$ = USRDEVICENAME; }
| VALID { $$ = VALID; }
@@ -475,6 +484,7 @@ boolkeyword: BUDGETCALLBACKSFILEROTATE { $$ = BUDGETCALLBACKSFILEROTATE; }
| PPP_AUTH_RECHALLENGE { $$ = PPP_AUTH_RECHALLENGE; }
| PPP_AUTH_PARANOID { $$ = PPP_AUTH_PARANOID; }
| USEDOWN { $$ = USEDOWN; }
+ | USESUBADDR { $$ = USESUBADDR; }
;
/* ================== */
diff --git a/usr.sbin/i4b/isdnd/rc_scan.l b/usr.sbin/i4b/isdnd/rc_scan.l
index 34a55dc..d8cdfb6 100644
--- a/usr.sbin/i4b/isdnd/rc_scan.l
+++ b/usr.sbin/i4b/isdnd/rc_scan.l
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1997 Joerg Wunsch. All rights reserved.
*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Fri Jul 20 19:14:55 2001]
+ * last edit-date: [Tue Mar 26 14:37:59 2002]
*
*---------------------------------------------------------------------------*/
@@ -128,7 +128,9 @@ isdntime { return ISDNTIME; }
isdntxdel-incoming { return ISDNTXDELIN; }
isdntxdel-outgoing { return ISDNTXDELOUT; }
local-phone-dialout { return LOCAL_PHONE_DIALOUT; }
+local-subaddr-dialout { return LOCAL_SUBADDR_DIALOUT; }
local-phone-incoming { return LOCAL_PHONE_INCOMING; }
+local-subaddr-incoming { return LOCAL_SUBADDR_INCOMING; }
mailer { return MAILER; }
mailto { return MAILTO; }
maxconnecttime { return MAXCONNECTTIME; }
@@ -162,7 +164,9 @@ regexpr { return REGEXPR; }
regprog { return REGPROG; }
remdial-handling { return REMOTE_NUMBERS_HANDLING; }
remote-phone-dialout { return REMOTE_PHONE_DIALOUT; }
+remote-subaddr-dialout { return REMOTE_SUBADDR_DIALOUT; }
remote-phone-incoming { return REMOTE_PHONE_INCOMING; }
+remote-subaddr-incoming { return REMOTE_SUBADDR_INCOMING; }
rotatesuffix { return ROTATESUFFIX; }
rtprio { return RTPRIO; }
system { return SYSTEM; }
@@ -170,6 +174,7 @@ tinainitprog { return TINAINITPROG; }
unitlength { return UNITLENGTH; }
unitlengthsrc { return UNITLENGTHSRC; }
useacctfile { return USEACCTFILE; }
+usesubaddr { return USESUBADDR; }
usrdevicename { return USRDEVICENAME; }
usrdeviceunit { return USRDEVICEUNIT; }
usedown { return USEDOWN; }
diff --git a/usr.sbin/i4b/isdnd/support.c b/usr.sbin/i4b/isdnd/support.c
index 92e5222..cd5e36d 100644
--- a/usr.sbin/i4b/isdnd/support.c
+++ b/usr.sbin/i4b/isdnd/support.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Oct 18 13:14:55 2001]
+ * last edit-date: [Tue Mar 26 14:38:11 2002]
*
*---------------------------------------------------------------------------*/
@@ -150,7 +150,7 @@ find_by_device_for_dialout(int drivertype, int driverunit)
* find entry by drivertype and driverunit and setup for dialing out
*---------------------------------------------------------------------------*/
cfg_entry_t *
-find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, char *cmd)
+find_by_device_for_dialoutnumber(msg_dialoutnumber_ind_t *mp)
{
cfg_entry_t *cep = NULL;
int i, j;
@@ -161,8 +161,8 @@ find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, cha
/* compare driver type and unit */
- if(!((cep->usrdevicename == drivertype) &&
- (cep->usrdeviceunit == driverunit)))
+ if(!((cep->usrdevicename == mp->driver) &&
+ (cep->usrdeviceunit == mp->driver_unit)))
{
continue;
}
@@ -195,17 +195,31 @@ find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, cha
/* check number and copy to cep->remote_numbers[] */
- for(j = 0; j < cmdlen; j++)
+ for(j = 0; j < mp->cmdlen; j++)
{
- if(!(isdigit(*(cmd+j))))
+ if(!(isdigit(*(mp->cmd+j))))
{
DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, dial string contains non-digit at pos %d", i, j)));
return(NULL);
}
/* fill in number to dial */
- cep->remote_numbers[0].number[j] = *(cmd+j);
+ cep->remote_numbers[0].number[j] = *(mp->cmd+j);
}
cep->remote_numbers[0].number[j] = '\0';
+
+/* XXX subaddr does not have to be a digit! isgraph() would be a better idea */
+ for(j = 0; j < mp->subaddrlen; j++)
+ {
+ if(!(isdigit(*(mp->subaddr+j))))
+ {
+ DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_dialoutnumber: entry %d, subaddr string contains non-digit at pos %d", i, j)));
+ return(NULL);
+ }
+ /* fill in number to dial */
+ cep->remote_numbers[0].subaddr[j] = *(mp->subaddr+j);
+ }
+ cep->remote_numbers[0].subaddr[j] = '\0';
+
cep->remote_numbers_count = 1;
if((setup_dialout(cep)) == GOOD)
@@ -273,7 +287,7 @@ find_by_device_for_keypad(int drivertype, int driverunit, int cmdlen, char *cmd)
cep->remote_numbers[0].number[0] = '\0';
cep->remote_numbers_count = 0;
- cep->remote_phone_dialout[0] = '\0';
+ cep->remote_phone_dialout.number[0] = '\0';
bzero(cep->keypad, KEYPAD_MAX);
strncpy(cep->keypad, cmd, cmdlen);
@@ -430,31 +444,59 @@ find_matching_entry_incoming(msg_connect_ind_t *mp)
/* check my number */
- if(strncmp(cep->local_phone_incoming, mp->dst_telno, strlen(cep->local_phone_incoming)))
+ if(strncmp(cep->local_phone_incoming.number, mp->dst_telno, strlen(cep->local_phone_incoming.number)))
{
DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, myno %s != incomingno %s", i,
- cep->local_phone_incoming, mp->dst_telno)));
+ cep->local_phone_incoming.number, mp->dst_telno)));
+ continue;
+ }
+
+ if (cep->usesubaddr && strncmp(cep->local_phone_incoming.subaddr, mp->dst_subaddr, strlen(cep->local_phone_incoming.subaddr)))
+ {
+ DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, mysubno %s != incomingsubno %s", i,
+ cep->local_phone_incoming.subaddr, mp->dst_subaddr)));
continue;
}
- /* check all allowed remote number's for this entry */
+ /* check all allowed remote number's for this entry */
for (n = 0; n < cep->incoming_numbers_count; n++)
{
incoming_number_t *in = &cep->remote_phone_incoming[n];
- if(in->number[0] == '*')
+
+ if(in->number[0] == '*' && cep->usesubaddr && in->subaddr[0] == '*')
+ break;
+
+ if(in->number[0] == '*' && !cep->usesubaddr)
+ break;
+
+ if(in->number[0] == '*' && cep->usesubaddr && !strncmp(in->subaddr, mp->src_subaddr, strlen(in->subaddr)))
break;
- if(strncmp(in->number, mp->src_telno, strlen(in->number)))
+
+ if(strncmp(in->number, mp->src_telno, strlen(in->number)) && !cep->usesubaddr)
{
DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, remno %s != incomingfromno %s", i,
in->number, mp->src_telno)));
}
- else
- break;
+
+ if(strncmp(in->number, mp->src_telno, strlen(in->number)) && cep->usesubaddr && in->subaddr[0] == '*')
+ {
+ DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, remno %s != incomingfromno %s", i,
+ in->number, mp->src_telno)));
+ }
+
+ if(strncmp(in->number, mp->src_telno, strlen(in->number)) && cep->usesubaddr && strncmp(in->subaddr, mp->src_subaddr, strlen(in->subaddr)))
+ {
+ DBGL(DL_MSG, (log(LL_DBG, "find_matching_entry_incoming: entry %d, remno %s != incomingfromno %s", i,
+ in->number, mp->src_telno)));
+ }
+
+ break;
}
+
if (n >= cep->incoming_numbers_count)
continue;
-
+
/* check b protocol */
if(cep->b1protocol != mp->bprot)
@@ -583,7 +625,7 @@ find_matching_entry_incoming(msg_connect_ind_t *mp)
/* cp number to real one used */
- strcpy(cep->real_phone_incoming, mp->src_telno);
+ strcpy(cep->real_phone_incoming.number, mp->src_telno);
/* copy display string */
diff --git a/usr.sbin/i4b/isdnd/timer.c b/usr.sbin/i4b/isdnd/timer.c
index 2632137..34c0c43 100644
--- a/usr.sbin/i4b/isdnd/timer.c
+++ b/usr.sbin/i4b/isdnd/timer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Fri Jul 20 20:29:28 2001]
+ * last edit-date: [Tue Mar 26 14:38:24 2002]
*
*---------------------------------------------------------------------------*/
@@ -205,8 +205,8 @@ handle_active(cfg_entry_t *cep, time_t now)
{
log(LL_CHD, "%05d %s answering: incoming call from %s to %s",
cep->cdid, cep->name,
- cep->real_phone_incoming,
- cep->local_phone_incoming);
+ cep->real_phone_incoming.number,
+ cep->local_phone_incoming.number);
next_state(cep, EV_MCI);
}
break;
diff --git a/usr.sbin/i4b/isdndecode/layer3.c b/usr.sbin/i4b/isdndecode/layer3.c
index b54479e..12a7633 100644
--- a/usr.sbin/i4b/isdndecode/layer3.c
+++ b/usr.sbin/i4b/isdndecode/layer3.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* layer3.c - decode and print layer 3 (Q.931) information
* -------------------------------------------------------
*
- * $Id: layer3.c,v 1.9 2000/02/21 15:17:17 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Mon Feb 21 15:54:58 2000]
+ * last edit-date: [Tue Mar 26 14:39:02 2002]
*
*---------------------------------------------------------------------------*/
@@ -501,7 +499,7 @@ layer3(char *pbuf, int n, int off, unsigned char *buf)
sprintf((pbuf+strlen(pbuf)),"0x%02x ", buf[j+i]);
}
- sprintf((pbuf+strlen(pbuf)),"]");
+ sprintf((pbuf+strlen(pbuf)),"]\n");
i += len;
diff --git a/usr.sbin/i4b/isdnphone/main.c b/usr.sbin/i4b/isdnphone/main.c
index c79e779..7be5118 100644
--- a/usr.sbin/i4b/isdnphone/main.c
+++ b/usr.sbin/i4b/isdnphone/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1999, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Wed Oct 17 14:08:44 2001]
+ * last edit-date: [Tue Mar 26 14:39:27 2002]
*
*---------------------------------------------------------------------------*/
@@ -67,13 +67,15 @@ main(int argc, char **argv)
int bschar;
int ret;
int opt_n = 0;
+ int opt_s = 0;
int opt_h = 0;
int opt_k = 0;
char *number = "";
+ char *subaddr = "";
numberbuffer[0] = '\0';
- while ((c = getopt(argc, argv, "dhk:n:u:")) != -1)
+ while ((c = getopt(argc, argv, "dhk:n:s:u:")) != -1)
{
switch(c)
{
@@ -94,6 +96,11 @@ main(int argc, char **argv)
number = optarg;
opt_n = 1;
break;
+
+ case 's':
+ subaddr = optarg;
+ opt_s = 1;
+ break;
case 'u':
opt_unit = atoi(optarg);
@@ -121,7 +128,10 @@ main(int argc, char **argv)
if(opt_n)
{
- sprintf(commandbuffer, "D%s", number);
+ if (opt_s)
+ sprintf(commandbuffer, "D%s*%s", number, subaddr);
+ else
+ sprintf(commandbuffer, "D%s", number);
}
else if(opt_k)
OpenPOWER on IntegriCloud