Initialize the D-channel protocol for cards attaching new.
If the kernel passes number type/plan for incoming calls, log the type (e.g. "national" or "international").
This commit is contained in:
parent
d2231045f2
commit
ac4b5b6e98
|
@ -27,7 +27,7 @@
|
|||
* i4b daemon - controller state support routines
|
||||
* ----------------------------------------------
|
||||
*
|
||||
* $Id: controller.c,v 1.3 2002/03/27 13:46:34 martin Exp $
|
||||
* $Id: controller.c,v 1.4 2002/03/30 07:12:41 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -164,6 +164,22 @@ init_active_controller(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
init_single_controller_protocol ( struct isdn_ctrl_state *ctrl )
|
||||
{
|
||||
msg_prot_ind_t mpi;
|
||||
|
||||
memset(&mpi, 0, sizeof mpi);
|
||||
mpi.controller = ctrl->bri;
|
||||
mpi.protocol = ctrl->protocol;
|
||||
|
||||
if((ioctl(isdnfd, I4B_PROT_IND, &mpi)) < 0)
|
||||
{
|
||||
log(LL_ERR, "init_single_controller_protocol: ioctl I4B_PROT_IND failed: %s", strerror(errno));
|
||||
do_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*
|
||||
* init controller D-channel ISDN protocol
|
||||
*--------------------------------------------------------------------------*/
|
||||
|
@ -171,18 +187,9 @@ void
|
|||
init_controller_protocol(void)
|
||||
{
|
||||
struct isdn_ctrl_state *ctrl;
|
||||
msg_prot_ind_t mpi;
|
||||
|
||||
for (ctrl = get_first_ctrl_state(); ctrl; ctrl = NEXT_CTRL(ctrl)) {
|
||||
mpi.controller = ctrl->bri;
|
||||
mpi.protocol = ctrl->protocol;
|
||||
|
||||
if((ioctl(isdnfd, I4B_PROT_IND, &mpi)) < 0)
|
||||
{
|
||||
log(LL_ERR, "init_controller_protocol: ioctl I4B_PROT_IND failed: %s", strerror(errno));
|
||||
do_exit(1);
|
||||
}
|
||||
}
|
||||
for (ctrl = get_first_ctrl_state(); ctrl; ctrl = NEXT_CTRL(ctrl))
|
||||
init_single_controller_protocol(ctrl);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b daemon - main header file
|
||||
* -----------------------------
|
||||
*
|
||||
* $Id: isdnd.h,v 1.6 2002/03/27 13:46:35 martin Exp $
|
||||
* $Id: isdnd.h,v 1.7 2002/03/30 07:12:41 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -763,7 +763,7 @@ int exec_connect_prog ( struct cfg_entry *cep, const char *prog, int link_down )
|
|||
pid_t exec_prog ( char *prog, char **arglist );
|
||||
struct cfg_entry * find_by_device_for_dialout ( int drivertype, int driverunit );
|
||||
struct cfg_entry *find_by_device_for_dialoutnumber(int drivertype, int driverunit, int cmdlen, char *cmd);
|
||||
struct cfg_entry * find_matching_entry_incoming ( msg_connect_ind_t *mp );
|
||||
struct cfg_entry * find_matching_entry_incoming ( msg_connect_ind_t *mp, int len );
|
||||
struct cfg_entry * find_active_entry_by_driver ( int drivertype, int driverunit );
|
||||
void finish_log ( void );
|
||||
char * getlogdatetime ( void );
|
||||
|
@ -780,6 +780,7 @@ void if_down(struct cfg_entry *cep);
|
|||
void init_controller ( void );
|
||||
void init_new_controller(int bri);
|
||||
void init_controller_protocol ( void );
|
||||
void init_single_controller_protocol ( struct isdn_ctrl_state *ctrl );
|
||||
void init_log ( void );
|
||||
void init_screen ( void );
|
||||
void log ( int what, const char *fmt, ... );
|
||||
|
@ -788,7 +789,7 @@ void msg_accounting ( msg_accounting_ind_t *mp );
|
|||
void msg_alert_ind ( msg_alert_ind_t *mp );
|
||||
void msg_charging_ind ( msg_charging_ind_t *mp );
|
||||
void msg_connect_active_ind ( msg_connect_active_ind_t *mp );
|
||||
void msg_connect_ind ( msg_connect_ind_t *mp );
|
||||
void msg_connect_ind ( msg_connect_ind_t *mp, int len );
|
||||
void msg_pdeact_ind(msg_pdeact_ind_t *md);
|
||||
void msg_negcomplete_ind(msg_negcomplete_ind_t *ind);
|
||||
void msg_ifstatechg_ind(msg_ifstatechg_ind_t *ind);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b daemon - main program entry
|
||||
* -------------------------------
|
||||
*
|
||||
* $Id: main.c,v 1.3 2002/03/27 13:46:35 martin Exp $
|
||||
* $Id: main.c,v 1.4 2002/03/30 07:12:41 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -641,7 +641,7 @@ isdnrdhdl(void)
|
|||
switch(hp->type)
|
||||
{
|
||||
case MSG_CONNECT_IND:
|
||||
msg_connect_ind((msg_connect_ind_t *)msg_rd_buf);
|
||||
msg_connect_ind((msg_connect_ind_t *)msg_rd_buf, len);
|
||||
break;
|
||||
|
||||
case MSG_CONNECT_ACTIVE_IND:
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b daemon - message from kernel handling routines
|
||||
* --------------------------------------------------
|
||||
*
|
||||
* $Id: msghdl.c,v 1.4 2002/03/27 13:46:35 martin Exp $
|
||||
* $Id: msghdl.c,v 1.5 2002/03/30 07:12:41 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -57,7 +57,7 @@
|
|||
* handle incoming CONNECT_IND (=SETUP) message
|
||||
*---------------------------------------------------------------------------*/
|
||||
void
|
||||
msg_connect_ind(msg_connect_ind_t *mp)
|
||||
msg_connect_ind(msg_connect_ind_t *mp, int len)
|
||||
{
|
||||
struct cfg_entry *cep;
|
||||
char *src_tela = "ERROR-src_tela";
|
||||
|
@ -72,7 +72,7 @@ msg_connect_ind(msg_connect_ind_t *mp)
|
|||
dst_tela = get_alias(mp->dst_telno);
|
||||
}
|
||||
|
||||
if((cep = find_matching_entry_incoming(mp)) == NULL)
|
||||
if((cep = find_matching_entry_incoming(mp, len)) == NULL)
|
||||
{
|
||||
/* log message generated in find_matching_entry_incoming() */
|
||||
sendm_connect_resp(NULL, mp->header.cdid, SETUP_RESP_DNTCRE, 0);
|
||||
|
@ -1108,6 +1108,7 @@ msg_ctrl_ev_ind(msg_ctrl_ev_ind_t *mp)
|
|||
if (mp->event) {
|
||||
/* new, add to controller list */
|
||||
init_new_controller(mp->controller);
|
||||
init_single_controller_protocol(find_ctrl_state(mp->controller));
|
||||
} else {
|
||||
/* controller gone, remove */
|
||||
remove_ctrl_state(mp->controller);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* i4b daemon - misc support routines
|
||||
* ----------------------------------
|
||||
*
|
||||
* $Id: support.c,v 1.4 2002/03/27 13:46:35 martin Exp $
|
||||
* $Id: support.c,v 1.5 2002/03/30 07:12:41 martin Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
|
@ -324,9 +324,30 @@ get_cep_by_driver(int drivertype, int driverunit)
|
|||
* - found/match: make entry in free cep, return address
|
||||
*---------------------------------------------------------------------------*/
|
||||
struct cfg_entry *
|
||||
find_matching_entry_incoming(msg_connect_ind_t *mp)
|
||||
find_matching_entry_incoming(msg_connect_ind_t *mp, int len)
|
||||
{
|
||||
struct cfg_entry *cep = NULL;
|
||||
static const char resvd_type[] = "reserverd";
|
||||
static const char no_type[] = "no type";
|
||||
static const char * const numbering_types[] = {
|
||||
"unknown",
|
||||
"international",
|
||||
"national",
|
||||
"network specific",
|
||||
"subscriber",
|
||||
"abbreviated",
|
||||
resvd_type,
|
||||
resvd_type,
|
||||
resvd_type
|
||||
};
|
||||
const char * ntype;
|
||||
|
||||
/* older kernels do not deliver all the information */
|
||||
if (((u_int8_t*)&mp->type_plan - (u_int8_t*)mp + sizeof(mp->type_plan)) <= len) {
|
||||
ntype = numbering_types[(mp->type_plan & 0x70)>>4];
|
||||
} else {
|
||||
ntype = no_type;
|
||||
}
|
||||
|
||||
/* check for CW (call waiting) early */
|
||||
|
||||
|
@ -340,13 +361,13 @@ find_matching_entry_incoming(msg_connect_ind_t *mp)
|
|||
src_tela = get_alias(mp->src_telno);
|
||||
dst_tela = get_alias(mp->dst_telno);
|
||||
|
||||
log(LL_CHD, "%05d <unknown> CW from %s to %s (%s) (no channel free)",
|
||||
mp->header.cdid, src_tela, dst_tela, mp->display);
|
||||
log(LL_CHD, "%05d <unknown> CW from %s (%s) to %s (%s) (no channel free)",
|
||||
mp->header.cdid, src_tela, ntype, dst_tela, mp->display);
|
||||
}
|
||||
else
|
||||
{
|
||||
log(LL_CHD, "%05d <unknown> call waiting from %s to %s (%s) (no channel free)",
|
||||
mp->header.cdid, mp->src_telno, mp->dst_telno, mp->display);
|
||||
log(LL_CHD, "%05d <unknown> call waiting from %s (%s) to %s (%s) (no channel free)",
|
||||
mp->header.cdid, mp->src_telno, ntype, mp->dst_telno, mp->display);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
@ -540,13 +561,13 @@ find_matching_entry_incoming(msg_connect_ind_t *mp)
|
|||
src_tela = get_alias(mp->src_telno);
|
||||
dst_tela = get_alias(mp->dst_telno);
|
||||
|
||||
log(LL_CHD, "%05d Call from %s to %s (%s)",
|
||||
mp->header.cdid, src_tela, dst_tela, mp->display);
|
||||
log(LL_CHD, "%05d Call from %s (%s) to %s (%s)",
|
||||
mp->header.cdid, src_tela, ntype, dst_tela, mp->display);
|
||||
}
|
||||
else
|
||||
{
|
||||
log(LL_CHD, "%05d <unknown> incoming call from %s to %s (%s)",
|
||||
mp->header.cdid, mp->src_telno, mp->dst_telno, mp->display);
|
||||
log(LL_CHD, "%05d <unknown> incoming call from %s (%s) to %s (%s)",
|
||||
mp->header.cdid, mp->src_telno, ntype, mp->dst_telno, mp->display);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue