Add experimental support for sending keypad facility messages.

MFC after: 2 months
This commit is contained in:
Hellmuth Michaelis 2001-10-18 11:58:49 +00:00
parent 4f63c70a2b
commit 8f3a90354e
20 changed files with 326 additions and 184 deletions

View File

@ -6,7 +6,7 @@ $FreeBSD$
isdn4bsd
========
Version 1.00.00 / May 2001
Version 1.01.00 / October 2001
written by:

View File

@ -1,8 +1,21 @@
$FreeBSD$
ReleaseNotes for isdn4bsd last edit-date: [Sat Jul 21 12:27:43 2001]
ReleaseNotes for isdn4bsd last edit-date: [Thu Oct 18 13:49:05 2001]
================================================================================
release 1.01
--------------------------------------------------------------------------------
- add experimental support to send messages via the keypad facility to the
PBX or exchange office. The messages - if supported - may be used to
configure and maintain optional services offered by the PBX or exchange
office such as call deflection mailbox services. Please consult the
nice documentation for the exchange you are connected to.
Currently keypad messages can be send by using the isdnphone utilities
"-k" switch on the command line. Don't forget to properly quote the
message in case it contains shell meta characters!
- add keyword "maxconnecttime" to isdnd to prevent a potential telco bill
desaster. Caution: use only in conjunction with budgets to limit the number
of dials per timeunit otherwise you will get endless redials and reconnects!

View File

@ -29,7 +29,7 @@
*
* $FreeBSD$
*
* last edit-date: [Sat Jul 21 12:24:56 2001]
* last edit-date: [Thu Oct 18 13:40:40 2001]
*
*---------------------------------------------------------------------------*/
@ -46,8 +46,8 @@
* version and release number for isdn4bsd package
*---------------------------------------------------------------------------*/
#define VERSION 1 /* version number */
#define REL 0 /* release number */
#define STEP 1 /* release step */
#define REL 1 /* release number */
#define STEP 0 /* release step */
/*---------------------------------------------------------------------------*
* date/time format in i4b log messages
@ -170,6 +170,7 @@
#define TELNO_MAX 41 /* max length of a telephone number (+ '\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') */
/*---------------------------------------------------------------------------*
* in case the src or dst telephone number is empty
@ -318,6 +319,7 @@ typedef struct {
#define MSG_IFSTATE_CHANGED_IND 'o'
#define MSG_DIALOUTNUMBER_IND 'p'
#define MSG_PACKET_IND 'q'
#define MSG_KEYPAD_IND 'r'
int cdid; /* call descriptor id */
} msg_hdr_t;
@ -409,6 +411,17 @@ typedef struct {
char cmd[TELNO_MAX]; /* the number to dial */
} msg_dialoutnumber_ind_t;
/*---------------------------------------------------------------------------*
* send keypad string
*---------------------------------------------------------------------------*/
typedef struct {
msg_hdr_t header; /* common header */
int driver; /* driver type */
int driver_unit; /* driver unit number */
int cmdlen; /* length of string */
char cmd[KEYPAD_MAX];/* keypad string */
} msg_keypad_ind_t;
/*---------------------------------------------------------------------------*
* idle timeout disconnect sent indication
* kernel has sent disconnect request because of b-ch idle
@ -556,6 +569,7 @@ typedef struct {
#define ULEN_METHOD_DYNAMIC 1 /* use AOCD */
char dst_telno[TELNO_MAX]; /* destination telephone no */
char src_telno[TELNO_MAX]; /* source telephone number */
char keypad[KEYPAD_MAX]; /* keypad string */
} msg_connect_req_t;
#define I4B_CONNECT_REQ _IOW('4', 1, msg_connect_req_t)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1997, 2001 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_tel_ioctl.h telephony interface ioctls
* ------------------------------------------
*
* $Id: i4b_tel_ioctl.h,v 1.13 2000/01/12 14:49:36 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Wed Jan 12 15:47:11 2000]
* last edit-date: [Wed Oct 17 13:47:03 2001]
*
*---------------------------------------------------------------------------*/
@ -83,6 +81,7 @@ struct i4b_tel_tones {
#define CMD_DIAL 'D' /* dial the following number string */
#define CMD_HUP 'H' /* hangup */
#define CMD_KEYP 'K' /* send keypad string */
/* dialer responses */

View File

@ -29,7 +29,7 @@
*
* $FreeBSD$
*
* last edit-date: [Tue May 8 10:19:36 2001]
* last edit-date: [Thu Oct 18 13:24:50 2001]
*
*---------------------------------------------------------------------------*/
@ -42,13 +42,8 @@
#include <sys/param.h>
#include <sys/systm.h>
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/ioccom.h>
#include <sys/poll.h>
#else
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#endif
#include <sys/conf.h>
#include <sys/uio.h>
@ -58,25 +53,13 @@
#include <net/if.h>
#include <sys/tty.h>
#ifdef __FreeBSD__
#ifdef DEVFS
#include <sys/devfsext.h>
#endif
#endif /* __FreeBSD__ */
#ifdef __bsdi__
#include <sys/device.h>
#endif
#ifdef __FreeBSD__
#include <machine/i4b_ioctl.h>
#include <machine/i4b_tel_ioctl.h>
#include <machine/i4b_debug.h>
#else
#include <i4b/i4b_ioctl.h>
#include <i4b/i4b_tel_ioctl.h>
#include <i4b/i4b_debug.h>
#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_mbuf.h>
@ -151,37 +134,13 @@ static unsigned char u2a_tab[];
static unsigned char bitreverse[];
static u_char sinetab[];
#ifndef __FreeBSD__
#define PDEVSTATIC /* - not static - */
PDEVSTATIC void i4btelattach __P((void));
#ifdef __bsdi__
PDEVSTATIC int i4btelioctl __P((dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td));
#else
PDEVSTATIC int i4btelioctl __P((dev_t dev, int cmd, caddr_t data, int flag, struct thread *td));
#endif
int i4btelopen __P((dev_t dev, int flag, int fmt, struct thread *td));
int i4btelclose __P((dev_t dev, int flag, int fmt, struct thread *td));
int i4btelread __P((dev_t dev, struct uio *uio, int ioflag));
int i4btelwrite __P((dev_t dev, struct uio * uio, int ioflag));
#ifdef OS_USES_POLL
int i4btelpoll __P((dev_t dev, int events, struct thread *td));
#else
int i4btelsel __P((dev_t dev, int rw, struct thread *td));
#endif
#endif /* ! __FreeBSD__ */
#if BSD > 199306 && defined(__FreeBSD__)
#define PDEVSTATIC static
PDEVSTATIC d_open_t i4btelopen;
PDEVSTATIC d_close_t i4btelclose;
PDEVSTATIC d_read_t i4btelread;
PDEVSTATIC d_read_t i4btelwrite;
PDEVSTATIC d_ioctl_t i4btelioctl;
PDEVSTATIC d_close_t i4btelclose;
PDEVSTATIC d_read_t i4btelread;
PDEVSTATIC d_read_t i4btelwrite;
PDEVSTATIC d_ioctl_t i4btelioctl;
#ifdef OS_USES_POLL
PDEVSTATIC d_poll_t i4btelpoll;
@ -230,50 +189,11 @@ i4btelinit(void *unused)
SYSINIT(i4bteldev, SI_SUB_DRIVERS,
SI_ORDER_MIDDLE+CDEV_MAJOR, &i4btelinit, NULL);
#endif /* BSD > 199306 && defined(__FreeBSD__) */
#ifdef __bsdi__
int i4btelsel(dev_t dev, int rw, struct thread *td);
int i4btelmatch(struct device *parent, struct cfdata *cf, void *aux);
void dummy_i4btelattach(struct device*, struct device *, void *);
#define CDEV_MAJOR 62
static struct cfdriver i4btelcd =
{ NULL, "i4btel", i4btelmatch, dummy_i4btelattach, DV_DULL,
sizeof(struct cfdriver) };
struct devsw i4btelsw =
{ &i4btelcd,
i4btelopen, i4btelclose, i4btelread, i4btelwrite,
i4btelioctl, i4btelsel, nommap, nostrat,
nodump, nopsize, 0, nostop
};
int
i4btelmatch(struct device *parent, struct cfdata *cf, void *aux)
{
NDBGL4(L4_TELDBG, "aux=0x%x", aux);
return 1;
}
void
dummy_i4btelattach(struct device *parent, struct device *self, void *aux)
{
NDBGL4(L4_TELDBG, "aux=0x%x", aux);
}
#endif /* __bsdi__ */
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
PDEVSTATIC void
#ifdef __FreeBSD__
i4btelattach(void *dummy)
#else
i4btelattach()
#endif
{
int i, j;
@ -289,7 +209,6 @@ i4btelattach()
tel_sc[i][j].wcvttab = 0;
tel_sc[i][j].result = 0;
#if defined(__FreeBSD__)
switch(j)
{
case FUNCTEL: /* normal i4btel device */
@ -304,7 +223,6 @@ i4btelattach()
0600, "i4bteld%d", i);
break;
}
#endif
}
tel_init_linktab(i);
}
@ -386,13 +304,7 @@ i4btelclose(dev_t dev, int flag, int fmt, struct thread *td)
* i4btelioctl - device driver ioctl routine
*---------------------------------------------------------------------------*/
PDEVSTATIC int
#if defined(__FreeBSD__)
i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
#elif defined(__bsdi__)
i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
#else
i4btelioctl(dev_t dev, int cmd, caddr_t data, int flag, struct thread *td)
#endif
{
int unit = UNIT(dev);
int func = FUNC(dev);
@ -540,6 +452,7 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag)
sc->devstate |= ST_RDWAITDATA;
NDBGL4(L4_TELDBG, "i4btel%d, queue empty!", unit);
#if defined (__FreeBSD__) && __FreeBSD__ > 4
if((error = msleep((caddr_t) &sc->isdn_linktab->rx_queue,
&sc->isdn_linktab->rx_queue->ifq_mtx,
@ -675,6 +588,7 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag)
(sc->devstate & ST_ISOPEN))
{
sc->devstate |= ST_WRWAITEMPTY;
#if defined (__FreeBSD__) && __FreeBSD__ > 4
if((error = msleep((caddr_t) &sc->isdn_linktab->tx_queue,
&sc->isdn_linktab->tx_queue->ifq_mtx,
@ -721,6 +635,7 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag)
/* always reverse bitorder to line */
mtod(m,u_char *)[i] = bitreverse[mtod(m,u_char *)[i]];
}
#if defined (__FreeBSD__) && __FreeBSD__ > 4
(void) IF_HANDOFF(sc->isdn_linktab->tx_queue, m, NULL);
#else
@ -750,6 +665,10 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag)
{
i4b_l4_drvrdisc(BDRV_TEL, unit);
}
else if(cmdbuf[0] == CMD_KEYP)
{
i4b_l4_keypad(BDRV_TEL, unit, len-1, &cmdbuf[1]);
}
}
else
{

View File

@ -29,7 +29,7 @@
*
* $FreeBSD$
*
* last edit-date: [Sat Jul 21 12:24:56 2001]
* last edit-date: [Thu Oct 18 13:40:40 2001]
*
*---------------------------------------------------------------------------*/
@ -46,8 +46,8 @@
* version and release number for isdn4bsd package
*---------------------------------------------------------------------------*/
#define VERSION 1 /* version number */
#define REL 0 /* release number */
#define STEP 1 /* release step */
#define REL 1 /* release number */
#define STEP 0 /* release step */
/*---------------------------------------------------------------------------*
* date/time format in i4b log messages
@ -170,6 +170,7 @@
#define TELNO_MAX 41 /* max length of a telephone number (+ '\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') */
/*---------------------------------------------------------------------------*
* in case the src or dst telephone number is empty
@ -318,6 +319,7 @@ typedef struct {
#define MSG_IFSTATE_CHANGED_IND 'o'
#define MSG_DIALOUTNUMBER_IND 'p'
#define MSG_PACKET_IND 'q'
#define MSG_KEYPAD_IND 'r'
int cdid; /* call descriptor id */
} msg_hdr_t;
@ -409,6 +411,17 @@ typedef struct {
char cmd[TELNO_MAX]; /* the number to dial */
} msg_dialoutnumber_ind_t;
/*---------------------------------------------------------------------------*
* send keypad string
*---------------------------------------------------------------------------*/
typedef struct {
msg_hdr_t header; /* common header */
int driver; /* driver type */
int driver_unit; /* driver unit number */
int cmdlen; /* length of string */
char cmd[KEYPAD_MAX];/* keypad string */
} msg_keypad_ind_t;
/*---------------------------------------------------------------------------*
* idle timeout disconnect sent indication
* kernel has sent disconnect request because of b-ch idle
@ -556,6 +569,7 @@ typedef struct {
#define ULEN_METHOD_DYNAMIC 1 /* use AOCD */
char dst_telno[TELNO_MAX]; /* destination telephone no */
char src_telno[TELNO_MAX]; /* source telephone number */
char keypad[KEYPAD_MAX]; /* keypad string */
} msg_connect_req_t;
#define I4B_CONNECT_REQ _IOW('4', 1, msg_connect_req_t)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1997, 2001 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_l3l4.h - layer 3 / layer 4 interface
* ------------------------------------------
*
* $Id: i4b_l3l4.h,v 1.32 2000/08/24 11:48:57 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Fri Jun 2 14:29:35 2000]
* last edit-date: [Thu Oct 18 13:26:16 2001]
*
*---------------------------------------------------------------------------*/
@ -240,7 +238,8 @@ typedef struct
int isdntxdelay; /* isdn tx delay after connect */
u_char display[DISPLAY_MAX]; /* display information element */
char datetime[DATETIME_MAX]; /* date/time information element*/
char datetime[DATETIME_MAX]; /* date/time information element*/
u_char keypad[KEYPAD_MAX]; /* keypad facility */
} call_desc_t;
extern call_desc_t call_desc[N_CALL_DESC];

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1997, 2001 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_tel_ioctl.h telephony interface ioctls
* ------------------------------------------
*
* $Id: i4b_tel_ioctl.h,v 1.13 2000/01/12 14:49:36 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Wed Jan 12 15:47:11 2000]
* last edit-date: [Wed Oct 17 13:47:03 2001]
*
*---------------------------------------------------------------------------*/
@ -83,6 +81,7 @@ struct i4b_tel_tones {
#define CMD_DIAL 'D' /* dial the following number string */
#define CMD_HUP 'H' /* hangup */
#define CMD_KEYP 'K' /* send keypad string */
/* dialer responses */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1997, 2001 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,38 +27,23 @@
* i4b_l2if.c - Layer 3 interface to Layer 2
* -------------------------------------------
*
* $Id: i4b_l2if.c,v 1.23 2000/08/24 11:48:58 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon May 29 16:56:22 2000]
* last edit-date: [Thu Oct 18 13:29:19 2001]
*
*---------------------------------------------------------------------------*/
#ifdef __FreeBSD__
#include "i4bq931.h"
#else
#define NI4BQ931 1
#endif
#if NI4BQ931 > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
#include <sys/callout.h>
#endif
#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
#include <machine/i4b_cause.h>
#else
#include <i4b/i4b_debug.h>
#include <i4b/i4b_ioctl.h>
#include <i4b/i4b_cause.h>
#endif
#include <i4b/include/i4b_isdnq931.h>
#include <i4b/include/i4b_l2l3.h>
@ -435,8 +420,10 @@ i4b_l3_tx_setup(call_desc_t *cd)
{
struct mbuf *m;
u_char *ptr;
int len;
int slen = strlen(cd->src_telno);
int dlen = strlen(cd->dst_telno);
int klen = strlen(cd->keypad);
/*
* there is one additional octet if cd->bprot == BPROT_NONE
@ -447,8 +434,14 @@ i4b_l3_tx_setup(call_desc_t *cd)
NDBGL3(L3_PRIM, "unit %d, cr = 0x%02x", ctrl_desc[cd->controller].unit, cd->cr);
if((m = i4b_Dgetmbuf(I_FRAME_HDRLEN + MSG_SETUP_LEN + slen + dlen +
(cd->bprot == BPROT_NONE ? 1 : 0))) == NULL)
len = I_FRAME_HDRLEN +
MSG_SETUP_LEN +
(slen ? (3+slen) : 0) +
(dlen ? (3+dlen) : 0) +
(klen ? (2+klen) : 0) +
(cd->bprot == BPROT_NONE ? 1 : 0);
if((m = i4b_Dgetmbuf(len)) == NULL)
{
panic("i4b_l3_tx_setup: can't allocate mbuf\n");
}
@ -511,17 +504,31 @@ i4b_l3_tx_setup(call_desc_t *cd)
break;
}
*ptr++ = IEI_CALLINGPN; /* calling party no */
*ptr++ = IEI_CALLINGPN_LEN+slen;/* calling party no length */
*ptr++ = NUMBER_TYPEPLAN; /* type of number, number plan id */
strncpy(ptr, cd->src_telno, slen);
ptr += slen;
if(klen)
{
*ptr++ = IEI_KEYPAD; /* keypad facility */
*ptr++ = klen; /* keypad facility length */
strncpy(ptr, cd->keypad, klen);
ptr += klen;
}
if(slen)
{
*ptr++ = IEI_CALLINGPN; /* calling party no */
*ptr++ = IEI_CALLINGPN_LEN+slen;/* calling party no length */
*ptr++ = NUMBER_TYPEPLAN; /* type of number, number plan id */
strncpy(ptr, cd->src_telno, slen);
ptr += slen;
}
*ptr++ = IEI_CALLEDPN; /* called party no */
*ptr++ = IEI_CALLEDPN_LEN+dlen; /* called party no length */
*ptr++ = NUMBER_TYPEPLAN; /* type of number, number plan id */
strncpy(ptr, cd->dst_telno, dlen);
ptr += dlen;
if(dlen)
{
*ptr++ = IEI_CALLEDPN; /* called party no */
*ptr++ = IEI_CALLEDPN_LEN+dlen; /* called party no length */
*ptr++ = NUMBER_TYPEPLAN; /* type of number, number plan id */
strncpy(ptr, cd->dst_telno, dlen);
ptr += dlen;
}
DL_Data_Req(ctrl_desc[cd->controller].unit, m);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1997, 2001 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_q931.h - Q931 handling header file
* --------------------------------------
*
* $Id: i4b_q931.h,v 1.9 2000/04/27 09:25:22 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Thu Apr 27 11:07:37 2000]
* last edit-date: [Thu Oct 18 13:29:01 2001]
*
*---------------------------------------------------------------------------*/
@ -72,9 +70,11 @@
/* SETUP */
#define MSG_SETUP_LEN 18 /* without number strings ! */
#define MSG_SETUP_LEN 12 /* without called party, */
/* calling party and */
/* keypad facility ! */
#define IEI_BEARERCAP_LEN 2 /* 2 octetts lenght */
#define IEI_BEARERCAP_LEN 2 /* 2 octetts length */
#define IT_CAP_SPEECH 0x80 /* BC: information xfer capability */
#define IT_CAP_UNR_DIG_INFO 0x88 /* BC: information xfer capability */

View File

@ -29,7 +29,7 @@
*
* $FreeBSD$
*
* last edit-date: [Fri Jan 12 16:49:34 2001]
* last edit-date: [Wed Oct 17 13:37:56 2001]
*
*---------------------------------------------------------------------------*/
@ -439,6 +439,12 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct thread *td)
strcpy(cd->dst_telno, mcr->dst_telno);
strcpy(cd->src_telno, mcr->src_telno);
if(mcr->keypad[0] != '\0')
strcpy(cd->keypad, mcr->keypad);
else
cd->keypad[0] = '\0';
cd->display[0] = '\0';
SET_CAUSE_TYPE(cd->cause_in, CAUSET_I4B);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1997, 2001 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_l4.c - kernel interface to userland
* -----------------------------------------
*
* $Id: i4b_l4.c,v 1.54 2000/08/28 07:24:59 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Sun Aug 27 14:53:42 2000]
* last edit-date: [Thu Oct 18 13:31:22 2001]
*
*---------------------------------------------------------------------------*/
@ -248,6 +246,33 @@ i4b_l4_dialoutnumber(int driver, int driver_unit, int cmdlen, char *cmd)
}
}
/*---------------------------------------------------------------------------*
* send MSG_KEYPAD_IND message to userland
*---------------------------------------------------------------------------*/
void
i4b_l4_keypad(int driver, int driver_unit, int cmdlen, char *cmd)
{
struct mbuf *m;
if((m = i4b_Dgetmbuf(sizeof(msg_keypad_ind_t))) != NULL)
{
msg_keypad_ind_t *md = (msg_keypad_ind_t *)m->m_data;
md->header.type = MSG_KEYPAD_IND;
md->header.cdid = -1;
md->driver = driver;
md->driver_unit = driver_unit;
if(cmdlen > KEYPAD_MAX)
cmdlen = KEYPAD_MAX;
md->cmdlen = cmdlen;
bcopy(cmd, md->cmd, cmdlen);
i4bputqueue(m);
}
}
/*---------------------------------------------------------------------------*
* send MSG_NEGOTIATION_COMPL message to userland
*---------------------------------------------------------------------------*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1997, 2001 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_l4.h - kernel interface to userland header file
* ---------------------------------------------------
*
* $Id: i4b_l4.h,v 1.18 2000/04/27 11:35:01 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Thu Apr 27 13:28:01 2000]
* last edit-date: [Thu Oct 18 10:11:51 2001]
*
*---------------------------------------------------------------------------*/
@ -49,6 +47,7 @@ extern void i4b_l4_daemon_attached(void);
extern void i4b_l4_daemon_detached(void);
extern void i4b_l4_dialout( int driver, int driver_unit );
extern void i4b_l4_dialoutnumber(int driver, int driver_unit, int cmdlen, char *cmd);
extern void i4b_l4_keypad(int driver, int driver_unit, int cmdlen, char *cmd);
extern void i4b_l4_disconnect_ind ( call_desc_t *cd );
extern void i4b_l4_drvrdisc (int driver, int driver_unit );
extern void i4b_l4_negcomplete( call_desc_t *cd );

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1997, 2001 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 - dial handling routines
* -----------------------------------
*
* $Id: dial.c,v 1.8 1999/12/13 21:25:24 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:45:51 1999]
* last edit-date: [Thu Oct 18 11:05:01 2001]
*
*---------------------------------------------------------------------------*/
@ -46,6 +44,9 @@ select_first_dialno(cfg_entry_t *cep)
{
int i, j;
if(cep->keypad[0] != '\0')
return;
if(cep->remote_numbers_count < 1)
{
log(LL_ERR, "select_first_dialno: remote_numbers_count < 1!");

View File

@ -29,7 +29,7 @@
*
* $FreeBSD$
*
* last edit-date: [Fri Jul 20 19:17:29 2001]
* last edit-date: [Thu Oct 18 10:59:41 2001]
*
*---------------------------------------------------------------------------*/
@ -501,6 +501,7 @@ typedef struct cfg_entry {
#define BUDGET_TYPE_CBACK 1
#define BUDGET_TYPE_COUT 2
char keypad[KEYPAD_MAX]; /* keypad string */
} cfg_entry_t;
/*---------------------------------------------------------------------------*
@ -752,6 +753,7 @@ 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_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 );
void finish_log ( void );

View File

@ -29,7 +29,7 @@
*
* $FreeBSD$
*
* last edit-date: [Tue Jun 5 17:06:20 2001]
* last edit-date: [Thu Oct 18 13:57:45 2001]
*
*---------------------------------------------------------------------------*/
@ -713,6 +713,10 @@ isdnrdhdl(void)
msg_packet_ind((msg_packet_ind_t *)msg_rd_buf);
break;
case MSG_KEYPAD_IND:
msg_keypad((msg_keypad_ind_t *)msg_rd_buf);
break;
default:
log(LL_WRN, "ERROR, unknown message received from %sisdn (0x%x)", _PATH_DEV, msg_rd_buf[0]);
break;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1997, 2001 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 - message from kernel handling routines
* --------------------------------------------------
*
* $Id: msghdl.c,v 1.78 2000/09/21 11:29:51 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Thu Sep 21 11:11:48 2000]
* last edit-date: [Thu Oct 18 11:13:29 2001]
*
*---------------------------------------------------------------------------*/
@ -868,6 +866,60 @@ msg_dialoutnumber(msg_dialoutnumber_ind_t *mp)
DBGL(DL_DRVR, (log(LL_DBG, "msg_dialoutnumber: get_cdid() returned 0!")));
return;
}
cep->keypad[0] = '\0';
cep->charge = 0;
cep->last_charge = 0;
cep->hangup = 0;
next_state(cep, EV_MDO);
}
/*---------------------------------------------------------------------------*
* handle incoming KEYPAD message
*---------------------------------------------------------------------------*/
void
msg_keypad(msg_keypad_ind_t *mp)
{
cfg_entry_t *cep;
DBGL(DL_DRVR, (log(LL_DBG, "msg_keypad: dial req from %s, unit %d", bdrivername(mp->driver), mp->driver_unit)));
if((cep = find_by_device_for_keypad(mp->driver, mp->driver_unit, mp->cmdlen, mp->cmd)) == NULL)
{
DBGL(DL_DRVR, (log(LL_DBG, "msg_keypad: config entry reserved or no match")));
return;
}
if(cep->inout == DIR_INONLY)
{
dialresponse(cep, DSTAT_INONLY);
return;
}
if(cep->budget_calloutperiod && cep->budget_calloutncalls)
{
cep->budget_calltype = 0;
cep->budget_callout_req++;
if(cep->budget_calloutncalls_cnt == 0)
{
log(LL_CHD, "%05d %s no budget for calling out", 0, cep->name);
cep->budget_callout_rej++;
dialresponse(cep, DSTAT_TFAIL);
return;
}
else
{
cep->budget_calltype = BUDGET_TYPE_COUT;
}
}
if((cep->cdid = get_cdid()) == 0)
{
DBGL(DL_DRVR, (log(LL_DBG, "msg_keypad: get_cdid() returned 0!")));
return;
}
cep->charge = 0;
cep->last_charge = 0;
@ -1166,6 +1218,7 @@ sendm_connect_req(cfg_entry_t *cep)
strcpy(mcr.dst_telno, cep->remote_phone_dialout);
strcpy(mcr.src_telno, cep->local_phone_dialout);
strcpy(mcr.keypad, cep->keypad);
cep->last_dial_time = time(NULL);
cep->direction = DIR_OUT;

View File

@ -29,7 +29,7 @@
*
* $FreeBSD$
*
* last edit-date: [Thu May 3 17:15:00 2001]
* last edit-date: [Thu Oct 18 13:14:55 2001]
*
*---------------------------------------------------------------------------*/
@ -191,6 +191,8 @@ find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, cha
return(NULL);
}
cep->keypad[0] = '\0';
/* check number and copy to cep->remote_numbers[] */
for(j = 0; j < cmdlen; j++)
@ -224,6 +226,78 @@ find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, cha
return(NULL);
}
/*---------------------------------------------------------------------------*
* find entry by drivertype and driverunit and setup for send keypad
*---------------------------------------------------------------------------*/
cfg_entry_t *
find_by_device_for_keypad(int drivertype, int driverunit, int cmdlen, char *cmd)
{
cfg_entry_t *cep = NULL;
int i, j;
for(i=0; i < nentries; i++)
{
cep = &cfg_entry_tab[i]; /* ptr to config entry */
/* compare driver type and unit */
if(!((cep->usrdevicename == drivertype) &&
(cep->usrdeviceunit == driverunit)))
{
continue;
}
/* check time interval */
if(isvalidtime(cep) == 0)
{
DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_keypad: entry %d, time not valid!", i)));
continue;
}
/* found, check if already reserved */
if(cep->cdid == CDID_RESERVED)
{
DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_keypad: entry %d, cdid reserved!", i)));
return(NULL);
}
/* check if this entry is already in use ? */
if(cep->cdid != CDID_UNUSED)
{
DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_keypad: entry %d, cdid in use", i)));
return(NULL);
}
cep->remote_numbers[0].number[0] = '\0';
cep->remote_numbers_count = 0;
cep->remote_phone_dialout[0] = '\0';
bzero(cep->keypad, KEYPAD_MAX);
strncpy(cep->keypad, cmd, cmdlen);
DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_keypad: entry %d, keypad string is %s", i, cep->keypad)));
if((setup_dialout(cep)) == GOOD)
{
/* found an entry to be used for calling out */
DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_keypad: found entry %d!", i)));
return(cep);
}
else
{
DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_keypad: entry %d, setup_dialout() failed!", i)));
return(NULL);
}
}
DBGL(DL_MSG, (log(LL_DBG, "find_by_device_for_keypad: no entry found!")));
return(NULL);
}
/*---------------------------------------------------------------------------*
* find entry by drivertype and driverunit and setup for dialing out
*---------------------------------------------------------------------------*/

View File

@ -1,5 +1,5 @@
.\"
.\" Copyright (c) 1999 Hellmuth Michaelis. All rights reserved.
.\" Copyright (c) 1999, 2001 Hellmuth Michaelis. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@ -22,14 +22,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: isdnphone.8,v 1.4 1999/12/13 22:11:55 hm Exp $
.\"
.\" $FreeBSD$
.\"
.\" last edit-date: [Mon Dec 13 23:05:19 1999]
.\" last edit-date: [Thu Oct 18 13:36:52 2001]
.\"
.\"
.Dd March 24, 1999
.Dd October 18, 2001
.Dt ISDNPHONE 8
.Os
.Sh NAME
@ -37,7 +35,9 @@
.Nd telephone dialing and more for isdn4bsd
.Sh SYNOPSIS
.Nm
.Op Fl d
.Op Fl h
.Op Fl k Ar string
.Op Fl n Ar number
.Op Fl u Ar unit
.Sh DESCRIPTION
@ -51,8 +51,12 @@ a curses-based fullscreen interface.
.Pp
The following options are available:
.Bl -tag -width Ds
.It Fl d
enable debugging message display.
.It Fl h
hang up a possibly open telefone connection on the selected interface.
.It Fl k
send the specified string using the keypad facility information element.
.It Fl n
dial the specified number on the selected interface.
.It Fl u
@ -71,4 +75,4 @@ dials calls the number 1234 to establish a call on /dev/i4btel0
The
.Nm
utility and this manpage were written by
.An Hellmuth Michaelis Aq hm@kts.org .
.An Hellmuth Michaelis Aq hm@freebsd.org .

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999 Hellmuth Michaelis. All rights reserved.
* Copyright (c) 1999, 2001 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 @@
* isdnphone - main module
* =======================
*
* $Id: main.c,v 1.12 1999/12/13 21:25:26 hm Exp $
*
* $FreeBSD$
*
* last edit-date: [Mon Dec 13 21:53:25 1999]
* last edit-date: [Wed Oct 17 14:08:44 2001]
*
*---------------------------------------------------------------------------*/
@ -48,9 +46,10 @@ usage(void)
{
fprintf(stderr, "\n");
fprintf(stderr, "isdnphone - i4b phone program, version %d.%d.%d, compiled %s %s\n",VERSION, REL, STEP, __DATE__, __TIME__);
fprintf(stderr, "usage: isdnphone -d -h -n <number> -u <unit>\n");
fprintf(stderr, "usage: isdnphone -d -h -k <string> -n <number> -u <unit>\n");
fprintf(stderr, " -d debug\n");
fprintf(stderr, " -h hangup\n");
fprintf(stderr, " -k string keypad string\n");
fprintf(stderr, " -n number dial number\n");
fprintf(stderr, " -u unit set unit number\n");
fprintf(stderr, "\n");
@ -69,11 +68,12 @@ main(int argc, char **argv)
int ret;
int opt_n = 0;
int opt_h = 0;
int opt_k = 0;
char *number = "";
numberbuffer[0] = '\0';
while ((c = getopt(argc, argv, "dhn:u:")) != -1)
while ((c = getopt(argc, argv, "dhk:n:u:")) != -1)
{
switch(c)
{
@ -85,6 +85,11 @@ main(int argc, char **argv)
opt_h = 1;
break;
case 'k':
number = optarg;
opt_k = 1;
break;
case 'n':
number = optarg;
opt_n = 1;
@ -108,7 +113,7 @@ main(int argc, char **argv)
if((dialerfd = init_dial(namebuffer)) == -1)
exit(1);
if(opt_n || opt_h)
if(opt_n || opt_h || opt_k)
{
char commandbuffer[80];
@ -118,6 +123,11 @@ main(int argc, char **argv)
{
sprintf(commandbuffer, "D%s", number);
}
else if(opt_k)
{
sprintf(commandbuffer, "K%s", number);
}
else if(opt_h)
{