From 994998a9da6d0a2a5e8cdbcf01451aa28ee57a61 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Wed, 25 Jun 2008 22:21:30 +0000 Subject: [PATCH] allow tonezone to live in a different place than DAHDI/Zaptel, since dahdi-tools and dahdi-linux are now separate packages and can be installed in different places don't include tonezone.h in dahdi_compat.h, because only a couple of modules need it get app_rpt building again after the DAHDI changes (closes issue #12911) Reported by: tzafrir git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@125132 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_rpt.c | 50 ++++++++++++++---------------- channels/chan_dahdi.c | 1 + configure | 8 ++++- configure.ac | 6 ++++ include/asterisk/dahdi_compat.h | 4 +-- include/asterisk/tonezone_compat.h | 35 +++++++++++++++++++++ 6 files changed, 73 insertions(+), 31 deletions(-) create mode 100644 include/asterisk/tonezone_compat.h diff --git a/apps/app_rpt.c b/apps/app_rpt.c index cc6c680dac..7b209378cb 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -137,7 +137,7 @@ */ /*** MODULEINFO - zaptel + dahdi tonezone no ***/ @@ -276,15 +276,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include #include #include -#ifdef OLD_ASTERISK -#include -#include -#else -#include -#include -#endif #include #include +#include #include "asterisk/utils.h" #include "asterisk/lock.h" @@ -303,7 +297,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/localtime.h" #include "asterisk/cdr.h" #include "asterisk/options.h" -#include + +#include "asterisk/dahdi_compat.h" +#include "asterisk/tonezone_compat.h" /* Start a tone-list going */ int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist, int interruptible); @@ -2609,7 +2605,7 @@ static struct morse_bits mbits[] = { */ for(i = 0; i < 20 ; i++){ - flags = DAHDI_IOMUX_WRITEEMPTY | ZT_IOMUX_NOWAIT; + flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT; res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags); if(flags & DAHDI_IOMUX_WRITEEMPTY) break; @@ -2660,7 +2656,7 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) */ for(i = 0; i < 20 ; i++){ - flags = DAHDI_IOMUX_WRITEEMPTY | ZT_IOMUX_NOWAIT; + flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT; res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags); if(flags & DAHDI_IOMUX_WRITEEMPTY) break; @@ -2920,7 +2916,7 @@ char lbuf[MAXLINKLIST],*strs[MAXLINKLIST]; int i,ns,rbimode; char mhz[MAXREMSTR]; char decimals[MAXREMSTR]; -struct zt_params par; +struct dahdi_params par; /* get a pointer to myrpt */ @@ -4181,8 +4177,8 @@ struct ast_channel *mychannel,*genchannel; #endif ci.chan = 0; ci.confno = myrpt->conf; /* use the pseudo conference */ - ci.confmode = DAHDI_CONF_REALANDPSEUDO | ZT_CONF_TALKER | ZT_CONF_LISTENER - | DAHDI_CONF_PSEUDO_TALKER | ZT_CONF_PSEUDO_LISTENER; + ci.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER + | DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER; /* first put the channel on the conference */ if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1) { @@ -4204,8 +4200,8 @@ struct ast_channel *mychannel,*genchannel; #endif ci.chan = 0; ci.confno = myrpt->conf; - ci.confmode = DAHDI_CONF_REALANDPSEUDO | ZT_CONF_TALKER | ZT_CONF_LISTENER - | DAHDI_CONF_PSEUDO_TALKER | ZT_CONF_PSEUDO_LISTENER; + ci.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER + | DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER; /* first put the channel on the conference */ if (ioctl(genchannel->fds[0],DAHDI_SETCONF,&ci) == -1) { @@ -4347,7 +4343,7 @@ struct ast_channel *mychannel,*genchannel; ci.chan = 0; ci.confno = myrpt->conf; ci.confmode = (myrpt->p.duplex == 2) ? DAHDI_CONF_CONFANNMON : - (DAHDI_CONF_CONF | ZT_CONF_LISTENER | ZT_CONF_TALKER); + (DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER); /* first put the channel on the conference in announce mode */ if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1) { @@ -4402,7 +4398,7 @@ struct ast_channel *mychannel,*genchannel; ci.chan = 0; ci.confno = myrpt->conf; ci.confmode = ((myrpt->p.duplex == 2) || (myrpt->p.duplex == 4)) ? DAHDI_CONF_CONFANNMON : - (DAHDI_CONF_CONF | ZT_CONF_LISTENER | ZT_CONF_TALKER); + (DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER); /* first put the channel on the conference in announce mode */ if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1) { @@ -4610,7 +4606,7 @@ static int connect_link(struct rpt *myrpt, char* node, int mode, int perma) /* make a conference for the tx */ ci.chan = 0; ci.confno = myrpt->conf; - ci.confmode = DAHDI_CONF_CONF | ZT_CONF_LISTENER | ZT_CONF_TALKER; + ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER; /* first put the channel on the conference in proper mode */ if (ioctl(l->pchan->fds[0], DAHDI_SETCONF, &ci) == -1) { @@ -5847,9 +5843,9 @@ static void rbi_out_parallel(struct rpt *myrpt,unsigned char *data) static void rbi_out(struct rpt *myrpt,unsigned char *data) { -struct zt_radio_param r; +struct dahdi_radio_param r; - memset(&r,0,sizeof(struct zt_radio_param)); + memset(&r,0,sizeof(struct dahdi_radio_param)); r.radpar = DAHDI_RADPAR_REMMODE; r.data = DAHDI_RADPAR_REM_RBI1; /* if setparam ioctl fails, its probably not a pciradio card */ @@ -5871,7 +5867,7 @@ static int serial_remote_io(struct rpt *myrpt, unsigned char *txbuf, int txbytes unsigned char *rxbuf, int rxmaxbytes, int asciiflag) { int i,j,index,oldmode,olddata; - struct zt_radio_param prm; + struct dahdi_radio_param prm; char c; if(debug){ @@ -8963,7 +8959,7 @@ char tmpstr[300],lstr[MAXLINKLIST]; /* make a conference for the tx */ ci.chan = 0; ci.confno = -1; /* make a new conf */ - ci.confmode = DAHDI_CONF_CONF | ZT_CONF_LISTENER; + ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER; /* first put the channel on the conference in proper mode */ if (ioctl(myrpt->zaptxchannel->fds[0],DAHDI_SETCONF,&ci) == -1) { @@ -8983,7 +8979,7 @@ char tmpstr[300],lstr[MAXLINKLIST]; ci.chan = 0; ci.confno = -1; /* make a new conf */ ci.confmode = ((myrpt->p.duplex == 2) || (myrpt->p.duplex == 4)) ? DAHDI_CONF_CONFANNMON : - (DAHDI_CONF_CONF | ZT_CONF_LISTENER | ZT_CONF_TALKER); + (DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER); /* first put the channel on the conference in announce mode */ if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1) { @@ -9057,7 +9053,7 @@ char tmpstr[300],lstr[MAXLINKLIST]; /* make a conference for the tx */ ci.chan = 0; ci.confno = myrpt->txconf; - ci.confmode = DAHDI_CONF_CONF | ZT_CONF_TALKER ; + ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER ; /* first put the channel on the conference in proper mode */ if (ioctl(myrpt->txpchannel->fds[0],DAHDI_SETCONF,&ci) == -1) { @@ -10572,7 +10568,7 @@ static int rpt_exec(struct ast_channel *chan, void *data) DAHDI_PARAMS par; int ms,elap,nullfd; time_t t,last_timeout_warning; - struct zt_radio_param z; + struct dahdi_radio_param z; struct rpt_tele *telem; nullfd = open("/dev/null",O_RDWR); @@ -10948,7 +10944,7 @@ static int rpt_exec(struct ast_channel *chan, void *data) /* make a conference for the tx */ ci.chan = 0; ci.confno = myrpt->conf; - ci.confmode = DAHDI_CONF_CONF | ZT_CONF_LISTENER | ZT_CONF_TALKER; + ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER; /* first put the channel on the conference in proper mode */ if (ioctl(l->pchan->fds[0],DAHDI_SETCONF,&ci) == -1) { diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index d14a3bd03e..f6de26c4e4 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -104,6 +104,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #define SMDI_MD_WAIT_TIMEOUT 1500 /* 1.5 seconds */ #include "asterisk/dahdi_compat.h" +#include "asterisk/tonezone_compat.h" /*! Global jitterbuffer configuration - by default, jb is disabled */ static struct ast_jb_conf default_jbconf = diff --git a/configure b/configure index c992e24a54..555027df81 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 122314 . +# From configure.ac Revision: 122613 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for asterisk 1.4. # @@ -32920,8 +32920,14 @@ fi if test "${PBX_DAHDI}" = "1" || test "${USE_ZAPTEL}" = "no"; then tonezone_dir="dahdi" + if test "x${DAHDI_DIR}" != "x"; then + tonezone_extra="${tonezone_extra} -I${DAHDI_DIR}/include" + fi else tonezone_dir="zaptel" + if test "x${ZAPTEL_DIR}" != "x"; then + tonezone_extra="${tonezone_extra} -I${ZAPTEL_DIR}/include" + fi fi diff --git a/configure.ac b/configure.ac index 79ebbe8edc..09368851f2 100644 --- a/configure.ac +++ b/configure.ac @@ -1360,8 +1360,14 @@ fi if test "${PBX_DAHDI}" = "1" || test "${USE_ZAPTEL}" = "no"; then tonezone_dir="dahdi" + if test "x${DAHDI_DIR}" != "x"; then + tonezone_extra="${tonezone_extra} -I${DAHDI_DIR}/include" + fi else tonezone_dir="zaptel" + if test "x${ZAPTEL_DIR}" != "x"; then + tonezone_extra="${tonezone_extra} -I${ZAPTEL_DIR}/include" + fi fi AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [${tonezone_dir}/tonezone.h], [${tonezone_extra}]) diff --git a/include/asterisk/dahdi_compat.h b/include/asterisk/dahdi_compat.h index 69f2699cfb..9c8f6e829e 100644 --- a/include/asterisk/dahdi_compat.h +++ b/include/asterisk/dahdi_compat.h @@ -22,15 +22,13 @@ #ifndef DAHDI_COMPAT_H #define DAHDI_COMPAT_H -#ifdef HAVE_DAHDI +#if defined(HAVE_DAHDI) #include -#include #elif defined(HAVE_ZAPTEL) #include -#include /* Compiling against Zaptel instead of DAHDI */ diff --git a/include/asterisk/tonezone_compat.h b/include/asterisk/tonezone_compat.h new file mode 100644 index 0000000000..6be160cfb1 --- /dev/null +++ b/include/asterisk/tonezone_compat.h @@ -0,0 +1,35 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2008, Digium, Inc. + * + * See http://www.asterisk.org for more information about + * the Asterisk project. Please do not directly contact + * any of the maintainers of this project for assistance; + * the project provides a web site, mailing lists and IRC + * channels for your use. + * + * This program is free software, distributed under the terms of + * the GNU General Public License Version 2. See the LICENSE file + * at the top of the source tree. + */ + +/*! + * \file + * \brief Find tonezone header in the right place (DAHDI or Zaptel) + */ + +#ifndef TONEZONE_COMPAT_H +#define TONEZONE_COMPAT_H + +#if defined(HAVE_DAHDI) + +#include + +#elif defined(HAVE_ZAPTEL) + +#include + +#endif + +#endif /* TONEZONE_COMPAT_H */