aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-12 17:27:55 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-12 17:27:55 +0000
commit490730a6b3bd90a5389cac88847e6977bf234f66 (patch)
tree4732aea57767a39cd0efe083ba0119911ee976a3 /channels
parentb97df61759759251c094187317c450b97088eeaf (diff)
Goodbye Zaptel, hello DAHDI. Removes Zaptel driver support with DAHDI. Configuration file and dialplan backwards compatability has been put in place where appropiate. Release announcement to follow.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@122234 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_dahdi.c (renamed from channels/chan_zap.c)2606
-rw-r--r--channels/chan_iax2.c32
-rw-r--r--channels/chan_mgcp.c34
3 files changed, 1406 insertions, 1266 deletions
diff --git a/channels/chan_zap.c b/channels/chan_dahdi.c
index 228499df9..d0d5fba51 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_dahdi.c
@@ -18,19 +18,19 @@
/*! \file
*
- * \brief Zaptel Pseudo TDM interface
+ * \brief DAHDI for Pseudo TDM
*
* \author Mark Spencer <markster@digium.com>
*
- * Connects to the Zaptel telephony library as well as
+ * Connects to the DAHDI telephony library as well as
* libpri. Libpri is optional and needed only if you are
* going to use ISDN connections.
*
* You need to install libraries before you attempt to compile
- * and install the Zaptel channel.
+ * and install the DAHDI channel.
*
* \par See also
- * \arg \ref Config_zap
+ * \arg \ref Config_dahdi
*
* \ingroup channel_drivers
*
@@ -39,8 +39,7 @@
/*** MODULEINFO
<depend>res_smdi</depend>
- <depend>zaptel_vldtmf</depend>
- <depend>zaptel</depend>
+ <depend>dahdi</depend>
<depend>tonezone</depend>
<use>pri</use>
<use>ss7</use>
@@ -59,7 +58,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/ioctl.h>
#include <math.h>
#include <ctype.h>
-#include "asterisk/zapata.h"
+#include "asterisk/dahdi.h"
#ifdef HAVE_PRI
#include <libpri.h>
@@ -102,7 +101,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define SMDI_MD_WAIT_TIMEOUT 1500 /* 1.5 seconds */
-#ifdef ZT_SPANINFO_HAS_LINECONFIG
+#ifdef DAHDI_SPANINFO_HAS_LINECONFIG
static const char *lbostr[] = {
"0 db (CSU)/0-133 feet (DSX-1)",
"133-266 feet (DSX-1)",
@@ -125,14 +124,14 @@ static struct ast_jb_conf default_jbconf =
};
static struct ast_jb_conf global_jbconf;
-#if !defined(ZT_SIG_EM_E1) || (defined(HAVE_PRI) && !defined(ZT_SIG_HARDHDLC))
-#error "Your Zaptel is too old. Please update"
+#if !defined(DAHDI_SIG_EM_E1) || (defined(HAVE_PRI) && !defined(DAHDI_SIG_HARDHDLC))
+#error "Your DAHDI is too old. Please update"
#endif
-#ifndef ZT_TONEDETECT
+#ifndef DAHDI_TONEDETECT
/* Work around older code with no tone detect */
-#define ZT_EVENT_DTMFDOWN 0
-#define ZT_EVENT_DTMFUP 0
+#define DAHDI_EVENT_DTMFDOWN 0
+#define DAHDI_EVENT_DTMFUP 0
#endif
/* define this to send PRI user-user information elements */
@@ -154,20 +153,20 @@ static struct ast_jb_conf global_jbconf;
* before dialing on it. Certain FXO interfaces always think they're out of
* service with this method however.
*/
-/* #define ZAP_CHECK_HOOKSTATE */
+/* #define DAHDI_CHECK_HOOKSTATE */
/*! \brief Typically, how many rings before we should send Caller*ID */
#define DEFAULT_CIDRINGS 1
#define CHANNEL_PSEUDO -12
-#define AST_LAW(p) (((p)->law == ZT_LAW_ALAW) ? AST_FORMAT_ALAW : AST_FORMAT_ULAW)
+#define AST_LAW(p) (((p)->law == DAHDI_LAW_ALAW) ? AST_FORMAT_ALAW : AST_FORMAT_ULAW)
/*! \brief Signaling types that need to use MF detection should be placed in this macro */
#define NEED_MFDETECT(p) (((p)->sig == SIG_FEATDMF) || ((p)->sig == SIG_FEATDMF_TA) || ((p)->sig == SIG_E911) || ((p)->sig == SIG_FGC_CAMA) || ((p)->sig == SIG_FGC_CAMAMF) || ((p)->sig == SIG_FEATB))
-static const char tdesc[] = "Zapata Telephony Driver"
+static const char tdesc[] = "DAHDI Telephony Driver"
#ifdef HAVE_PRI
" w/PRI"
#endif
@@ -176,38 +175,38 @@ static const char tdesc[] = "Zapata Telephony Driver"
#endif
;
-static const char config[] = "zapata.conf";
-
-#define SIG_EM ZT_SIG_EM
-#define SIG_EMWINK (0x0100000 | ZT_SIG_EM)
-#define SIG_FEATD (0x0200000 | ZT_SIG_EM)
-#define SIG_FEATDMF (0x0400000 | ZT_SIG_EM)
-#define SIG_FEATB (0x0800000 | ZT_SIG_EM)
-#define SIG_E911 (0x1000000 | ZT_SIG_EM)
-#define SIG_FEATDMF_TA (0x2000000 | ZT_SIG_EM)
-#define SIG_FGC_CAMA (0x4000000 | ZT_SIG_EM)
-#define SIG_FGC_CAMAMF (0x8000000 | ZT_SIG_EM)
-#define SIG_FXSLS ZT_SIG_FXSLS
-#define SIG_FXSGS ZT_SIG_FXSGS
-#define SIG_FXSKS ZT_SIG_FXSKS
-#define SIG_FXOLS ZT_SIG_FXOLS
-#define SIG_FXOGS ZT_SIG_FXOGS
-#define SIG_FXOKS ZT_SIG_FXOKS
-#define SIG_PRI ZT_SIG_CLEAR
-#define SIG_BRI (0x2000000 | ZT_SIG_CLEAR)
-#define SIG_BRI_PTMP (0X4000000 | ZT_SIG_CLEAR)
-#define SIG_SS7 (0x1000000 | ZT_SIG_CLEAR)
-#define SIG_SF ZT_SIG_SF
-#define SIG_SFWINK (0x0100000 | ZT_SIG_SF)
-#define SIG_SF_FEATD (0x0200000 | ZT_SIG_SF)
-#define SIG_SF_FEATDMF (0x0400000 | ZT_SIG_SF)
-#define SIG_SF_FEATB (0x0800000 | ZT_SIG_SF)
-#define SIG_EM_E1 ZT_SIG_EM_E1
-#define SIG_GR303FXOKS (0x0100000 | ZT_SIG_FXOKS)
-#define SIG_GR303FXSKS (0x0100000 | ZT_SIG_FXSKS)
+static const char config[] = "chan_dahdi.conf";
+
+#define SIG_EM DAHDI_SIG_EM
+#define SIG_EMWINK (0x0100000 | DAHDI_SIG_EM)
+#define SIG_FEATD (0x0200000 | DAHDI_SIG_EM)
+#define SIG_FEATDMF (0x0400000 | DAHDI_SIG_EM)
+#define SIG_FEATB (0x0800000 | DAHDI_SIG_EM)
+#define SIG_E911 (0x1000000 | DAHDI_SIG_EM)
+#define SIG_FEATDMF_TA (0x2000000 | DAHDI_SIG_EM)
+#define SIG_FGC_CAMA (0x4000000 | DAHDI_SIG_EM)
+#define SIG_FGC_CAMAMF (0x8000000 | DAHDI_SIG_EM)
+#define SIG_FXSLS DAHDI_SIG_FXSLS
+#define SIG_FXSGS DAHDI_SIG_FXSGS
+#define SIG_FXSKS DAHDI_SIG_FXSKS
+#define SIG_FXOLS DAHDI_SIG_FXOLS
+#define SIG_FXOGS DAHDI_SIG_FXOGS
+#define SIG_FXOKS DAHDI_SIG_FXOKS
+#define SIG_PRI DAHDI_SIG_CLEAR
+#define SIG_BRI (0x2000000 | DAHDI_SIG_CLEAR)
+#define SIG_BRI_PTMP (0X4000000 | DAHDI_SIG_CLEAR)
+#define SIG_SS7 (0x1000000 | DAHDI_SIG_CLEAR)
+#define SIG_SF DAHDI_SIG_SF
+#define SIG_SFWINK (0x0100000 | DAHDI_SIG_SF)
+#define SIG_SF_FEATD (0x0200000 | DAHDI_SIG_SF)
+#define SIG_SF_FEATDMF (0x0400000 | DAHDI_SIG_SF)
+#define SIG_SF_FEATB (0x0800000 | DAHDI_SIG_SF)
+#define SIG_EM_E1 DAHDI_SIG_EM_E1
+#define SIG_GR303FXOKS (0x0100000 | DAHDI_SIG_FXOKS)
+#define SIG_GR303FXSKS (0x0100000 | DAHDI_SIG_FXSKS)
#ifdef LOTS_OF_SPANS
-#define NUM_SPANS ZT_MAX_SPANS
+#define NUM_SPANS DAHDI_MAX_SPANS
#else
#define NUM_SPANS 32
#endif
@@ -223,10 +222,10 @@ static const char config[] = "zapata.conf";
#define DCHAN_AVAILABLE (DCHAN_PROVISIONED | DCHAN_NOTINALARM | DCHAN_UP)
/* Overlap dialing option types */
-#define ZAP_OVERLAPDIAL_NONE 0
-#define ZAP_OVERLAPDIAL_OUTGOING 1
-#define ZAP_OVERLAPDIAL_INCOMING 2
-#define ZAP_OVERLAPDIAL_BOTH (ZAP_OVERLAPDIAL_INCOMING|ZAP_OVERLAPDIAL_OUTGOING)
+#define DAHDI_OVERLAPDIAL_NONE 0
+#define DAHDI_OVERLAPDIAL_OUTGOING 1
+#define DAHDI_OVERLAPDIAL_INCOMING 2
+#define DAHDI_OVERLAPDIAL_BOTH (DAHDI_OVERLAPDIAL_INCOMING|DAHDI_OVERLAPDIAL_OUTGOING)
#define CALLPROGRESS_PROGRESS 1
@@ -269,7 +268,7 @@ static int gendigittimeout = 8000;
/*! \brief How long to wait for an extra digit, if there is an ambiguous match */
static int matchdigittimeout = 3000;
-/*! \brief Protect the interface list (of zt_pvt's) */
+/*! \brief Protect the interface list (of dahdi_pvt's) */
AST_MUTEX_DEFINE_STATIC(iflock);
@@ -289,35 +288,35 @@ static pthread_t monitor_thread = AST_PTHREADT_NULL;
static int restart_monitor(void);
-static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
+static enum ast_bridge_result dahdi_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
-static int zt_sendtext(struct ast_channel *c, const char *text);
+static int dahdi_sendtext(struct ast_channel *c, const char *text);
static void mwi_event_cb(const struct ast_event *event, void *userdata)
{
/* This module does not handle MWI in an event-based manner. However, it
* subscribes to MWI for each mailbox that is configured so that the core
- * knows that we care about it. Then, chan_zap will get the MWI from the
+ * knows that we care about it. Then, chan_dahdi will get the MWI from the
* event cache instead of checking the mailbox directly. */
}
-/*! \brief Avoid the silly zt_getevent which ignores a bunch of events */
-static inline int zt_get_event(int fd)
+/*! \brief Avoid the silly dahdi_getevent which ignores a bunch of events */
+static inline int dahdi_get_event(int fd)
{
int j;
- if (ioctl(fd, ZT_GETEVENT, &j) == -1)
+ if (ioctl(fd, DAHDI_GETEVENT, &j) == -1)
return -1;
return j;
}
-/*! \brief Avoid the silly zt_waitevent which ignores a bunch of events */
-static inline int zt_wait_event(int fd)
+/*! \brief Avoid the silly dahdi_waitevent which ignores a bunch of events */
+static inline int dahdi_wait_event(int fd)
{
int i, j = 0;
- i = ZT_IOMUX_SIGEVENT;
- if (ioctl(fd, ZT_IOMUX, &i) == -1)
+ i = DAHDI_IOMUX_SIGEVENT;
+ if (ioctl(fd, DAHDI_IOMUX, &i) == -1)
return -1;
- if (ioctl(fd, ZT_GETEVENT, &j) == -1)
+ if (ioctl(fd, DAHDI_GETEVENT, &j) == -1)
return -1;
return j;
}
@@ -334,7 +333,7 @@ static inline int zt_wait_event(int fd)
#define MIN_MS_SINCE_FLASH ( (2000) ) /*!< 2000 ms */
#define DEFAULT_RINGT ( (8000 * 8) / READ_SIZE) /*!< 8,000 ms */
-struct zt_pvt;
+struct dahdi_pvt;
static int ringt_base = DEFAULT_RINGT;
@@ -347,7 +346,7 @@ static int ringt_base = DEFAULT_RINGT;
#define SS7_NAI_DYNAMIC -1
-struct zt_ss7 {
+struct dahdi_ss7 {
pthread_t master; /*!< Thread of master */
ast_mutex_t lock;
int fds[NUM_DCHANS];
@@ -366,10 +365,10 @@ struct zt_ss7 {
char subscriberprefix[20]; /*!< area access code + area code ('0'+area code for european dialplans) */
char unknownprefix[20]; /*!< for unknown dialplans */
struct ss7 *ss7;
- struct zt_pvt *pvts[MAX_CHANNELS]; /*!< Member channel pvt structs */
+ struct dahdi_pvt *pvts[MAX_CHANNELS]; /*!< Member channel pvt structs */
};
-static struct zt_ss7 linksets[NUM_SPANS];
+static struct dahdi_ss7 linksets[NUM_SPANS];
static int cur_ss7type = -1;
static int cur_linkset = -1;
@@ -387,7 +386,7 @@ static int cur_defaultdpc = -1;
#define PRI_SPAN(p) (((p) >> 8) & 0xff)
#define PRI_EXPLICIT(p) (((p) >> 16) & 0x01)
-struct zt_pri {
+struct dahdi_pri {
pthread_t master; /*!< Thread of master */
ast_mutex_t lock; /*!< Mutex */
char idleext[AST_MAX_EXTENSION]; /*!< Where to idle extra calls */
@@ -424,13 +423,13 @@ struct zt_pri {
time_t lastreset; /*!< time when unused channels were last reset */
long resetinterval; /*!< Interval (in seconds) for resetting unused channels */
int sig;
- struct zt_pvt *pvts[MAX_CHANNELS]; /*!< Member channel pvt structs */
- struct zt_pvt *crvs; /*!< Member CRV structs */
- struct zt_pvt *crvend; /*!< Pointer to end of CRV structs */
+ struct dahdi_pvt *pvts[MAX_CHANNELS]; /*!< Member channel pvt structs */
+ struct dahdi_pvt *crvs; /*!< Member CRV structs */
+ struct dahdi_pvt *crvend; /*!< Pointer to end of CRV structs */
};
-static struct zt_pri pris[NUM_SPANS];
+static struct dahdi_pri pris[NUM_SPANS];
#if 0
#define DEFAULT_PRI_DEBUG (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_STATE)
@@ -438,14 +437,14 @@ static struct zt_pri pris[NUM_SPANS];
#define DEFAULT_PRI_DEBUG 0
#endif
-static inline void pri_rel(struct zt_pri *pri)
+static inline void pri_rel(struct dahdi_pri *pri)
{
ast_mutex_unlock(&pri->lock);
}
#else
/*! Shut up the compiler */
-struct zt_pri;
+struct dahdi_pri;
#endif
#define SUB_REAL 0 /*!< Active call */
@@ -464,7 +463,7 @@ struct distRingData {
struct ringContextData {
char contextData[AST_MAX_CONTEXT];
};
-struct zt_distRings {
+struct dahdi_distRings {
struct distRingData ringnum[3];
struct ringContextData ringContext[3];
};
@@ -475,7 +474,7 @@ static char *subnames[] = {
"Threeway"
};
-struct zt_subchannel {
+struct dahdi_subchannel {
int zfd;
struct ast_channel *owner;
int chan;
@@ -491,7 +490,7 @@ struct zt_subchannel {
unsigned int needunhold:1;
unsigned int linear:1;
unsigned int inthreeway:1;
- ZT_CONFINFO curconf;
+ DAHDI_CONFINFO curconf;
};
#define CONF_USER_REAL (1 << 0)
@@ -499,30 +498,30 @@ struct zt_subchannel {
#define MAX_SLAVES 4
-static struct zt_pvt {
+static struct dahdi_pvt {
ast_mutex_t lock;
struct ast_channel *owner; /*!< Our current active owner (if applicable) */
/*!< Up to three channels can be associated with this call */
- struct zt_subchannel sub_unused; /*!< Just a safety precaution */
- struct zt_subchannel subs[3]; /*!< Sub-channels */
- struct zt_confinfo saveconf; /*!< Saved conference info */
+ struct dahdi_subchannel sub_unused; /*!< Just a safety precaution */
+ struct dahdi_subchannel subs[3]; /*!< Sub-channels */
+ struct dahdi_confinfo saveconf; /*!< Saved conference info */
- struct zt_pvt *slaves[MAX_SLAVES]; /*!< Slave to us (follows our conferencing) */
- struct zt_pvt *master; /*!< Master to us (we follow their conferencing) */
+ struct dahdi_pvt *slaves[MAX_SLAVES]; /*!< Slave to us (follows our conferencing) */
+ struct dahdi_pvt *master; /*!< Master to us (we follow their conferencing) */
int inconference; /*!< If our real should be in the conference */
int sig; /*!< Signalling style */
int radio; /*!< radio type */
int outsigmod; /*!< Outbound Signalling style (modifier) */
int oprmode; /*!< "Operator Services" mode */
- struct zt_pvt *oprpeer; /*!< "Operator Services" peer tech_pvt ptr */
+ struct dahdi_pvt *oprpeer; /*!< "Operator Services" peer tech_pvt ptr */
float cid_rxgain; /*!< "Gain to apply during caller id */
float rxgain;
float txgain;
int tonezone; /*!< tone zone for this chan, or -1 for default */
- struct zt_pvt *next; /*!< Next channel in list */
- struct zt_pvt *prev; /*!< Prev channel in list */
+ struct dahdi_pvt *next; /*!< Next channel in list */
+ struct dahdi_pvt *prev; /*!< Prev channel in list */
/* flags */
unsigned int adsi:1;
@@ -567,7 +566,7 @@ static struct zt_pvt {
unsigned int use_callerid:1; /*!< Whether or not to use caller id on this channel */
unsigned int use_callingpres:1; /*!< Whether to use the callingpres the calling switch sends */
unsigned int usedistinctiveringdetection:1;
- unsigned int zaptrcallerid:1; /*!< should we use the callerid from incoming call on zap transfer or not */
+ unsigned int dahditrcallerid:1; /*!< should we use the callerid from incoming call on dahdi transfer or not */
unsigned int transfertobusy:1; /*!< allow flash-transfers to busy channels */
unsigned int mwimonitor_neon:1; /*!< monitor this FXO port for neon type MWI indication from other end */
unsigned int mwimonitor_fsk:1; /*!< monitor this FXO port for fsk MWI indication from other end */
@@ -589,7 +588,7 @@ static struct zt_pvt {
unsigned int use_smdi:1; /* Whether to use SMDI on this channel */
struct ast_smdi_interface *smdi_iface; /* The serial port to listen for SMDI data on */
- struct zt_distRings drings;
+ struct dahdi_distRings drings;
char context[AST_MAX_CONTEXT];
char defcontext[AST_MAX_CONTEXT];
@@ -637,14 +636,10 @@ static struct zt_pvt {
int stripmsd;
int callwaitcas;
int callwaitrings;
-#if defined(HAVE_ZAPTEL_ECHOCANPARAMS)
struct {
- struct zt_echocanparams head;
- struct zt_echocanparam params[ZT_MAX_ECHOCANPARAMS];
+ struct dahdi_echocanparams head;
+ struct dahdi_echocanparam params[DAHDI_MAX_ECHOCANPARAMS];
} echocancel;
-#else
- int echocancel;
-#endif
int echotraining;
char echorest[20];
int busycount;
@@ -654,7 +649,7 @@ static struct zt_pvt {
struct timeval flashtime; /*!< Last flash-hook time */
struct ast_dsp *dsp;
int cref; /*!< Call reference number */
- ZT_DIAL_OPERATION dop;
+ DAHDI_DIAL_OPERATION dop;
int whichwink; /*!< SIG_FEATDMF_TA Which wink are we on? */
char finaldial[64];
char accountcode[AST_MAX_ACCOUNT_CODE]; /*!< Account code */
@@ -674,9 +669,9 @@ static struct zt_pvt {
struct timeval polaritydelaytv;
int sendcalleridafter;
#ifdef HAVE_PRI
- struct zt_pri *pri;
- struct zt_pvt *bearer;
- struct zt_pvt *realcall;
+ struct dahdi_pri *pri;
+ struct dahdi_pvt *bearer;
+ struct dahdi_pvt *realcall;
q931_call *call;
int prioffset;
int logicalspan;
@@ -684,7 +679,7 @@ static struct zt_pvt {
int polarity;
int dsp_features;
#ifdef HAVE_SS7
- struct zt_ss7 *ss7;
+ struct dahdi_ss7 *ss7;
struct isup_call *ss7call;
char charge_number[50];
char gen_add_number[50];
@@ -715,37 +710,37 @@ static struct zt_pvt {
int muting;
} *iflist = NULL, *ifend = NULL;
-/*! \brief Channel configuration from zapata.conf .
- * This struct is used for parsing the [channels] section of zapata.conf.
+/*! \brief Channel configuration from chan_dahdi.conf .
+ * This struct is used for parsing the [channels] section of chan_dahdi.conf.
* Generally there is a field here for every possible configuration item.
*
* The state of fields is saved along the parsing and whenever a 'channel'
- * statement is reached, the current zt_chan_conf is used to configure the
- * channel (struct zt_pvt)
+ * statement is reached, the current dahdi_chan_conf is used to configure the
+ * channel (struct dahdi_pvt)
*
- * \see zt_chan_init for the default values.
+ * \see dahdi_chan_init for the default values.
*/
-struct zt_chan_conf {
- struct zt_pvt chan;
+struct dahdi_chan_conf {
+ struct dahdi_pvt chan;
#ifdef HAVE_PRI
- struct zt_pri pri;
+ struct dahdi_pri pri;
#endif
#ifdef HAVE_SS7
- struct zt_ss7 ss7;
+ struct dahdi_ss7 ss7;
#endif
- ZT_PARAMS timing;
- int is_sig_auto; /*!< Use channel signalling from Zaptel? */
+ DAHDI_PARAMS timing;
+ int is_sig_auto; /*!< Use channel signalling from DAHDI? */
char smdi_port[SMDI_MAX_FILENAME_LEN];
};
-/*! returns a new zt_chan_conf with default values (by-value) */
-static struct zt_chan_conf zt_chan_conf_default(void) {
+/*! returns a new dahdi_chan_conf with default values (by-value) */
+static struct dahdi_chan_conf dahdi_chan_conf_default(void) {
/* recall that if a field is not included here it is initialized
* to 0 or equivalent
*/
- struct zt_chan_conf conf = {
+ struct dahdi_chan_conf conf = {
#ifdef HAVE_PRI
.pri = {
.nsf = PRI_NSF_NONE,
@@ -786,7 +781,7 @@ static struct zt_chan_conf zt_chan_conf_default(void) {
.cid_signalling = CID_SIG_BELL,
.cid_start = CID_START_RING,
- .zaptrcallerid = 0,
+ .dahditrcallerid = 0,
.use_callerid = 1,
.sig = -1,
.outsigmod = -1,
@@ -795,11 +790,7 @@ static struct zt_chan_conf zt_chan_conf_default(void) {
.tonezone = -1,
-#if defined(HAVE_ZAPTEL_ECHOCANPARAMS)
.echocancel.head.tap_length = 1,
-#else
- .echocancel = 1,
-#endif
.busycount = 3,
@@ -830,40 +821,40 @@ static struct zt_chan_conf zt_chan_conf_default(void) {
}
-static struct ast_channel *zt_request(const char *type, int format, void *data, int *cause);
-static int zt_digit_begin(struct ast_channel *ast, char digit);
-static int zt_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
-static int zt_sendtext(struct ast_channel *c, const char *text);
-static int zt_call(struct ast_channel *ast, char *rdest, int timeout);
-static int zt_hangup(struct ast_channel *ast);
-static int zt_answer(struct ast_channel *ast);
-static struct ast_frame *zt_read(struct ast_channel *ast);
-static int zt_write(struct ast_channel *ast, struct ast_frame *frame);
-static struct ast_frame *zt_exception(struct ast_channel *ast);
-static int zt_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen);
-static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
-static int zt_setoption(struct ast_channel *chan, int option, void *data, int datalen);
-static int zt_func_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len);
-
-static const struct ast_channel_tech zap_tech = {
- .type = "Zap",
+static struct ast_channel *dahdi_request(const char *type, int format, void *data, int *cause);
+static int dahdi_digit_begin(struct ast_channel *ast, char digit);
+static int dahdi_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
+static int dahdi_sendtext(struct ast_channel *c, const char *text);
+static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout);
+static int dahdi_hangup(struct ast_channel *ast);
+static int dahdi_answer(struct ast_channel *ast);
+static struct ast_frame *dahdi_read(struct ast_channel *ast);
+static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame);
+static struct ast_frame *dahdi_exception(struct ast_channel *ast);
+static int dahdi_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen);
+static int dahdi_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
+static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int datalen);
+static int dahdi_func_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len);
+
+static const struct ast_channel_tech dahdi_tech = {
+ .type = "DAHDI",
.description = tdesc,
.capabilities = AST_FORMAT_SLINEAR | AST_FORMAT_ULAW | AST_FORMAT_ALAW,
- .requester = zt_request,
- .send_digit_begin = zt_digit_begin,
- .send_digit_end = zt_digit_end,
- .send_text = zt_sendtext,
- .call = zt_call,
- .hangup = zt_hangup,
- .answer = zt_answer,
- .read = zt_read,
- .write = zt_write,
- .bridge = zt_bridge,
- .exception = zt_exception,
- .indicate = zt_indicate,
- .fixup = zt_fixup,
- .setoption = zt_setoption,
- .func_channel_read = zt_func_read,
+ .requester = dahdi_request,
+ .send_digit_begin = dahdi_digit_begin,
+ .send_digit_end = dahdi_digit_end,
+ .send_text = dahdi_sendtext,
+ .call = dahdi_call,
+ .hangup = dahdi_hangup,
+ .answer = dahdi_answer,
+ .read = dahdi_read,
+ .write = dahdi_write,
+ .bridge = dahdi_bridge,
+ .exception = dahdi_exception,
+ .indicate = dahdi_indicate,
+ .fixup = dahdi_fixup,
+ .setoption = dahdi_setoption,
+ .func_channel_read = dahdi_func_read,
};
#ifdef HAVE_PRI
@@ -872,10 +863,10 @@ static const struct ast_channel_tech zap_tech = {
#define GET_CHANNEL(p) ((p)->channel)
#endif
-struct zt_pvt *round_robin[32];
+struct dahdi_pvt *round_robin[32];
#ifdef HAVE_PRI
-static inline int pri_grab(struct zt_pvt *pvt, struct zt_pri *pri)
+static inline int pri_grab(struct dahdi_pvt *pvt, struct dahdi_pri *pri)
{
int res;
/* Grab the lock first */
@@ -892,12 +883,12 @@ static inline int pri_grab(struct zt_pvt *pvt, struct zt_pri *pri)
#endif
#ifdef HAVE_SS7
-static inline void ss7_rel(struct zt_ss7 *ss7)
+static inline void ss7_rel(struct dahdi_ss7 *ss7)
{
ast_mutex_unlock(&ss7->lock);
}
-static inline int ss7_grab(struct zt_pvt *pvt, struct zt_ss7 *pri)
+static inline int ss7_grab(struct dahdi_pvt *pvt, struct dahdi_ss7 *pri)
{
int res;
/* Grab the lock first */
@@ -919,7 +910,7 @@ static inline int ss7_grab(struct zt_pvt *pvt, struct zt_ss7 *pri)
static int num_cadence = 4;
static int user_has_defined_cadences = 0;
-static struct zt_ring_cadence cadences[NUM_CADENCE_MAX] = {
+static struct dahdi_ring_cadence cadences[NUM_CADENCE_MAX] = {
{ { 125, 125, 2000, 4000 } }, /*!< Quick chirp followed by normal ring */
{ { 250, 250, 500, 1000, 250, 250, 500, 4000 } }, /*!< British style ring */
{ { 125, 125, 125, 125, 125, 4000 } }, /*!< Three short bursts */
@@ -940,10 +931,10 @@ static int cidrings[NUM_CADENCE_MAX] = {
#define ISTRUNK(p) ((p->sig == SIG_FXSLS) || (p->sig == SIG_FXSKS) || \
(p->sig == SIG_FXSGS) || (p->sig == SIG_PRI))
-#define CANBUSYDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
-#define CANPROGRESSDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __ZT_SIG_FXO) */)
+#define CANBUSYDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __DAHDI_SIG_FXO) */)
+#define CANPROGRESSDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __DAHDI_SIG_FXO) */)
-static int zt_get_index(struct ast_channel *ast, struct zt_pvt *p, int nullok)
+static int dahdi_get_index(struct ast_channel *ast, struct dahdi_pvt *p, int nullok)
{
int res;
if (p->subs[0].owner == ast)
@@ -961,9 +952,9 @@ static int zt_get_index(struct ast_channel *ast, struct zt_pvt *p, int nullok)
}
#ifdef HAVE_PRI
-static void wakeup_sub(struct zt_pvt *p, int a, struct zt_pri *pri)
+static void wakeup_sub(struct dahdi_pvt *p, int a, struct dahdi_pri *pri)
#else
-static void wakeup_sub(struct zt_pvt *p, int a, void *pri)
+static void wakeup_sub(struct dahdi_pvt *p, int a, void *pri)
#endif
{
#ifdef HAVE_PRI
@@ -988,13 +979,13 @@ static void wakeup_sub(struct zt_pvt *p, int a, void *pri)
#endif
}
-static void zap_queue_frame(struct zt_pvt *p, struct ast_frame *f, void *data)
+static void dahdi_queue_frame(struct dahdi_pvt *p, struct ast_frame *f, void *data)
{
#ifdef HAVE_PRI
- struct zt_pri *pri = (struct zt_pri*) data;
+ struct dahdi_pri *pri = (struct dahdi_pri*) data;
#endif
#ifdef HAVE_SS7
- struct zt_ss7 *ss7 = (struct zt_ss7*) data;
+ struct dahdi_ss7 *ss7 = (struct dahdi_ss7*) data;
#endif
/* We must unlock the PRI to avoid the possibility of a deadlock */
#if defined(HAVE_PRI) || defined(HAVE_SS7)
@@ -1052,9 +1043,9 @@ static void zap_queue_frame(struct zt_pvt *p, struct ast_frame *f, void *data)
#endif
}
-static int restore_gains(struct zt_pvt *p);
+static int restore_gains(struct dahdi_pvt *p);
-static void swap_subs(struct zt_pvt *p, int a, int b)
+static void swap_subs(struct dahdi_pvt *p, int a, int b)
{
int tchan;
int tinthreeway;
@@ -1082,7 +1073,7 @@ static void swap_subs(struct zt_pvt *p, int a, int b)
wakeup_sub(p, b, NULL);
}
-static int zt_open(char *fn)
+static int dahdi_open(char *fn)
{
int fd;
int isnum;
@@ -1102,7 +1093,7 @@ static int zt_open(char *fn)
ast_log(LOG_WARNING, "Invalid channel number '%s'\n", fn);
return -1;
}
- fn = "/dev/zap/channel";
+ fn = "/dev/dahdi/channel";
}
fd = open(fn, O_RDWR | O_NONBLOCK);
if (fd < 0) {
@@ -1110,7 +1101,7 @@ static int zt_open(char *fn)
return -1;
}
if (chan) {
- if (ioctl(fd, ZT_SPECIFY, &chan)) {
+ if (ioctl(fd, DAHDI_SPECIFY, &chan)) {
x = errno;
close(fd);
errno = x;
@@ -1119,7 +1110,7 @@ static int zt_open(char *fn)
}
}
bs = READ_SIZE;
- if (ioctl(fd, ZT_SET_BLOCKSIZE, &bs) == -1) {
+ if (ioctl(fd, DAHDI_SET_BLOCKSIZE, &bs) == -1) {
ast_log(LOG_WARNING, "Unable to set blocksize '%d': %s\n", bs, strerror(errno));
x = errno;
close(fd);
@@ -1129,52 +1120,52 @@ static int zt_open(char *fn)
return fd;
}
-static void zt_close(int fd)
+static void dahdi_close(int fd)
{
if (fd > 0)
close(fd);
}
-static int zt_setlinear(int zfd, int linear)
+static int dahdi_setlinear(int zfd, int linear)
{
int res;
- res = ioctl(zfd, ZT_SETLINEAR, &linear);
+ res = ioctl(zfd, DAHDI_SETLINEAR, &linear);
if (res)
return res;
return 0;
}
-static int alloc_sub(struct zt_pvt *p, int x)
+static int alloc_sub(struct dahdi_pvt *p, int x)
{
- ZT_BUFFERINFO bi;
+ DAHDI_BUFFERINFO bi;
int res;
if (p->subs[x].zfd >= 0) {
ast_log(LOG_WARNING, "%s subchannel of %d already in use\n", subnames[x], p->channel);
return -1;
}
- p->subs[x].zfd = zt_open("/dev/zap/pseudo");
+ p->subs[x].zfd = dahdi_open("/dev/dahdi/pseudo");
if (p->subs[x].zfd <= -1) {
ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
return -1;
}
- res = ioctl(p->subs[x].zfd, ZT_GET_BUFINFO, &bi);
+ res = ioctl(p->subs[x].zfd, DAHDI_GET_BUFINFO, &bi);
if (!res) {
- bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+ bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+ bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = numbufs;
- res = ioctl(p->subs[x].zfd, ZT_SET_BUFINFO, &bi);
+ res = ioctl(p->subs[x].zfd, DAHDI_SET_BUFINFO, &bi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set buffer policy on channel %d\n", x);
}
} else
ast_log(LOG_WARNING, "Unable to check buffer policy on channel %d\n", x);
- if (ioctl(p->subs[x].zfd, ZT_CHANNO, &p->subs[x].chan) == 1) {
+ if (ioctl(p->subs[x].zfd, DAHDI_CHANNO, &p->subs[x].chan) == 1) {
ast_log(LOG_WARNING, "Unable to get channel number for pseudo channel on FD %d\n", p->subs[x].zfd);
- zt_close(p->subs[x].zfd);
+ dahdi_close(p->subs[x].zfd);
p->subs[x].zfd = -1;
return -1;
}
@@ -1182,7 +1173,7 @@ static int alloc_sub(struct zt_pvt *p, int x)
return 0;
}
-static int unalloc_sub(struct zt_pvt *p, int x)
+static int unalloc_sub(struct dahdi_pvt *p, int x)
{
if (!x) {
ast_log(LOG_WARNING, "Trying to unalloc the real channel %d?!?\n", p->channel);
@@ -1190,7 +1181,7 @@ static int unalloc_sub(struct zt_pvt *p, int x)
}
ast_debug(1, "Released sub %d of channel %d\n", x, p->channel);
if (p->subs[x].zfd > -1) {
- zt_close(p->subs[x].zfd);
+ dahdi_close(p->subs[x].zfd);
}
p->subs[x].zfd = -1;
p->subs[x].linear = 0;
@@ -1205,22 +1196,22 @@ static int unalloc_sub(struct zt_pvt *p, int x)
static int digit_to_dtmfindex(char digit)
{
if (isdigit(digit))
- return ZT_TONE_DTMF_BASE + (digit - '0');
+ return DAHDI_TONE_DTMF_BASE + (digit - '0');
else if (digit >= 'A' && digit <= 'D')
- return ZT_TONE_DTMF_A + (digit - 'A');
+ return DAHDI_TONE_DTMF_A + (digit - 'A');
else if (digit >= 'a' && digit <= 'd')
- return ZT_TONE_DTMF_A + (digit - 'a');
+ return DAHDI_TONE_DTMF_A + (digit - 'a');
else if (digit == '*')
- return ZT_TONE_DTMF_s;
+ return DAHDI_TONE_DTMF_s;
else if (digit == '#')
- return ZT_TONE_DTMF_p;
+ return DAHDI_TONE_DTMF_p;
else
return -1;
}
-static int zt_digit_begin(struct ast_channel *chan, char digit)
+static int dahdi_digit_begin(struct ast_channel *chan, char digit)
{
- struct zt_pvt *pvt;
+ struct dahdi_pvt *pvt;
int index;
int dtmf = -1;
@@ -1228,7 +1219,7 @@ static int zt_digit_begin(struct ast_channel *chan, char digit)
ast_mutex_lock(&pvt->lock);
- index = zt_get_index(chan, pvt, 0);
+ index = dahdi_get_index(chan, pvt, 0);
if ((index != SUB_REAL) || !pvt->owner)
goto out;
@@ -1255,16 +1246,16 @@ static int zt_digit_begin(struct ast_channel *chan, char digit)
if ((dtmf = digit_to_dtmfindex(digit)) == -1)
goto out;
- if (pvt->pulse || ioctl(pvt->subs[SUB_REAL].zfd, ZT_SENDTONE, &dtmf)) {
+ if (pvt->pulse || ioctl(pvt->subs[SUB_REAL].zfd, DAHDI_SENDTONE, &dtmf)) {
int res;
- ZT_DIAL_OPERATION zo = {
- .op = ZT_DIAL_OP_APPEND,
+ DAHDI_DIAL_OPERATION zo = {
+ .op = DAHDI_DIAL_OP_APPEND,
};
zo.dialstr[0] = 'T';
zo.dialstr[1] = digit;
zo.dialstr[2] = '\0';
- if ((res = ioctl(pvt->subs[SUB_REAL].zfd, ZT_DIAL, &zo)))
+ if ((res = ioctl(pvt->subs[SUB_REAL].zfd, DAHDI_DIAL, &zo)))
ast_log(LOG_WARNING, "Couldn't dial digit %c\n", digit);
else
pvt->dialing = 1;
@@ -1280,9 +1271,9 @@ out:
return 0;
}
-static int zt_digit_end(struct ast_channel *chan, char digit, unsigned int duration)
+static int dahdi_digit_end(struct ast_channel *chan, char digit, unsigned int duration)
{
- struct zt_pvt *pvt;
+ struct dahdi_pvt *pvt;
int res = 0;
int index;
int x;
@@ -1291,7 +1282,7 @@ static int zt_digit_end(struct ast_channel *chan, char digit, unsigned int durat
ast_mutex_lock(&pvt->lock);
- index = zt_get_index(chan, pvt, 0);
+ index = dahdi_get_index(chan, pvt, 0);
if ((index != SUB_REAL) || !pvt->owner || pvt->pulse)
goto out;
@@ -1306,7 +1297,7 @@ static int zt_digit_end(struct ast_channel *chan, char digit, unsigned int durat
if (pvt->begindigit) {
x = -1;
ast_debug(1, "Ending VLDTMF digit '%c'\n", digit);
- res = ioctl(pvt->subs[SUB_REAL].zfd, ZT_SENDTONE, &x);
+ res = ioctl(pvt->subs[SUB_REAL].zfd, DAHDI_SENDTONE, &x);
pvt->dialing = 0;
pvt->begindigit = 0;
}
@@ -1343,13 +1334,13 @@ static struct {
int alarm;
char *name;
} alarms[] = {
- { ZT_ALARM_RED, "Red Alarm" },
- { ZT_ALARM_YELLOW, "Yellow Alarm" },
- { ZT_ALARM_BLUE, "Blue Alarm" },
- { ZT_ALARM_RECOVER, "Recovering" },
- { ZT_ALARM_LOOPBACK, "Loopback" },
- { ZT_ALARM_NOTOPEN, "Not Open" },
- { ZT_ALARM_NONE, "None" },
+ { DAHDI_ALARM_RED, "Red Alarm" },
+ { DAHDI_ALARM_YELLOW, "Yellow Alarm" },
+ { DAHDI_ALARM_BLUE, "Blue Alarm" },
+ { DAHDI_ALARM_RECOVER, "Recovering" },
+ { DAHDI_ALARM_LOOPBACK, "Loopback" },
+ { DAHDI_ALARM_NOTOPEN, "Not Open" },
+ { DAHDI_ALARM_NONE, "None" },
};
static char *alarm2str(int alarm)
@@ -1381,7 +1372,7 @@ static char *dialplan2str(int dialplan)
}
#endif
-static char *zap_sig2str(int sig)
+static char *dahdi_sig2str(int sig)
{
static char buf[256];
switch (sig) {
@@ -1447,35 +1438,35 @@ static char *zap_sig2str(int sig)
}
}
-#define sig2str zap_sig2str
+#define sig2str dahdi_sig2str
-static int conf_add(struct zt_pvt *p, struct zt_subchannel *c, int index, int slavechannel)
+static int conf_add(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index, int slavechannel)
{
/* If the conference already exists, and we're already in it
don't bother doing anything */
- ZT_CONFINFO zi;
+ DAHDI_CONFINFO zi;
memset(&zi, 0, sizeof(zi));
zi.chan = 0;
if (slavechannel > 0) {
/* If we have only one slave, do a digital mon */
- zi.confmode = ZT_CONF_DIGITALMON;
+ zi.confmode = DAHDI_CONF_DIGITALMON;
zi.confno = slavechannel;
} else {
if (!index) {
/* Real-side and pseudo-side both participate in conference */
- zi.confmode = ZT_CONF_REALANDPSEUDO | ZT_CONF_TALKER | ZT_CONF_LISTENER |
- ZT_CONF_PSEUDO_TALKER | ZT_CONF_PSEUDO_LISTENER;
+ zi.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER |
+ DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER;
} else
- zi.confmode = ZT_CONF_CONF | ZT_CONF_TALKER | ZT_CONF_LISTENER;
+ zi.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
zi.confno = p->confno;
}
if ((zi.confno == c->curconf.confno) && (zi.confmode == c->curconf.confmode))
return 0;
if (c->zfd < 0)
return 0;
- if (ioctl(c->zfd, ZT_SETCONF, &zi)) {
+ if (ioctl(c->zfd, DAHDI_SETCONF, &zi)) {
ast_log(LOG_WARNING, "Failed to add %d to conference %d/%d\n", c->zfd, zi.confmode, zi.confno);
return -1;
}
@@ -1487,20 +1478,20 @@ static int conf_add(struct zt_pvt *p, struct zt_subchannel *c, int index, int sl
return 0;
}
-static int isourconf(struct zt_pvt *p, struct zt_subchannel *c)
+static int isourconf(struct dahdi_pvt *p, struct dahdi_subchannel *c)
{
/* If they're listening to our channel, they're ours */
- if ((p->channel == c->curconf.confno) && (c->curconf.confmode == ZT_CONF_DIGITALMON))
+ if ((p->channel == c->curconf.confno) && (c->curconf.confmode == DAHDI_CONF_DIGITALMON))
return 1;
/* If they're a talker on our (allocated) conference, they're ours */
- if ((p->confno > 0) && (p->confno == c->curconf.confno) && (c->curconf.confmode & ZT_CONF_TALKER))
+ if ((p->confno > 0) && (p->confno == c->curconf.confno) && (c->curconf.confmode & DAHDI_CONF_TALKER))
return 1;
return 0;
}
-static int conf_del(struct zt_pvt *p, struct zt_subchannel *c, int index)
+static int conf_del(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index)
{
- ZT_CONFINFO zi;
+ DAHDI_CONFINFO zi;
if (/* Can't delete if there's no zfd */
(c->zfd < 0) ||
/* Don't delete from the conference if it's not our conference */
@@ -1511,7 +1502,7 @@ static int conf_del(struct zt_pvt *p, struct zt_subchannel *c, int index)
zi.chan = 0;
zi.confno = 0;
zi.confmode = 0;
- if (ioctl(c->zfd, ZT_SETCONF, &zi)) {
+ if (ioctl(c->zfd, DAHDI_SETCONF, &zi)) {
ast_log(LOG_WARNING, "Failed to drop %d from conference %d/%d\n", c->zfd, c->curconf.confmode, c->curconf.confno);
return -1;
}
@@ -1520,11 +1511,11 @@ static int conf_del(struct zt_pvt *p, struct zt_subchannel *c, int index)
return 0;
}
-static int isslavenative(struct zt_pvt *p, struct zt_pvt **out)
+static int isslavenative(struct dahdi_pvt *p, struct dahdi_pvt **out)
{
int x;
int useslavenative;
- struct zt_pvt *slave = NULL;
+ struct dahdi_pvt *slave = NULL;
/* Start out optimistic */
useslavenative = 1;
/* Update conference state in a stateless fashion */
@@ -1564,25 +1555,25 @@ static int isslavenative(struct zt_pvt *p, struct zt_pvt **out)
return useslavenative;
}
-static int reset_conf(struct zt_pvt *p)
+static int reset_conf(struct dahdi_pvt *p)
{
- ZT_CONFINFO zi;
+ DAHDI_CONFINFO zi;
memset(&zi, 0, sizeof(zi));
p->confno = -1;
memset(&p->subs[SUB_REAL].curconf, 0, sizeof(p->subs[SUB_REAL].curconf));
if (p->subs[SUB_REAL].zfd > -1) {
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_SETCONF, &zi))
+ if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_SETCONF, &zi))
ast_log(LOG_WARNING, "Failed to reset conferencing on channel %d!\n", p->channel);
}
return 0;
}
-static int update_conf(struct zt_pvt *p)
+static int update_conf(struct dahdi_pvt *p)
{
int needconf = 0;
int x;
int useslavenative;
- struct zt_pvt *slave = NULL;
+ struct dahdi_pvt *slave = NULL;
useslavenative = isslavenative(p, &slave);
/* Start with the obvious, general stuff */
@@ -1633,7 +1624,7 @@ static int update_conf(struct zt_pvt *p)
return 0;
}
-static void zt_enable_ec(struct zt_pvt *p)
+static void dahdi_enable_ec(struct dahdi_pvt *p)
{
int x;
int res;
@@ -1647,23 +1638,14 @@ static void zt_enable_ec(struct zt_pvt *p)
ast_debug(1, "Echo cancellation isn't required on digital connection\n");
return;
}
-#if defined(HAVE_ZAPTEL_ECHOCANPARAMS)
if (p->echocancel.head.tap_length) {
-#else
- if (p->echocancel) {
-#endif
if ((p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP) || (p->sig == SIG_PRI) || (p->sig == SIG_SS7)) {
x = 1;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &x);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_AUDIOMODE, &x);
if (res)
ast_log(LOG_WARNING, "Unable to enable audio mode on channel %d (%s)\n", p->channel, strerror(errno));
}
-#if defined(HAVE_ZAPTEL_ECHOCANPARAMS)
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOCANCEL_PARAMS, &p->echocancel);
-#else
- x = p->echocancel;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOCANCEL, &x);
-#endif
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_ECHOCANCEL_PARAMS, &p->echocancel);
if (res) {
ast_log(LOG_WARNING, "Unable to enable echo cancellation on channel %d (%s)\n", p->channel, strerror(errno));
} else {
@@ -1674,14 +1656,14 @@ static void zt_enable_ec(struct zt_pvt *p)
ast_debug(1, "No echo cancellation requested\n");
}
-static void zt_train_ec(struct zt_pvt *p)
+static void dahdi_train_ec(struct dahdi_pvt *p)
{
int x;
int res;
if (p && p->echocanon && p->echotraining) {
x = p->echotraining;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOTRAIN, &x);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_ECHOTRAIN, &x);
if (res)
ast_log(LOG_WARNING, "Unable to request echo training on channel %d\n", p->channel);
else
@@ -1691,20 +1673,14 @@ static void zt_train_ec(struct zt_pvt *p)
}
}
-static void zt_disable_ec(struct zt_pvt *p)
+static void dahdi_disable_ec(struct dahdi_pvt *p)
{
int res;
if (p->echocanon) {
-#if defined(HAVE_ZAPTEL_ECHOCANPARAMS)
- struct zt_echocanparams ecp = { .tap_length = 0 };
-
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOCANCEL_PARAMS, &ecp);
-#else
- int x = 0;
+ struct dahdi_echocanparams ecp = { .tap_length = 0 };
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOCANCEL, &x);
-#endif
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_ECHOCANCEL_PARAMS, &ecp);
if (res)
ast_log(LOG_WARNING, "Unable to disable echo cancellation on channel %d\n", p->channel);
@@ -1715,14 +1691,14 @@ static void zt_disable_ec(struct zt_pvt *p)
p->echocanon = 0;
}
-static void fill_txgain(struct zt_gains *g, float gain, int law)
+static void fill_txgain(struct dahdi_gains *g, float gain, int law)
{
int j;
int k;
float linear_gain = pow(10.0, gain / 20.0);
switch (law) {
- case ZT_LAW_ALAW:
+ case DAHDI_LAW_ALAW:
for (j = 0; j < (sizeof(g->txgain) / sizeof(g->txgain[0])); j++) {
if (gain) {
k = (int) (((float) AST_ALAW(j)) * linear_gain);
@@ -1734,7 +1710,7 @@ static void fill_txgain(struct zt_gains *g, float gain, int law)
}
}
break;
- case ZT_LAW_MULAW:
+ case DAHDI_LAW_MULAW:
for (j = 0; j < (sizeof(g->txgain) / sizeof(g->txgain[0])); j++) {
if (gain) {
k = (int) (((float) AST_MULAW(j)) * linear_gain);
@@ -1749,14 +1725,14 @@ static void fill_txgain(struct zt_gains *g, float gain, int law)
}
}
-static void fill_rxgain(struct zt_gains *g, float gain, int law)
+static void fill_rxgain(struct dahdi_gains *g, float gain, int law)
{
int j;
int k;
float linear_gain = pow(10.0, gain / 20.0);
switch (law) {
- case ZT_LAW_ALAW:
+ case DAHDI_LAW_ALAW:
for (j = 0; j < (sizeof(g->rxgain) / sizeof(g->rxgain[0])); j++) {
if (gain) {
k = (int) (((float) AST_ALAW(j)) * linear_gain);
@@ -1768,7 +1744,7 @@ static void fill_rxgain(struct zt_gains *g, float gain, int law)
}
}
break;
- case ZT_LAW_MULAW:
+ case DAHDI_LAW_MULAW:
for (j = 0; j < (sizeof(g->rxgain) / sizeof(g->rxgain[0])); j++) {
if (gain) {
k = (int) (((float) AST_MULAW(j)) * linear_gain);
@@ -1785,12 +1761,12 @@ static void fill_rxgain(struct zt_gains *g, float gain, int law)
static int set_actual_txgain(int fd, int chan, float gain, int law)
{
- struct zt_gains g;
+ struct dahdi_gains g;
int res;
memset(&g, 0, sizeof(g));
g.chan = chan;
- res = ioctl(fd, ZT_GETGAINS, &g);
+ res = ioctl(fd, DAHDI_GETGAINS, &g);
if (res) {
ast_debug(1, "Failed to read gains: %s\n", strerror(errno));
return res;
@@ -1798,17 +1774,17 @@ static int set_actual_txgain(int fd, int chan, float gain, int law)
fill_txgain(&g, gain, law);
- return ioctl(fd, ZT_SETGAINS, &g);
+ return ioctl(fd, DAHDI_SETGAINS, &g);
}
static int set_actual_rxgain(int fd, int chan, float gain, int law)
{
- struct zt_gains g;
+ struct dahdi_gains g;
int res;
memset(&g, 0, sizeof(g));
g.chan = chan;
- res = ioctl(fd, ZT_GETGAINS, &g);
+ res = ioctl(fd, DAHDI_GETGAINS, &g);
if (res) {
ast_debug(1, "Failed to read gains: %s\n", strerror(errno));
return res;
@@ -1816,7 +1792,7 @@ static int set_actual_rxgain(int fd, int chan, float gain, int law)
fill_rxgain(&g, gain, law);
- return ioctl(fd, ZT_SETGAINS, &g);
+ return ioctl(fd, DAHDI_SETGAINS, &g);
}
static int set_actual_gain(int fd, int chan, float rxgain, float txgain, int law)
@@ -1824,7 +1800,7 @@ static int set_actual_gain(int fd, int chan, float rxgain, float txgain, int law
return set_actual_txgain(fd, chan, txgain, law) | set_actual_rxgain(fd, chan, rxgain, law);
}
-static int bump_gains(struct zt_pvt *p)
+static int bump_gains(struct dahdi_pvt *p)
{
int res;
@@ -1838,7 +1814,7 @@ static int bump_gains(struct zt_pvt *p)
return 0;
}
-static int restore_gains(struct zt_pvt *p)
+static int restore_gains(struct dahdi_pvt *p)
{
int res;
@@ -1851,48 +1827,48 @@ static int restore_gains(struct zt_pvt *p)
return 0;
}
-static inline int zt_set_hook(int fd, int hs)
+static inline int dahdi_set_hook(int fd, int hs)
{
int x, res;
x = hs;
- res = ioctl(fd, ZT_HOOK, &x);
+ res = ioctl(fd, DAHDI_HOOK, &x);
if (res < 0) {
if (errno == EINPROGRESS)
return 0;
- ast_log(LOG_WARNING, "zt hook failed: %s\n", strerror(errno));
+ ast_log(LOG_WARNING, "DAHDI hook failed: %s\n", strerror(errno));
}
return res;
}
-static inline int zt_confmute(struct zt_pvt *p, int muted)
+static inline int dahdi_confmute(struct dahdi_pvt *p, int muted)
{
int x, y, res;
x = muted;
if ((p->sig == SIG_PRI) || (p->sig == SIG_SS7) || (p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP)) {
y = 1;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &y);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_AUDIOMODE, &y);
if (res)
ast_log(LOG_WARNING, "Unable to set audio mode on '%d'\n", p->channel);
}
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_CONFMUTE, &x);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_CONFMUTE, &x);
if (res < 0)
- ast_log(LOG_WARNING, "zt confmute(%d) failed on channel %d: %s\n", muted, p->channel, strerror(errno));
+ ast_log(LOG_WARNING, "DAHDI confmute(%d) failed on channel %d: %s\n", muted, p->channel, strerror(errno));
return res;
}
-static int save_conference(struct zt_pvt *p)
+static int save_conference(struct dahdi_pvt *p)
{
- struct zt_confinfo c;
+ struct dahdi_confinfo c;
int res;
if (p->saveconf.confmode) {
ast_log(LOG_WARNING, "Can't save conference -- already in use\n");
return -1;
}
p->saveconf.chan = 0;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_GETCONF, &p->saveconf);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_GETCONF, &p->saveconf);
if (res) {
ast_log(LOG_WARNING, "Unable to get conference info: %s\n", strerror(errno));
p->saveconf.confmode = 0;
@@ -1900,8 +1876,8 @@ static int save_conference(struct zt_pvt *p)
}
c.chan = 0;
c.confno = 0;
- c.confmode = ZT_CONF_NORMAL;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_SETCONF, &c);
+ c.confmode = DAHDI_CONF_NORMAL;
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_SETCONF, &c);
if (res) {
ast_log(LOG_WARNING, "Unable to set conference info: %s\n", strerror(errno));
return -1;
@@ -1960,11 +1936,11 @@ static void notify_message(char *mailbox_full, int thereornot)
}
}
-static int restore_conference(struct zt_pvt *p)
+static int restore_conference(struct dahdi_pvt *p)
{
int res;
if (p->saveconf.confmode) {
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_SETCONF, &p->saveconf);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_SETCONF, &p->saveconf);
p->saveconf.confmode = 0;
if (res) {
ast_log(LOG_WARNING, "Unable to restore conference info: %s\n", strerror(errno));
@@ -1975,9 +1951,9 @@ static int restore_conference(struct zt_pvt *p)
return 0;
}
-static int send_callerid(struct zt_pvt *p);
+static int send_callerid(struct dahdi_pvt *p);
-static int send_cwcidspill(struct zt_pvt *p)
+static int send_cwcidspill(struct dahdi_pvt *p)
{
p->callwaitcas = 0;
p->cidcwexpire = 0;
@@ -1992,7 +1968,7 @@ static int send_cwcidspill(struct zt_pvt *p)
return 0;
}
-static int has_voicemail(struct zt_pvt *p)
+static int has_voicemail(struct dahdi_pvt *p)
{
int new_msgs;
struct ast_event *event;
@@ -2018,14 +1994,14 @@ static int has_voicemail(struct zt_pvt *p)
return new_msgs;
}
-static int send_callerid(struct zt_pvt *p)
+static int send_callerid(struct dahdi_pvt *p)
{
/* Assumes spill in p->cidspill, p->cidlen in length and we're p->cidpos into it */
int res;
/* Take out of linear mode if necessary */
if (p->subs[SUB_REAL].linear) {
p->subs[SUB_REAL].linear = 0;
- zt_setlinear(p->subs[SUB_REAL].zfd, 0);
+ dahdi_setlinear(p->subs[SUB_REAL].zfd, 0);
}
while (p->cidpos < p->cidlen) {
res = write(p->subs[SUB_REAL].zfd, p->cidspill + p->cidpos, p->cidlen - p->cidpos);
@@ -2051,9 +2027,9 @@ static int send_callerid(struct zt_pvt *p)
return 0;
}
-static int zt_callwait(struct ast_channel *ast)
+static int dahdi_callwait(struct ast_channel *ast)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
p->callwaitingrepeat = CALLWAITING_REPEAT_SAMPLES;
if (p->cidspill) {
ast_log(LOG_WARNING, "Spill already exists?!?\n");
@@ -2091,9 +2067,9 @@ static unsigned char cid_pres2ss7screen(int cid_pres)
}
#endif
-static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
+static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
int x, res, index,mysig;
char *c, *n, *l;
#ifdef HAVE_PRI
@@ -2109,7 +2085,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
return 0;
}
if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
- ast_log(LOG_WARNING, "zt_call called on %s, neither down nor reserved\n", ast->name);
+ ast_log(LOG_WARNING, "dahdi_call called on %s, neither down nor reserved\n", ast->name);
ast_mutex_unlock(&p->lock);
return -1;
}
@@ -2121,8 +2097,8 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
ast_mutex_unlock(&p->lock);
return 0;
}
- x = ZT_FLUSH_READ | ZT_FLUSH_WRITE;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_FLUSH, &x);
+ x = DAHDI_FLUSH_READ | DAHDI_FLUSH_WRITE;
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_FLUSH, &x);
if (res)
ast_log(LOG_WARNING, "Unable to flush input on channel %d\n", p->channel);
p->outgoing = 1;
@@ -2157,11 +2133,11 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
}
/* Choose proper cadence */
if ((p->distinctivering > 0) && (p->distinctivering <= num_cadence)) {
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_SETCADENCE, &cadences[p->distinctivering - 1]))
+ if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_SETCADENCE, &cadences[p->distinctivering - 1]))
ast_log(LOG_WARNING, "Unable to set distinctive ring cadence %d on '%s'\n", p->distinctivering, ast->name);
p->cidrings = cidrings[p->distinctivering - 1];
} else {
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_SETCADENCE, NULL))
+ if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_SETCADENCE, NULL))
ast_log(LOG_WARNING, "Unable to reset default ring on '%s'\n", ast->name);
p->cidrings = p->sendcalleridafter;
}
@@ -2175,14 +2151,14 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
c = NULL;
}
if (c) {
- p->dop.op = ZT_DIAL_OP_REPLACE;
+ p->dop.op = DAHDI_DIAL_OP_REPLACE;
snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "Tw%s", c);
ast_debug(1, "FXO: setup deferred dialstring: %s\n", c);
} else {
p->dop.dialstr[0] = '\0';
}
- x = ZT_RING;
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x) && (errno != EINPROGRESS)) {
+ x = DAHDI_RING;
+ if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_HOOK, &x) && (errno != EINPROGRESS)) {
ast_log(LOG_WARNING, "Unable to ring phone: %s\n", strerror(errno));
ast_mutex_unlock(&p->lock);
return -1;
@@ -2200,12 +2176,12 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
else
p->callwait_name[0] = '\0';
/* Call waiting tone instead */
- if (zt_callwait(ast)) {
+ if (dahdi_callwait(ast)) {
ast_mutex_unlock(&p->lock);
return -1;
}
/* Make ring-back */
- if (tone_zone_play_tone(p->subs[SUB_CALLWAIT].zfd, ZT_TONE_RINGTONE))
+ if (tone_zone_play_tone(p->subs[SUB_CALLWAIT].zfd, DAHDI_TONE_RINGTONE))
ast_log(LOG_WARNING, "Unable to generate call-wait ring-back on channel %s\n", ast->name);
}
@@ -2220,7 +2196,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
else
p->lastcid_name[0] = '\0';
ast_setstate(ast, AST_STATE_RINGING);
- index = zt_get_index(ast, p, 0);
+ index = dahdi_get_index(ast, p, 0);
if (index > -1) {
p->subs[index].needringing = 1;
}
@@ -2257,8 +2233,8 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
/* Start the trunk, if not GR-303 */
if (!p->pri) {
#endif
- x = ZT_START;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ x = DAHDI_START;
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_HOOK, &x);
if (res < 0) {
if (errno != EINPROGRESS) {
ast_log(LOG_WARNING, "Unable to start channel: %s\n", strerror(errno));
@@ -2270,7 +2246,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
}
#endif
ast_debug(1, "Dialing '%s'\n", c);
- p->dop.op = ZT_DIAL_OP_REPLACE;
+ p->dop.op = DAHDI_DIAL_OP_REPLACE;
c += p->stripmsd;
@@ -2337,9 +2313,9 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
} else
p->echobreak = 0;
if (!res) {
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop)) {
- x = ZT_ONHOOK;
- ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_DIAL, &p->dop)) {
+ x = DAHDI_ONHOOK;
+ ioctl(p->subs[SUB_REAL].zfd, DAHDI_HOOK, &x);
ast_log(LOG_WARNING, "Dialing failed on channel %d: %s\n", p->channel, strerror(errno));
ast_mutex_unlock(&p->lock);
return -1;
@@ -2536,7 +2512,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
return -1;
}
if (mysig != SIG_FXSKS) {
- p->dop.op = ZT_DIAL_OP_REPLACE;
+ p->dop.op = DAHDI_DIAL_OP_REPLACE;
s = strchr(c + p->stripmsd, 'w');
if (s) {
if (strlen(s) > 1)
@@ -2561,11 +2537,8 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
}
if (!(sr = pri_sr_new())) {
ast_log(LOG_WARNING, "Failed to allocate setup request channel %d\n", p->channel);
- pri_destroycall(p->pri->pri, p->call);
- p->call = NULL;
pri_rel(p->pri);
ast_mutex_unlock(&p->lock);
- return -1;
}
if (p->bearer || (mysig == SIG_FXSKS)) {
if (p->bearer) {
@@ -2591,7 +2564,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
pri_sr_set_channel(sr, p->bearer ? PVT_TO_CHANNEL(p->bearer) : PVT_TO_CHANNEL(p), exclusive, 1);
pri_sr_set_bearer(sr, p->digital ? PRI_TRANS_CAP_DIGITAL : ast->transfercapability,
(p->digital ? -1 :
- ((p->law == ZT_LAW_ALAW) ? PRI_LAYER_1_ALAW : PRI_LAYER_1_ULAW)));
+ ((p->law == DAHDI_LAW_ALAW) ? PRI_LAYER_1_ALAW : PRI_LAYER_1_ULAW)));
if (p->pri->facilityenable)
pri_facility_enable(p->pri->pri);
@@ -2776,9 +2749,9 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
return 0;
}
-static void destroy_zt_pvt(struct zt_pvt **pvt)
+static void destroy_dahdi_pvt(struct dahdi_pvt **pvt)
{
- struct zt_pvt *p = *pvt;
+ struct dahdi_pvt *p = *pvt;
/* Remove channel from the list */
if (p->prev)
p->prev->next = p->next;
@@ -2795,7 +2768,7 @@ static void destroy_zt_pvt(struct zt_pvt **pvt)
*pvt = NULL;
}
-static int destroy_channel(struct zt_pvt *prev, struct zt_pvt *cur, int now)
+static int destroy_channel(struct dahdi_pvt *prev, struct dahdi_pvt *cur, int now)
{
int owned = 0;
int i = 0;
@@ -2825,9 +2798,9 @@ static int destroy_channel(struct zt_pvt *prev, struct zt_pvt *cur, int now)
ifend = NULL;
}
if (cur->subs[SUB_REAL].zfd > -1) {
- zt_close(cur->subs[SUB_REAL].zfd);
+ dahdi_close(cur->subs[SUB_REAL].zfd);
}
- destroy_zt_pvt(&cur);
+ destroy_dahdi_pvt(&cur);
}
} else {
if (prev) {
@@ -2844,26 +2817,26 @@ static int destroy_channel(struct zt_pvt *prev, struct zt_pvt *cur, int now)
ifend = NULL;
}
if (cur->subs[SUB_REAL].zfd > -1) {
- zt_close(cur->subs[SUB_REAL].zfd);
+ dahdi_close(cur->subs[SUB_REAL].zfd);
}
- destroy_zt_pvt(&cur);
+ destroy_dahdi_pvt(&cur);
}
return 0;
}
#ifdef HAVE_PRI
-static char *zap_send_keypad_facility_app = "ZapSendKeypadFacility";
+static char *dahdi_send_keypad_facility_app = "DAHDISendKeypadFacility";
-static char *zap_send_keypad_facility_synopsis = "Send digits out of band over a PRI";
+static char *dahdi_send_keypad_facility_synopsis = "Send digits out of band over a PRI";
-static char *zap_send_keypad_facility_descrip =
-" ZapSendKeypadFacility(): This application will send the given string of digits in a Keypad Facility\n"
+static char *dahdi_send_keypad_facility_descrip =
+" DAHDISendKeypadFacility(): This application will send the given string of digits in a Keypad Facility\n"
" IE over the current channel.\n";
-static int zap_send_keypad_facility_exec(struct ast_channel *chan, void *data)
+static int dahdi_send_keypad_facility_exec(struct ast_channel *chan, void *data)
{
/* Data will be our digit string */
- struct zt_pvt *p;
+ struct dahdi_pvt *p;
char *digits = (char *) data;
if (ast_strlen_zero(digits)) {
@@ -2871,7 +2844,7 @@ static int zap_send_keypad_facility_exec(struct ast_channel *chan, void *data)
return -1;
}
- p = (struct zt_pvt *)chan->tech_pvt;
+ p = (struct dahdi_pvt *)chan->tech_pvt;
if (!p) {
ast_debug(1, "Unable to find technology private\n");
@@ -2900,7 +2873,7 @@ static int zap_send_keypad_facility_exec(struct ast_channel *chan, void *data)
return 0;
}
-static int pri_is_up(struct zt_pri *pri)
+static int pri_is_up(struct dahdi_pri *pri)
{
int x;
for (x = 0; x < NUM_DCHANS; x++) {
@@ -2910,7 +2883,7 @@ static int pri_is_up(struct zt_pri *pri)
return 0;
}
-static int pri_assign_bearer(struct zt_pvt *crv, struct zt_pri *pri, struct zt_pvt *bearer)
+static int pri_assign_bearer(struct dahdi_pvt *crv, struct dahdi_pri *pri, struct dahdi_pvt *bearer)
{
bearer->owner = &inuse;
bearer->realcall = crv;
@@ -2940,7 +2913,7 @@ static char *pri_order(int level)
}
/* Returns fd of the active dchan */
-static int pri_active_dchan_fd(struct zt_pri *pri)
+static int pri_active_dchan_fd(struct dahdi_pri *pri)
{
int x = -1;
@@ -2952,7 +2925,7 @@ static int pri_active_dchan_fd(struct zt_pri *pri)
return pri->fds[x];
}
-static int pri_find_dchan(struct zt_pri *pri)
+static int pri_find_dchan(struct dahdi_pri *pri)
{
int oldslot = -1;
struct pri *old;
@@ -2979,17 +2952,17 @@ static int pri_find_dchan(struct zt_pri *pri)
}
#endif
-static int zt_hangup(struct ast_channel *ast)
+static int dahdi_hangup(struct ast_channel *ast)
{
int res;
int index,x, law;
- /*static int restore_gains(struct zt_pvt *p);*/
- struct zt_pvt *p = ast->tech_pvt;
- struct zt_pvt *tmp = NULL;
- struct zt_pvt *prev = NULL;
- ZT_PARAMS par;
+ /*static int restore_gains(struct dahdi_pvt *p);*/
+ struct dahdi_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *tmp = NULL;
+ struct dahdi_pvt *prev = NULL;
+ DAHDI_PARAMS par;
- ast_debug(1, "zt_hangup(%s)\n", ast->name);
+ ast_debug(1, "dahdi_hangup(%s)\n", ast->name);
if (!ast->tech_pvt) {
ast_log(LOG_WARNING, "Asked to hangup channel not connected\n");
return 0;
@@ -2997,7 +2970,7 @@ static int zt_hangup(struct ast_channel *ast)
ast_mutex_lock(&p->lock);
- index = zt_get_index(ast, p, 1);
+ index = dahdi_get_index(ast, p, 1);
if ((p->sig == SIG_PRI) || (p->sig == SIG_SS7) || (p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP)) {
x = 1;
@@ -3005,7 +2978,7 @@ static int zt_hangup(struct ast_channel *ast)
}
x = 0;
- zt_confmute(p, 0);
+ dahdi_confmute(p, 0);
p->muting = 0;
restore_gains(p);
if (p->origcid_num) {
@@ -3038,7 +3011,7 @@ static int zt_hangup(struct ast_channel *ast)
p->subs[index].linear = 0;
p->subs[index].needcallerid = 0;
p->polarity = POLARITY_IDLE;
- zt_setlinear(p->subs[index].zfd, 0);
+ dahdi_setlinear(p->subs[index].zfd, 0);
if (index == SUB_REAL) {
if ((p->subs[SUB_CALLWAIT].zfd > -1) && (p->subs[SUB_THREEWAY].zfd > -1)) {
ast_debug(1, "Normal call hung up with both three way call and a call waiting call in place?\n");
@@ -3150,8 +3123,8 @@ static int zt_hangup(struct ast_channel *ast)
p->dsp = NULL;
}
- law = ZT_LAW_DEFAULT;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_SETLAW, &law);
+ law = DAHDI_LAW_DEFAULT;
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_SETLAW, &law);
if (res < 0)
ast_log(LOG_WARNING, "Unable to set law on channel %d to default\n", p->channel);
/* Perform low level hangup if no owner left */
@@ -3233,7 +3206,7 @@ static int zt_hangup(struct ast_channel *ast)
}
#endif
if (p->sig && ((p->sig != SIG_PRI) && (p->sig != SIG_SS7) && (p->sig != SIG_BRI) && (p->sig != SIG_BRI_PTMP)))
- res = zt_set_hook(p->subs[SUB_REAL].zfd, ZT_ONHOOK);
+ res = dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_ONHOOK);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to hangup line %s\n", ast->name);
}
@@ -3241,14 +3214,14 @@ static int zt_hangup(struct ast_channel *ast)
case SIG_FXOGS:
case SIG_FXOLS:
case SIG_FXOKS:
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &par);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &par);
if (!res) {
#if 0
ast_debug(1, "Hanging up channel %d, offhook = %d\n", p->channel, par.rxisoffhook);
#endif
/* If they're off hook, try playing congestion */
if ((par.rxisoffhook) && (!(p->radio || (p->oprmode < 0))))
- tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
+ tone_zone_play_tone(p->subs[SUB_REAL].zfd, DAHDI_TONE_CONGESTION);
else
tone_zone_play_tone(p->subs[SUB_REAL].zfd, -1);
}
@@ -3269,7 +3242,7 @@ static int zt_hangup(struct ast_channel *ast)
if (p->cidspill)
ast_free(p->cidspill);
if (p->sig)
- zt_disable_ec(p);
+ dahdi_disable_ec(p);
x = 0;
ast_channel_setoption(ast,AST_OPTION_TONE_VERIFY,&x,sizeof(char),0);
ast_channel_setoption(ast,AST_OPTION_TDD,&x,sizeof(char),0);
@@ -3330,15 +3303,15 @@ static int zt_hangup(struct ast_channel *ast)
return 0;
}
-static int zt_answer(struct ast_channel *ast)
+static int dahdi_answer(struct ast_channel *ast)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
int res = 0;
int index;
int oldstate = ast->_state;
ast_setstate(ast, AST_STATE_UP);
ast_mutex_lock(&p->lock);
- index = zt_get_index(ast, p, 0);
+ index = dahdi_get_index(ast, p, 0);
if (index < 0)
index = SUB_REAL;
/* nothing to do if a radio channel */
@@ -3375,7 +3348,7 @@ static int zt_answer(struct ast_channel *ast)
if (p->hanguponpolarityswitch) {
p->polaritydelaytv = ast_tvnow();
}
- res = zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+ res = dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_OFFHOOK);
tone_zone_play_tone(p->subs[index].zfd, -1);
p->dialing = 0;
if ((index == SUB_REAL) && p->subs[SUB_THREEWAY].inthreeway) {
@@ -3386,9 +3359,9 @@ static int zt_answer(struct ast_channel *ast)
p->owner = p->subs[SUB_REAL].owner;
}
}
- if (p->sig & __ZT_SIG_FXS) {
- zt_enable_ec(p);
- zt_train_ec(p);
+ if (p->sig & __DAHDI_SIG_FXS) {
+ dahdi_enable_ec(p);
+ dahdi_train_ec(p);
}
break;
#ifdef HAVE_PRI
@@ -3429,13 +3402,13 @@ static int zt_answer(struct ast_channel *ast)
return res;
}
-static int zt_setoption(struct ast_channel *chan, int option, void *data, int datalen)
+static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int datalen)
{
char *cp;
signed char *scp;
int x;
int index;
- struct zt_pvt *p = chan->tech_pvt, *pp;
+ struct dahdi_pvt *p = chan->tech_pvt, *pp;
struct oprmode *oprmode;
@@ -3448,7 +3421,7 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
switch (option) {
case AST_OPTION_TXGAIN:
scp = (signed char *) data;
- index = zt_get_index(chan, p, 0);
+ index = dahdi_get_index(chan, p, 0);
if (index < 0) {
ast_log(LOG_WARNING, "No index in TXGAIN?\n");
return -1;
@@ -3457,7 +3430,7 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
return set_actual_txgain(p->subs[index].zfd, 0, p->txgain + (float) *scp, p->law);
case AST_OPTION_RXGAIN:
scp = (signed char *) data;
- index = zt_get_index(chan, p, 0);
+ index = dahdi_get_index(chan, p, 0);
if (index < 0) {
ast_log(LOG_WARNING, "No index in RXGAIN?\n");
return -1;
@@ -3496,7 +3469,7 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
}
ast_debug(1, "Set option TDD MODE, value: %s(%d) on %s\n",
(*cp == 2) ? "MATE" : "ON", (int) *cp, chan->name);
- zt_disable_ec(p);
+ dahdi_disable_ec(p);
/* otherwise, turn it on */
if (!p->didtdd) { /* if havent done it yet */
unsigned char mybuf[41000], *buf;
@@ -3507,7 +3480,7 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
memset(buf, 0x7f, sizeof(mybuf)); /* set to silence */
ast_tdd_gen_ecdisa(buf + 16000, 16000); /* put in tone */
len = 40000;
- index = zt_get_index(chan, p, 0);
+ index = dahdi_get_index(chan, p, 0);
if (index < 0) {
ast_log(LOG_WARNING, "No index in TDD?\n");
return -1;
@@ -3569,12 +3542,12 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
if (!*cp) {
ast_debug(1, "Set option AUDIO MODE, value: OFF(0) on %s\n", chan->name);
x = 0;
- zt_disable_ec(p);
+ dahdi_disable_ec(p);
} else {
ast_debug(1, "Set option AUDIO MODE, value: ON(1) on %s\n", chan->name);
x = 1;
}
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &x) == -1)
+ if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_AUDIOMODE, &x) == -1)
ast_log(LOG_WARNING, "Unable to set audio mode on channel %d to %d\n", p->channel, x);
break;
case AST_OPTION_OPRMODE: /* Operator services mode */
@@ -3597,10 +3570,10 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
cp = (char *) data;
if (*cp) {
ast_debug(1, "Enabling echo cancelation on %s\n", chan->name);
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
} else {
ast_debug(1, "Disabling echo cancelation on %s\n", chan->name);
- zt_disable_ec(p);
+ dahdi_disable_ec(p);
}
break;
}
@@ -3609,9 +3582,9 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
return 0;
}
-static int zt_func_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
+static int dahdi_func_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
{
- struct zt_pvt *p = chan->tech_pvt;
+ struct dahdi_pvt *p = chan->tech_pvt;
if (!strcasecmp(data, "rxgain")) {
ast_mutex_lock(&p->lock);
@@ -3628,7 +3601,7 @@ static int zt_func_read(struct ast_channel *chan, const char *function, char *da
}
-static void zt_unlink(struct zt_pvt *slave, struct zt_pvt *master, int needlock)
+static void dahdi_unlink(struct dahdi_pvt *slave, struct dahdi_pvt *master, int needlock)
{
/* Unlink a specific slave or all slaves/masters from a given master */
int x;
@@ -3684,7 +3657,7 @@ static void zt_unlink(struct zt_pvt *slave, struct zt_pvt *master, int needlock)
}
}
-static void zt_link(struct zt_pvt *slave, struct zt_pvt *master) {
+static void dahdi_link(struct dahdi_pvt *slave, struct dahdi_pvt *master) {
int x;
if (!slave || !master) {
ast_log(LOG_WARNING, "Tried to link to/from NULL??\n");
@@ -3707,17 +3680,17 @@ static void zt_link(struct zt_pvt *slave, struct zt_pvt *master) {
ast_debug(1, "Making %d slave to master %d at %d\n", slave->channel, master->channel, x);
}
-static void disable_dtmf_detect(struct zt_pvt *p)
+static void disable_dtmf_detect(struct dahdi_pvt *p)
{
-#ifdef ZT_TONEDETECT
+#ifdef DAHDI_TONEDETECT
int val;
#endif
p->ignoredtmf = 1;
-#ifdef ZT_TONEDETECT
+#ifdef DAHDI_TONEDETECT
val = 0;
- ioctl(p->subs[SUB_REAL].zfd, ZT_TONEDETECT, &val);
+ ioctl(p->subs[SUB_REAL].zfd, DAHDI_TONEDETECT, &val);
#endif
if (!p->hardwaredtmf && p->dsp) {
p->dsp_features &= ~DSP_FEATURE_DIGIT_DETECT;
@@ -3725,9 +3698,9 @@ static void disable_dtmf_detect(struct zt_pvt *p)
}
}
-static void enable_dtmf_detect(struct zt_pvt *p)
+static void enable_dtmf_detect(struct dahdi_pvt *p)
{
-#ifdef ZT_TONEDETECT
+#ifdef DAHDI_TONEDETECT
int val;
#endif
@@ -3736,9 +3709,9 @@ static void enable_dtmf_detect(struct zt_pvt *p)
p->ignoredtmf = 0;
-#ifdef ZT_TONEDETECT
- val = ZT_TONEDETECT_ON | ZT_TONEDETECT_MUTE;
- ioctl(p->subs[SUB_REAL].zfd, ZT_TONEDETECT, &val);
+#ifdef DAHDI_TONEDETECT
+ val = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE;
+ ioctl(p->subs[SUB_REAL].zfd, DAHDI_TONEDETECT, &val);
#endif
if (!p->hardwaredtmf && p->dsp) {
p->dsp_features |= DSP_FEATURE_DIGIT_DETECT;
@@ -3746,11 +3719,11 @@ static void enable_dtmf_detect(struct zt_pvt *p)
}
}
-static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
+static enum ast_bridge_result dahdi_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
{
struct ast_channel *who;
- struct zt_pvt *p0, *p1, *op0, *op1;
- struct zt_pvt *master = NULL, *slave = NULL;
+ struct dahdi_pvt *p0, *p1, *op0, *op1;
+ struct dahdi_pvt *master = NULL, *slave = NULL;
struct ast_frame *f;
int inconf = 0;
int nothingok = 1;
@@ -3790,8 +3763,8 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
return AST_BRIDGE_FAILED_NOWARN;
}
- oi0 = zt_get_index(c0, p0, 0);
- oi1 = zt_get_index(c1, p1, 0);
+ oi0 = dahdi_get_index(c0, p0, 0);
+ oi1 = dahdi_get_index(c1, p1, 0);
if ((oi0 < 0) || (oi1 < 0)) {
ast_channel_unlock(c0);
ast_channel_unlock(c1);
@@ -3883,7 +3856,7 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
p1->subs[SUB_REAL].inthreeway &&
(p1->subs[SUB_REAL].owner->_state == AST_STATE_RINGING)) {
ast_debug(1, "Playing ringback on %s since %s is in a ringing three-way\n", c0->name, c1->name);
- tone_zone_play_tone(p0->subs[oi0].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p0->subs[oi0].zfd, DAHDI_TONE_RINGTONE);
os1 = p1->subs[SUB_REAL].owner->_state;
} else {
ast_debug(1, "Stopping tones on %d/%d talking to %d/%d\n", p0->channel, oi0, p1->channel, oi1);
@@ -3895,7 +3868,7 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
p0->subs[SUB_REAL].inthreeway &&
(p0->subs[SUB_REAL].owner->_state == AST_STATE_RINGING)) {
ast_debug(1, "Playing ringback on %s since %s is in a ringing three-way\n", c1->name, c0->name);
- tone_zone_play_tone(p1->subs[oi1].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p1->subs[oi1].zfd, DAHDI_TONE_RINGTONE);
os0 = p0->subs[SUB_REAL].owner->_state;
} else {
ast_debug(1, "Stopping tones on %d/%d talking to %d/%d\n", p1->channel, oi1, p0->channel, oi0);
@@ -3904,11 +3877,11 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
if ((oi0 == SUB_REAL) && (oi1 == SUB_REAL)) {
if (!p0->echocanbridged || !p1->echocanbridged) {
/* Disable echo cancellation if appropriate */
- zt_disable_ec(p0);
- zt_disable_ec(p1);
+ dahdi_disable_ec(p0);
+ dahdi_disable_ec(p1);
}
}
- zt_link(slave, master);
+ dahdi_link(slave, master);
master->inconference = inconf;
} else if (!nothingok)
ast_log(LOG_WARNING, "Can't link %d/%s with %d/%s\n", p0->channel, subnames[oi0], p1->channel, subnames[oi1]);
@@ -3926,8 +3899,8 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
/* Native bridge failed */
if ((!master || !slave) && !nothingok) {
- zt_enable_ec(p0);
- zt_enable_ec(p1);
+ dahdi_enable_ec(p0);
+ dahdi_enable_ec(p1);
return AST_BRIDGE_FAILED;
}
@@ -3957,9 +3930,9 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
p1 = c1->tech_pvt;
if (op0 == p0)
- i0 = zt_get_index(c0, p0, 1);
+ i0 = dahdi_get_index(c0, p0, 1);
if (op1 == p1)
- i1 = zt_get_index(c1, p1, 1);
+ i1 = dahdi_get_index(c1, p1, 1);
ast_channel_unlock(c0);
ast_channel_unlock(c1);
@@ -4026,10 +3999,10 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
return_from_bridge:
if (op0 == p0)
- zt_enable_ec(p0);
+ dahdi_enable_ec(p0);
if (op1 == p1)
- zt_enable_ec(p1);
+ dahdi_enable_ec(p1);
if (!(flags & AST_BRIDGE_DTMF_CHANNEL_0) && (oi0 == SUB_REAL))
enable_dtmf_detect(op0);
@@ -4037,14 +4010,14 @@ return_from_bridge:
if (!(flags & AST_BRIDGE_DTMF_CHANNEL_1) && (oi1 == SUB_REAL))
enable_dtmf_detect(op1);
- zt_unlink(slave, master, 1);
+ dahdi_unlink(slave, master, 1);
return res;
}
-static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
+static int dahdi_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
- struct zt_pvt *p = newchan->tech_pvt;
+ struct dahdi_pvt *p = newchan->tech_pvt;
int x;
ast_mutex_lock(&p->lock);
ast_debug(1, "New owner for channel %d is %s\n", p->channel, newchan->name);
@@ -4054,27 +4027,27 @@ static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
for (x = 0; x < 3; x++)
if (p->subs[x].owner == oldchan) {
if (!x)
- zt_unlink(NULL, p, 0);
+ dahdi_unlink(NULL, p, 0);
p->subs[x].owner = newchan;
}
if (newchan->_state == AST_STATE_RINGING)
- zt_indicate(newchan, AST_CONTROL_RINGING, NULL, 0);
+ dahdi_indicate(newchan, AST_CONTROL_RINGING, NULL, 0);
update_conf(p);
ast_mutex_unlock(&p->lock);
return 0;
}
-static int zt_ring_phone(struct zt_pvt *p)
+static int dahdi_ring_phone(struct dahdi_pvt *p)
{
int x;
int res;
/* Make sure our transmit state is on hook */
x = 0;
- x = ZT_ONHOOK;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ x = DAHDI_ONHOOK;
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_HOOK, &x);
do {
- x = ZT_RING;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ x = DAHDI_RING;
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_HOOK, &x);
if (res) {
switch (errno) {
case EBUSY:
@@ -4096,9 +4069,9 @@ static int zt_ring_phone(struct zt_pvt *p)
static void *ss_thread(void *data);
-static struct ast_channel *zt_new(struct zt_pvt *, int, int, int, int, int);
+static struct ast_channel *dahdi_new(struct dahdi_pvt *, int, int, int, int, int);
-static int attempt_transfer(struct zt_pvt *p)
+static int attempt_transfer(struct dahdi_pvt *p)
{
/* In order to transfer, we need at least one of the channels to
actually be in a call bridge. We can't conference two applications
@@ -4112,7 +4085,7 @@ static int attempt_transfer(struct zt_pvt *p)
ast_indicate(ast_bridged_channel(p->subs[SUB_REAL].owner), AST_CONTROL_RINGING);
}
if (p->subs[SUB_THREEWAY].owner->_state == AST_STATE_RING) {
- tone_zone_play_tone(p->subs[SUB_THREEWAY].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p->subs[SUB_THREEWAY].zfd, DAHDI_TONE_RINGTONE);
}
if (p->subs[SUB_REAL].owner->cdr) {
/* Move CDR from second channel to current one */
@@ -4140,7 +4113,7 @@ static int attempt_transfer(struct zt_pvt *p)
ast_indicate(ast_bridged_channel(p->subs[SUB_THREEWAY].owner), AST_CONTROL_RINGING);
}
if (p->subs[SUB_REAL].owner->_state == AST_STATE_RING) {
- tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p->subs[SUB_REAL].zfd, DAHDI_TONE_RINGTONE);
}
if (p->subs[SUB_THREEWAY].owner->cdr) {
/* Move CDR from second channel to current one */
@@ -4174,14 +4147,14 @@ static int attempt_transfer(struct zt_pvt *p)
return 0;
}
-static int check_for_conference(struct zt_pvt *p)
+static int check_for_conference(struct dahdi_pvt *p)
{
- ZT_CONFINFO ci;
+ DAHDI_CONFINFO ci;
/* Fine if we already have a master, etc */
if (p->master || (p->confno > -1))
return 0;
memset(&ci, 0, sizeof(ci));
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_GETCONF, &ci)) {
+ if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_GETCONF, &ci)) {
ast_log(LOG_WARNING, "Failed to get conference info on channel %d\n", p->channel);
return 0;
}
@@ -4200,35 +4173,31 @@ static int check_for_conference(struct zt_pvt *p)
* \returns the alarms on the span to which the channel belongs, or alarms on
* the channel if no span alarms.
*/
-static int get_alarms(struct zt_pvt *p)
+static int get_alarms(struct dahdi_pvt *p)
{
int res;
- ZT_SPANINFO zi;
-#if defined(HAVE_ZAPTEL_CHANALARMS)
- struct zt_params params;
-#endif
+ DAHDI_SPANINFO zi;
+ struct dahdi_params params;
memset(&zi, 0, sizeof(zi));
zi.spanno = p->span;
- if ((res = ioctl(p->subs[SUB_REAL].zfd, ZT_SPANSTAT, &zi)) >= 0) {
- if (zi.alarms != ZT_ALARM_NONE)
+ if ((res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_SPANSTAT, &zi)) >= 0) {
+ if (zi.alarms != DAHDI_ALARM_NONE)
return zi.alarms;
}
-#if defined(HAVE_ZAPTEL_CHANALARMS)
/* No alarms on the span. Check for channel alarms. */
- if ((res = ioctl(p->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &params)) >= 0)
+ if ((res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &params)) >= 0)
return params.chan_alarms;
-#endif
ast_log(LOG_WARNING, "Unable to determine alarm on channel %d\n", p->channel);
- return ZT_ALARM_NONE;
+ return DAHDI_ALARM_NONE;
}
-static void zt_handle_dtmfup(struct ast_channel *ast, int index, struct ast_frame **dest)
+static void dahdi_handle_dtmfup(struct ast_channel *ast, int index, struct ast_frame **dest)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
struct ast_frame *f = *dest;
ast_debug(1, "DTMF digit: %c on %s\n", f->subclass, ast->name);
@@ -4272,24 +4241,24 @@ static void zt_handle_dtmfup(struct ast_channel *ast, int index, struct ast_fram
ast_debug(1, "Already in a fax extension, not redirecting\n");
} else
ast_debug(1, "Fax already handled\n");
- zt_confmute(p, 0);
+ dahdi_confmute(p, 0);
p->subs[index].f.frametype = AST_FRAME_NULL;
p->subs[index].f.subclass = 0;
*dest = &p->subs[index].f;
}
}
-static struct ast_frame *zt_handle_event(struct ast_channel *ast)
+static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
{
int res, x;
int index, mysig;
char *c;
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
pthread_t threadid;
struct ast_channel *chan;
struct ast_frame *f;
- index = zt_get_index(ast, p, 0);
+ index = dahdi_get_index(ast, p, 0);
mysig = p->sig;
if (p->outsigmod > -1)
mysig = p->outsigmod;
@@ -4299,7 +4268,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->subs[index].f.samples = 0;
p->subs[index].f.mallocd = 0;
p->subs[index].f.offset = 0;
- p->subs[index].f.src = "zt_handle_event";
+ p->subs[index].f.src = "dahdi_handle_event";
p->subs[index].f.data.ptr = NULL;
f = &p->subs[index].f;
@@ -4309,15 +4278,15 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
res = p->fake_event;
p->fake_event = 0;
} else
- res = zt_get_event(p->subs[index].zfd);
+ res = dahdi_get_event(p->subs[index].zfd);
ast_debug(1, "Got event %s(%d) on channel %d (index %d)\n", event2str(res), res, p->channel, index);
- if (res & (ZT_EVENT_PULSEDIGIT | ZT_EVENT_DTMFUP)) {
- p->pulsedial = (res & ZT_EVENT_PULSEDIGIT) ? 1 : 0;
+ if (res & (DAHDI_EVENT_PULSEDIGIT | DAHDI_EVENT_DTMFUP)) {
+ p->pulsedial = (res & DAHDI_EVENT_PULSEDIGIT) ? 1 : 0;
ast_debug(1, "Detected %sdigit '%c'\n", p->pulsedial ? "pulse ": "", res & 0xff);
#ifdef HAVE_PRI
- if (!p->proceeding && ((p->sig == SIG_PRI) || (p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP)) && p->pri && (p->pri->overlapdial & ZAP_OVERLAPDIAL_INCOMING)) {
+ if (!p->proceeding && ((p->sig == SIG_PRI) || (p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP)) && p->pri && (p->pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING)) {
/* absorb event */
} else {
#endif
@@ -4326,47 +4295,47 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
#ifdef HAVE_PRI
}
#endif
- zt_handle_dtmfup(ast, index, &f);
+ dahdi_handle_dtmfup(ast, index, &f);
return f;
}
- if (res & ZT_EVENT_DTMFDOWN) {
+ if (res & DAHDI_EVENT_DTMFDOWN) {
ast_debug(1, "DTMF Down '%c'\n", res & 0xff);
/* Mute conference */
- zt_confmute(p, 1);
+ dahdi_confmute(p, 1);
p->subs[index].f.frametype = AST_FRAME_DTMF_BEGIN;
p->subs[index].f.subclass = res & 0xff;
return &p->subs[index].f;
}
switch (res) {
-#ifdef ZT_EVENT_EC_DISABLED
- case ZT_EVENT_EC_DISABLED:
+#ifdef DAHDI_EVENT_EC_DISABLED
+ case DAHDI_EVENT_EC_DISABLED:
ast_verb(3, "Channel %d echo canceler disabled due to CED detection\n", p->channel);
p->echocanon = 0;
break;
#endif
- case ZT_EVENT_BITSCHANGED:
+ case DAHDI_EVENT_BITSCHANGED:
ast_log(LOG_WARNING, "Recieved bits changed on %s signalling?\n", sig2str(p->sig));
- case ZT_EVENT_PULSE_START:
+ case DAHDI_EVENT_PULSE_START:
/* Stop tone if there's a pulse start and the PBX isn't started */
if (!ast->pbx)
tone_zone_play_tone(p->subs[index].zfd, -1);
break;
- case ZT_EVENT_DIALCOMPLETE:
+ case DAHDI_EVENT_DIALCOMPLETE:
if (p->inalarm) break;
if ((p->radio || (p->oprmode < 0))) break;
- if (ioctl(p->subs[index].zfd,ZT_DIALING,&x) == -1) {
- ast_debug(1, "ZT_DIALING ioctl failed on %s\n",ast->name);
+ if (ioctl(p->subs[index].zfd,DAHDI_DIALING,&x) == -1) {
+ ast_debug(1, "DAHDI_DIALING ioctl failed on %s\n",ast->name);
return NULL;
}
if (!x) { /* if not still dialing in driver */
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
if (p->echobreak) {
- zt_train_ec(p);
+ dahdi_train_ec(p);
ast_copy_string(p->dop.dialstr, p->echorest, sizeof(p->dop.dialstr));
- p->dop.op = ZT_DIAL_OP_REPLACE;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop);
+ p->dop.op = DAHDI_DIAL_OP_REPLACE;
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_DIAL, &p->dop);
p->echobreak = 0;
} else {
p->dialing = 0;
@@ -4401,7 +4370,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
}
}
break;
- case ZT_EVENT_ALARM:
+ case DAHDI_EVENT_ALARM:
#ifdef HAVE_PRI
if ((p->sig == SIG_PRI) || (p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP)) {
if (!p->pri || !p->pri->pri || (pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0)) {
@@ -4444,7 +4413,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
if (p->sig == SIG_SS7)
break;
#endif
- case ZT_EVENT_ONHOOK:
+ case DAHDI_EVENT_ONHOOK:
if (p->radio) {
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_RADIO_UNKEY;
@@ -4456,10 +4425,10 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
if ((p->sig == SIG_FXOLS) || (p->sig == SIG_FXOKS) || (p->sig == SIG_FXOGS))
{
/* Make sure it starts ringing */
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_RINGOFF);
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_RING);
+ dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_RINGOFF);
+ dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_RING);
save_conference(p->oprpeer);
- tone_zone_play_tone(p->oprpeer->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p->oprpeer->subs[SUB_REAL].zfd, DAHDI_TONE_RINGTONE);
}
break;
}
@@ -4487,7 +4456,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
/* Don't start streaming audio yet if the incoming call isn't up yet */
if (p->subs[SUB_REAL].owner->_state != AST_STATE_UP)
p->dialing = 1;
- zt_ring_phone(p);
+ dahdi_ring_phone(p);
} else if (p->subs[SUB_THREEWAY].owner) {
unsigned int mssinceflash;
/* Here we have to retain the lock on both the main channel, the 3-way channel, and
@@ -4533,7 +4502,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
swap_subs(p, SUB_THREEWAY, SUB_REAL);
p->owner = NULL;
/* Ring the phone */
- zt_ring_phone(p);
+ dahdi_ring_phone(p);
} else {
if ((res = attempt_transfer(p)) < 0) {
p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV;
@@ -4557,7 +4526,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
swap_subs(p, SUB_THREEWAY, SUB_REAL);
p->owner = NULL;
/* Ring the phone */
- zt_ring_phone(p);
+ dahdi_ring_phone(p);
}
}
} else {
@@ -4565,18 +4534,18 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
}
/* Fall through */
default:
- zt_disable_ec(p);
+ dahdi_disable_ec(p);
return NULL;
}
break;
- case ZT_EVENT_RINGOFFHOOK:
+ case DAHDI_EVENT_RINGOFFHOOK:
if (p->inalarm) break;
if (p->oprmode < 0)
{
if ((p->sig == SIG_FXOLS) || (p->sig == SIG_FXOKS) || (p->sig == SIG_FXOGS))
{
/* Make sure it stops ringing */
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_RINGOFF);
+ dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_RINGOFF);
tone_zone_play_tone(p->oprpeer->subs[SUB_REAL].zfd, -1);
restore_conference(p->oprpeer);
}
@@ -4606,9 +4575,9 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->dop.dialstr[strlen(p->dop.dialstr)-2] = '\0';
} else
p->echobreak = 0;
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop)) {
- x = ZT_ONHOOK;
- ioctl(p->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_DIAL, &p->dop)) {
+ x = DAHDI_ONHOOK;
+ ioctl(p->subs[SUB_REAL].zfd, DAHDI_HOOK, &x);
ast_log(LOG_WARNING, "Dialing failed on channel %d: %s\n", p->channel, strerror(errno));
return NULL;
}
@@ -4621,12 +4590,12 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
case SIG_FXOKS:
switch (ast->_state) {
case AST_STATE_RINGING:
- zt_enable_ec(p);
- zt_train_ec(p);
+ dahdi_enable_ec(p);
+ dahdi_train_ec(p);
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_ANSWER;
/* Make sure it stops ringing */
- zt_set_hook(p->subs[index].zfd, ZT_OFFHOOK);
+ dahdi_set_hook(p->subs[index].zfd, DAHDI_OFFHOOK);
ast_debug(1, "channel %d answered\n", p->channel);
if (p->cidspill) {
/* Cancel any running CallerID spill */
@@ -4641,7 +4610,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->subs[index].f.subclass = 0;
} else if (!ast_strlen_zero(p->dop.dialstr)) {
/* nick@dccinc.com 4/3/03 - fxo should be able to do deferred dialing */
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_DIAL, &p->dop);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to initiate dialing on trunk channel %d\n", p->channel);
p->dop.dialstr[0] = '\0';
@@ -4666,7 +4635,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
return &p->subs[index].f;
case AST_STATE_UP:
/* Make sure it stops ringing */
- zt_set_hook(p->subs[index].zfd, ZT_OFFHOOK);
+ dahdi_set_hook(p->subs[index].zfd, DAHDI_OFFHOOK);
/* Okay -- probably call waiting*/
if (ast_bridged_channel(p->owner))
ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
@@ -4675,9 +4644,9 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
case AST_STATE_RESERVED:
/* Start up dialtone */
if (has_voicemail(p))
- res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_STUTTER);
+ res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, DAHDI_TONE_STUTTER);
else
- res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_DIALTONE);
+ res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, DAHDI_TONE_DIALTONE);
break;
default:
ast_log(LOG_WARNING, "FXO phone off hook in weird state %d??\n", ast->_state);
@@ -4736,8 +4705,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
ast_log(LOG_WARNING, "Don't know how to handle ring/off hook for signalling %d\n", p->sig);
}
break;
-#ifdef ZT_EVENT_RINGBEGIN
- case ZT_EVENT_RINGBEGIN:
+#ifdef DAHDI_EVENT_RINGBEGIN
+ case DAHDI_EVENT_RINGBEGIN:
switch (p->sig) {
case SIG_FXSLS:
case SIG_FXSGS:
@@ -4749,7 +4718,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
}
break;
#endif
- case ZT_EVENT_RINGEROFF:
+ case DAHDI_EVENT_RINGEROFF:
if (p->inalarm) break;
if ((p->radio || (p->oprmode < 0))) break;
ast->rings++;
@@ -4762,9 +4731,9 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_RINGING;
break;
- case ZT_EVENT_RINGERON:
+ case DAHDI_EVENT_RINGERON:
break;
- case ZT_EVENT_NOALARM:
+ case DAHDI_EVENT_NOALARM:
p->inalarm = 0;
#ifdef HAVE_PRI
/* Extremely unlikely but just in case */
@@ -4775,23 +4744,23 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
"Channel: %d\r\n", p->channel);
break;
- case ZT_EVENT_WINKFLASH:
+ case DAHDI_EVENT_WINKFLASH:
if (p->inalarm) break;
if (p->radio) break;
if (p->oprmode < 0) break;
if (p->oprmode > 1)
{
- struct zt_params par;
+ struct dahdi_params par;
- if (ioctl(p->oprpeer->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &par) != -1)
+ if (ioctl(p->oprpeer->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &par) != -1)
{
if (!par.rxisoffhook)
{
/* Make sure it stops ringing */
- zt_set_hook(p->oprpeer->subs[SUB_REAL].zfd, ZT_RINGOFF);
- zt_set_hook(p->oprpeer->subs[SUB_REAL].zfd, ZT_RING);
+ dahdi_set_hook(p->oprpeer->subs[SUB_REAL].zfd, DAHDI_RINGOFF);
+ dahdi_set_hook(p->oprpeer->subs[SUB_REAL].zfd, DAHDI_RING);
save_conference(p);
- tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
+ tone_zone_play_tone(p->subs[SUB_REAL].zfd, DAHDI_TONE_RINGTONE);
}
}
break;
@@ -4845,7 +4814,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->subs[SUB_REAL].needflash = 1;
goto winkflashdone;
} else if (!check_for_conference(p)) {
- if (p->zaptrcallerid && p->owner) {
+ if (p->dahditrcallerid && p->owner) {
if (p->owner->cid.cid_num)
ast_copy_string(cid_num, p->owner->cid.cid_num, sizeof(cid_num));
if (p->owner->cid.cid_name)
@@ -4864,8 +4833,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
goto winkflashdone;
}
/* Make new channel */
- chan = zt_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, 0);
- if (p->zaptrcallerid) {
+ chan = dahdi_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, 0);
+ if (p->dahditrcallerid) {
if (!p->origcid_num)
p->origcid_num = ast_strdup(p->cid_num);
if (!p->origcid_name)
@@ -4876,8 +4845,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
/* Swap things around between the three-way and real call */
swap_subs(p, SUB_THREEWAY, SUB_REAL);
/* Disable echo canceller for better dialing */
- zt_disable_ec(p);
- res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_DIALRECALL);
+ dahdi_disable_ec(p);
+ res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, DAHDI_TONE_DIALRECALL);
if (res)
ast_log(LOG_WARNING, "Unable to start dial recall tone on channel %d\n", p->channel);
p->owner = chan;
@@ -4885,8 +4854,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
ast_log(LOG_WARNING, "Cannot allocate new structure on channel %d\n", p->channel);
} else if (ast_pthread_create_detached(&threadid, NULL, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch on channel %d\n", p->channel);
- res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
- zt_enable_ec(p);
+ res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, DAHDI_TONE_CONGESTION);
+ dahdi_enable_ec(p);
ast_hangup(chan);
} else {
ast_verb(3, "Started three way call on channel %d\n", p->channel);
@@ -4935,8 +4904,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->owner = p->subs[SUB_REAL].owner;
if (ast->_state == AST_STATE_RINGING) {
ast_debug(1, "Enabling ringtone on real and threeway\n");
- res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
- res = tone_zone_play_tone(p->subs[SUB_THREEWAY].zfd, ZT_TONE_RINGTONE);
+ res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, DAHDI_TONE_RINGTONE);
+ res = tone_zone_play_tone(p->subs[SUB_THREEWAY].zfd, DAHDI_TONE_RINGTONE);
}
} else {
ast_verb(3, "Dumping incomplete call on on %s\n", p->subs[SUB_THREEWAY].owner->name);
@@ -4946,7 +4915,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
if (p->subs[SUB_REAL].owner && ast_bridged_channel(p->subs[SUB_REAL].owner))
ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
p->subs[SUB_REAL].needunhold = 1;
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
}
}
@@ -4994,7 +4963,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
case SIG_SF_FEATB:
/* FGD MF *Must* wait for wink */
if (!ast_strlen_zero(p->dop.dialstr)) {
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_DIAL, &p->dop);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to initiate dialing on trunk channel %d\n", p->channel);
p->dop.dialstr[0] = '\0';
@@ -5008,7 +4977,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
ast_log(LOG_WARNING, "Don't know how to handle ring/off hoook for signalling %d\n", p->sig);
}
break;
- case ZT_EVENT_HOOKCOMPLETE:
+ case DAHDI_EVENT_HOOKCOMPLETE:
if (p->inalarm) break;
if ((p->radio || (p->oprmode < 0))) break;
switch (mysig) {
@@ -5023,7 +4992,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
case SIG_SFWINK:
case SIG_SF_FEATD:
if (!ast_strlen_zero(p->dop.dialstr)) {
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &p->dop);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_DIAL, &p->dop);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to initiate dialing on trunk channel %d\n", p->channel);
p->dop.dialstr[0] = '\0';
@@ -5032,7 +5001,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
ast_debug(1, "Sent deferred digit string: %s\n", p->dop.dialstr);
}
p->dop.dialstr[0] = '\0';
- p->dop.op = ZT_DIAL_OP_REPLACE;
+ p->dop.op = DAHDI_DIAL_OP_REPLACE;
break;
case SIG_FEATDMF:
case SIG_FEATDMF_TA:
@@ -5048,7 +5017,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
break;
}
break;
- case ZT_EVENT_POLARITY:
+ case DAHDI_EVENT_POLARITY:
/*
* If we get a Polarity Switch event, check to see
* if we should change the polarity state and
@@ -5098,16 +5067,16 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
return &p->subs[index].f;
}
-static struct ast_frame *__zt_exception(struct ast_channel *ast)
+static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
int res;
int usedindex=-1;
int index;
struct ast_frame *f;
- index = zt_get_index(ast, p, 1);
+ index = dahdi_get_index(ast, p, 1);
p->subs[index].f.frametype = AST_FRAME_NULL;
p->subs[index].f.datalen = 0;
@@ -5116,7 +5085,7 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast)
p->subs[index].f.offset = 0;
p->subs[index].f.subclass = 0;
p->subs[index].f.delivery = ast_tv(0,0);
- p->subs[index].f.src = "zt_exception";
+ p->subs[index].f.src = "dahdi_exception";
p->subs[index].f.data.ptr = NULL;
@@ -5130,10 +5099,10 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast)
res = p->fake_event;
p->fake_event = 0;
} else
- res = zt_get_event(p->subs[SUB_REAL].zfd);
+ res = dahdi_get_event(p->subs[SUB_REAL].zfd);
/* Switch to real if there is one and this isn't something really silly... */
- if ((res != ZT_EVENT_RINGEROFF) && (res != ZT_EVENT_RINGERON) &&
- (res != ZT_EVENT_HOOKCOMPLETE)) {
+ if ((res != DAHDI_EVENT_RINGEROFF) && (res != DAHDI_EVENT_RINGERON) &&
+ (res != DAHDI_EVENT_HOOKCOMPLETE)) {
ast_debug(1, "Restoring owner of channel %d on event %d\n", p->channel, res);
p->owner = p->subs[SUB_REAL].owner;
if (p->owner && ast_bridged_channel(p->owner))
@@ -5141,37 +5110,37 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast)
p->subs[SUB_REAL].needunhold = 1;
}
switch (res) {
- case ZT_EVENT_ONHOOK:
- zt_disable_ec(p);
+ case DAHDI_EVENT_ONHOOK:
+ dahdi_disable_ec(p);
if (p->owner) {
ast_verb(3, "Channel %s still has call, ringing phone\n", p->owner->name);
- zt_ring_phone(p);
+ dahdi_ring_phone(p);
p->callwaitingrepeat = 0;
p->cidcwexpire = 0;
} else
ast_log(LOG_WARNING, "Absorbed on hook, but nobody is left!?!?\n");
update_conf(p);
break;
- case ZT_EVENT_RINGOFFHOOK:
- zt_enable_ec(p);
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+ case DAHDI_EVENT_RINGOFFHOOK:
+ dahdi_enable_ec(p);
+ dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_OFFHOOK);
if (p->owner && (p->owner->_state == AST_STATE_RINGING)) {
p->subs[SUB_REAL].needanswer = 1;
p->dialing = 0;
}
break;
- case ZT_EVENT_HOOKCOMPLETE:
- case ZT_EVENT_RINGERON:
- case ZT_EVENT_RINGEROFF:
+ case DAHDI_EVENT_HOOKCOMPLETE:
+ case DAHDI_EVENT_RINGERON:
+ case DAHDI_EVENT_RINGEROFF:
/* Do nothing */
break;
- case ZT_EVENT_WINKFLASH:
+ case DAHDI_EVENT_WINKFLASH:
p->flashtime = ast_tvnow();
if (p->owner) {
ast_verb(3, "Channel %d flashed to other channel %s\n", p->channel, p->owner->name);
if (p->owner->_state != AST_STATE_UP) {
/* Answer if necessary */
- usedindex = zt_get_index(p->owner, p, 0);
+ usedindex = dahdi_get_index(p->owner, p, 0);
if (usedindex > -1) {
p->subs[usedindex].needanswer = 1;
}
@@ -5200,23 +5169,23 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast)
f = &p->subs[index].f;
return f;
}
- f = zt_handle_event(ast);
+ f = dahdi_handle_event(ast);
return f;
}
-static struct ast_frame *zt_exception(struct ast_channel *ast)
+static struct ast_frame *dahdi_exception(struct ast_channel *ast)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
struct ast_frame *f;
ast_mutex_lock(&p->lock);
- f = __zt_exception(ast);
+ f = __dahdi_exception(ast);
ast_mutex_unlock(&p->lock);
return f;
}
-static struct ast_frame *zt_read(struct ast_channel *ast)
+static struct ast_frame *dahdi_read(struct ast_channel *ast)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
int res;
int index;
void *readbuf;
@@ -5225,7 +5194,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
ast_mutex_lock(&p->lock);
- index = zt_get_index(ast, p, 0);
+ index = dahdi_get_index(ast, p, 0);
/* Hang up if we don't really exist */
if (index < 0) {
@@ -5243,16 +5212,16 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
p->subs[index].f.offset = 0;
p->subs[index].f.subclass = 0;
p->subs[index].f.delivery = ast_tv(0,0);
- p->subs[index].f.src = "zt_read";
+ p->subs[index].f.src = "dahdi_read";
p->subs[index].f.data.ptr = NULL;
/* make sure it sends initial key state as first frame */
if ((p->radio || (p->oprmode < 0)) && (!p->firstradio))
{
- ZT_PARAMS ps;
+ DAHDI_PARAMS ps;
ps.channo = p->channel;
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &ps) < 0) {
+ if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &ps) < 0) {
ast_mutex_unlock(&p->lock);
return NULL;
}
@@ -5353,7 +5322,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
if (ast->rawreadformat == AST_FORMAT_SLINEAR) {
if (!p->subs[index].linear) {
p->subs[index].linear = 1;
- res = zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ res = dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
if (res)
ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to linear mode.\n", p->channel, index);
}
@@ -5361,7 +5330,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
(ast->rawreadformat == AST_FORMAT_ALAW)) {
if (p->subs[index].linear) {
p->subs[index].linear = 0;
- res = zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ res = dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
if (res)
ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to companded mode.\n", p->channel, index);
}
@@ -5383,16 +5352,16 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
ast_mutex_unlock(&p->lock);
return &p->subs[index].f;
} else if (errno == ELAST) {
- f = __zt_exception(ast);
+ f = __dahdi_exception(ast);
} else
- ast_log(LOG_WARNING, "zt_rec: %s\n", strerror(errno));
+ ast_log(LOG_WARNING, "dahdi_rec: %s\n", strerror(errno));
}
ast_mutex_unlock(&p->lock);
return f;
}
if (res != (p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE)) {
ast_debug(1, "Short read (%d/%d), must be an event...\n", res, p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE);
- f = __zt_exception(ast);
+ f = __dahdi_exception(ast);
ast_mutex_unlock(&p->lock);
return f;
}
@@ -5418,7 +5387,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
}
}
/* Ensure the CW timer decrements only on a single subchannel */
- if (p->callwaitingrepeat && zt_get_index(ast, p, 1) == SUB_REAL) {
+ if (p->callwaitingrepeat && dahdi_get_index(ast, p, 1) == SUB_REAL) {
p->callwaitingrepeat--;
}
if (p->cidcwexpire)
@@ -5426,7 +5395,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
/* Repeat callwaiting */
if (p->callwaitingrepeat == 1) {
p->callwaitrings++;
- zt_callwait(ast);
+ dahdi_callwait(ast);
}
/* Expire CID/CW */
if (p->cidcwexpire == 1) {
@@ -5467,7 +5436,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
p->subs[index].f.datalen= 0;
}
if (p->dsp && (!p->ignoredtmf || p->callwaitcas || p->busydetect || p->callprogress) && !index) {
- /* Perform busy detection. etc on the zap line */
+ /* Perform busy detection. etc on the dahdi line */
int mute;
f = ast_dsp_process(ast, p->dsp, &p->subs[index].f);
@@ -5476,7 +5445,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
mute = ast_dsp_was_muted(p->dsp);
if (p->muting != mute) {
p->muting = mute;
- zt_confmute(p, mute);
+ dahdi_confmute(p, mute);
}
if (f) {
@@ -5489,8 +5458,8 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
} else if (f->frametype == AST_FRAME_DTMF) {
#ifdef HAVE_PRI
if (!p->proceeding && ((p->sig == SIG_PRI) || (p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP)) && p->pri &&
- ((!p->outgoing && (p->pri->overlapdial & ZAP_OVERLAPDIAL_INCOMING)) ||
- (p->outgoing && (p->pri->overlapdial & ZAP_OVERLAPDIAL_OUTGOING)))) {
+ ((!p->outgoing && (p->pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING)) ||
+ (p->outgoing && (p->pri->overlapdial & DAHDI_OVERLAPDIAL_OUTGOING)))) {
/* Don't accept in-band DTMF when in overlap dial mode */
f->frametype = AST_FRAME_NULL;
f->subclass = 0;
@@ -5504,7 +5473,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
f = &p->subs[index].f;
if (f && (f->frametype == AST_FRAME_DTMF))
- zt_handle_dtmfup(ast, index, &f);
+ dahdi_handle_dtmfup(ast, index, &f);
/* If we have a fake_event, trigger exception to handle it */
if (p->fake_event)
@@ -5514,7 +5483,7 @@ static struct ast_frame *zt_read(struct ast_channel *ast)
return f;
}
-static int my_zt_write(struct zt_pvt *p, unsigned char *buf, int len, int index, int linear)
+static int my_dahdi_write(struct dahdi_pvt *p, unsigned char *buf, int len, int index, int linear)
{
int sent=0;
int size;
@@ -5536,12 +5505,12 @@ static int my_zt_write(struct zt_pvt *p, unsigned char *buf, int len, int index,
return sent;
}
-static int zt_write(struct ast_channel *ast, struct ast_frame *frame)
+static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame)
{
- struct zt_pvt *p = ast->tech_pvt;
+ struct dahdi_pvt *p = ast->tech_pvt;
int res;
int index;
- index = zt_get_index(ast, p, 0);
+ index = dahdi_get_index(ast, p, 0);
if (index < 0) {
ast_log(LOG_WARNING, "%s doesn't really exist?\n", ast->name);
return -1;
@@ -5594,20 +5563,20 @@ static int zt_write(struct ast_channel *ast, struct ast_frame *frame)
if (frame->subclass == AST_FORMAT_SLINEAR) {
if (!p->subs[index].linear) {
p->subs[index].linear = 1;
- res = zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ res = dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
if (res)
ast_log(LOG_WARNING, "Unable to set linear mode on channel %d\n", p->channel);
}
- res = my_zt_write(p, (unsigned char *)frame->data.ptr, frame->datalen, index, 1);
+ res = my_dahdi_write(p, (unsigned char *)frame->data.ptr, frame->datalen, index, 1);
} else {
/* x-law already */
if (p->subs[index].linear) {
p->subs[index].linear = 0;
- res = zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ res = dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
if (res)
ast_log(LOG_WARNING, "Unable to set companded mode on channel %d\n", p->channel);
}
- res = my_zt_write(p, (unsigned char *)frame->data.ptr, frame->datalen, index, 0);
+ res = my_dahdi_write(p, (unsigned char *)frame->data.ptr, frame->datalen, index, 0);
}
if (res < 0) {
ast_log(LOG_WARNING, "write failed: %s\n", strerror(errno));
@@ -5616,14 +5585,14 @@ static int zt_write(struct ast_channel *ast, struct ast_frame *frame)
return 0;
}
-static int zt_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen)
+static int dahdi_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen)
{
- struct zt_pvt *p = chan->tech_pvt;
+ struct dahdi_pvt *p = chan->tech_pvt;
int res=-1;
int index;
- int func = ZT_FLASH;
+ int func = DAHDI_FLASH;
ast_mutex_lock(&p->lock);
- index = zt_get_index(chan, p, 0);
+ index = dahdi_get_index(chan, p, 0);
ast_debug(1, "Requested indication %d on channel %s\n", condition, chan->name);
if (index == SUB_REAL) {
switch (condition) {
@@ -5645,10 +5614,10 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
}
p->progress = 1;
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_BUSY);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_BUSY);
} else
#endif
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_BUSY);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_BUSY);
break;
case AST_CONTROL_RINGING:
#ifdef HAVE_PRI
@@ -5681,7 +5650,7 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
}
#endif
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_RINGTONE);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_RINGTONE);
if (chan->_state != AST_STATE_UP) {
if ((chan->_state != AST_STATE_RING) ||
@@ -5752,7 +5721,7 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
p->progress = 1;
ss7_rel(p->ss7);
/* enable echo canceler here on SS7 calls */
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
}
}
@@ -5777,10 +5746,10 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
}
p->progress = 1;
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);
} else
#endif
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);
break;
case AST_CONTROL_HOLD:
#ifdef HAVE_PRI
@@ -5808,12 +5777,12 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
break;
case AST_CONTROL_RADIO_KEY:
if (p->radio)
- res = zt_set_hook(p->subs[index].zfd, ZT_OFFHOOK);
+ res = dahdi_set_hook(p->subs[index].zfd, DAHDI_OFFHOOK);
res = 0;
break;
case AST_CONTROL_RADIO_UNKEY:
if (p->radio)
- res = zt_set_hook(p->subs[index].zfd, ZT_RINGOFF);
+ res = dahdi_set_hook(p->subs[index].zfd, DAHDI_RINGOFF);
res = 0;
break;
case AST_CONTROL_FLASH:
@@ -5821,7 +5790,7 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
if (ISTRUNK(p) && (p->sig != SIG_PRI)) {
/* Clear out the dial buffer */
p->dop.dialstr[0] = '\0';
- if ((ioctl(p->subs[SUB_REAL].zfd,ZT_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
+ if ((ioctl(p->subs[SUB_REAL].zfd,DAHDI_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
ast_log(LOG_WARNING, "Unable to flash external trunk on channel %s: %s\n",
chan->name, strerror(errno));
} else
@@ -5842,7 +5811,7 @@ static int zt_indicate(struct ast_channel *chan, int condition, const void *data
return res;
}
-static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int index, int law, int transfercapability)
+static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpbx, int index, int law, int transfercapability)
{
struct ast_channel *tmp;
int deflaw;
@@ -5851,7 +5820,7 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
int features;
struct ast_str *chan_name;
struct ast_variable *v;
- ZT_PARAMS ps;
+ DAHDI_PARAMS ps;
if (i->subs[index].owner) {
ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[index]);
return NULL;
@@ -5874,22 +5843,22 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
}
y++;
} while (x < 3);
- tmp = ast_channel_alloc(0, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "Zap/%s", chan_name->str);
+ tmp = ast_channel_alloc(0, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "DAHDI/%s", chan_name->str);
if (!tmp)
return NULL;
- tmp->tech = &zap_tech;
+ tmp->tech = &dahdi_tech;
ps.channo = i->channel;
- res = ioctl(i->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &ps);
+ res = ioctl(i->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &ps);
if (res) {
ast_log(LOG_WARNING, "Unable to get parameters, assuming MULAW\n");
- ps.curlaw = ZT_LAW_MULAW;
+ ps.curlaw = DAHDI_LAW_MULAW;
}
- if (ps.curlaw == ZT_LAW_ALAW)
+ if (ps.curlaw == DAHDI_LAW_ALAW)
deflaw = AST_FORMAT_ALAW;
else
deflaw = AST_FORMAT_ULAW;
if (law) {
- if (law == ZT_LAW_ALAW)
+ if (law == DAHDI_LAW_ALAW)
deflaw = AST_FORMAT_ALAW;
else
deflaw = AST_FORMAT_ULAW;
@@ -5902,7 +5871,7 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
tmp->rawwriteformat = deflaw;
tmp->writeformat = deflaw;
i->subs[index].linear = 0;
- zt_setlinear(i->subs[index].zfd, i->subs[index].linear);
+ dahdi_setlinear(i->subs[index].zfd, i->subs[index].linear);
features = 0;
if (index == SUB_REAL) {
if (i->busydetect && CANBUSYDETECT(i))
@@ -5913,13 +5882,13 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
(i->outgoing && (i->callprogress & CALLPROGRESS_FAX_OUTGOING))) {
features |= DSP_FEATURE_FAX_DETECT;
}
-#ifdef ZT_TONEDETECT
- x = ZT_TONEDETECT_ON | ZT_TONEDETECT_MUTE;
- if (ioctl(i->subs[index].zfd, ZT_TONEDETECT, &x)) {
+#ifdef DAHDI_TONEDETECT
+ x = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE;
+ if (ioctl(i->subs[index].zfd, DAHDI_TONEDETECT, &x)) {
#endif
i->hardwaredtmf = 0;
features |= DSP_FEATURE_DIGIT_DETECT;
-#ifdef ZT_TONEDETECT
+#ifdef DAHDI_TONEDETECT
} else if (NEED_MFDETECT(i)) {
i->hardwaredtmf = 1;
features |= DSP_FEATURE_DIGIT_DETECT;
@@ -6012,7 +5981,7 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
/* clear the fake event in case we posted one before we had ast_channel */
i->fake_event = 0;
/* Assure there is no confmute on this channel */
- zt_confmute(i, 0);
+ dahdi_confmute(i, 0);
i->muting = 0;
/* Configure the new channel jb */
ast_jb_configure(tmp, &global_jbconf);
@@ -6055,50 +6024,50 @@ static int my_getsigstr(struct ast_channel *chan, char *str, const char *term, i
}
}
-static int zt_wink(struct zt_pvt *p, int index)
+static int dahdi_wink(struct dahdi_pvt *p, int index)
{
int j;
- zt_set_hook(p->subs[index].zfd, ZT_WINK);
+ dahdi_set_hook(p->subs[index].zfd, DAHDI_WINK);
for (;;)
{
/* set bits of interest */
- j = ZT_IOMUX_SIGEVENT;
+ j = DAHDI_IOMUX_SIGEVENT;
/* wait for some happening */
- if (ioctl(p->subs[index].zfd,ZT_IOMUX,&j) == -1) return(-1);
+ if (ioctl(p->subs[index].zfd,DAHDI_IOMUX,&j) == -1) return(-1);
/* exit loop if we have it */
- if (j & ZT_IOMUX_SIGEVENT) break;
+ if (j & DAHDI_IOMUX_SIGEVENT) break;
}
/* get the event info */
- if (ioctl(p->subs[index].zfd,ZT_GETEVENT,&j) == -1) return(-1);
+ if (ioctl(p->subs[index].zfd,DAHDI_GETEVENT,&j) == -1) return(-1);
return 0;
}
-/*! \brief enable or disable the chan_zap Do-Not-Disturb mode for a Zaptel channel
- * \param zapchan "Physical" Zaptel channel (e.g: Zap/5)
+/*! \brief enable or disable the chan_dahdi Do-Not-Disturb mode for a DAHDI channel
+ * \param dahdichan "Physical" DAHDI channel (e.g: DAHDI/5)
* \param on 1 to enable, 0 to disable
*
- * chan_zap has a DND (Do Not Disturb) mode for each zapchan (physical
- * zaptel channel). Use this to enable or disable it.
+ * chan_dahdi has a DND (Do Not Disturb) mode for each dahdichan (physical
+ * DAHDI channel). Use this to enable or disable it.
*
- * \bug the use of the word "channel" for those zapchans is really confusing.
+ * \bug the use of the word "channel" for those dahdichans is really confusing.
*/
-static void zap_dnd(struct zt_pvt *zapchan, int on)
+static void dahdi_dnd(struct dahdi_pvt *dahdichan, int on)
{
/* Do not disturb */
- zapchan->dnd = on;
+ dahdichan->dnd = on;
ast_verb(3, "%s DND on channel %d\n",
on? "Enabled" : "Disabled",
- zapchan->channel);
+ dahdichan->channel);
manager_event(EVENT_FLAG_SYSTEM, "DNDState",
- "Channel: Zap/%d\r\n"
- "Status: %s\r\n", zapchan->channel,
+ "Channel: DAHDI/%d\r\n"
+ "Status: %s\r\n", dahdichan->channel,
on? "enabled" : "disabled");
}
static void *ss_thread(void *data)
{
struct ast_channel *chan = data;
- struct zt_pvt *p = chan->tech_pvt;
+ struct dahdi_pvt *p = chan->tech_pvt;
char exten[AST_MAX_EXTENSION] = "";
char exten2[AST_MAX_EXTENSION] = "";
unsigned char buf[256];
@@ -6132,7 +6101,7 @@ static void *ss_thread(void *data)
}
ast_verb(3, "Starting simple switch on '%s'\n", chan->name);
- index = zt_get_index(chan, p, 1);
+ index = dahdi_get_index(chan, p, 1);
if (index < 0) {
ast_log(LOG_WARNING, "Huh?\n");
ast_hangup(chan);
@@ -6153,7 +6122,7 @@ static void *ss_thread(void *data)
if (len && !ast_ignore_pattern(chan->context, exten))
tone_zone_play_tone(p->subs[index].zfd, -1);
else
- tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALTONE);
+ tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALTONE);
if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num))
timeout = matchdigittimeout;
else
@@ -6180,7 +6149,7 @@ static void *ss_thread(void *data)
/* Start the real PBX */
ast_copy_string(chan->exten, exten, sizeof(chan->exten));
if (p->dsp) ast_dsp_digitreset(p->dsp);
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
ast_setstate(chan, AST_STATE_RING);
res = ast_pbx_run(chan);
if (res) {
@@ -6208,7 +6177,7 @@ static void *ss_thread(void *data)
case SIG_SF_FEATDMF:
case SIG_SF_FEATB:
case SIG_SFWINK:
- if (zt_wink(p, index))
+ if (dahdi_wink(p, index))
return NULL;
/* Fall through */
case SIG_EM:
@@ -6246,7 +6215,7 @@ static void *ss_thread(void *data)
case SIG_FEATDMF_TA:
res = my_getsigstr(chan, dtmfbuf + 1, "#", 3000);
if ((res < 1) && (p->dsp)) ast_dsp_digitreset(p->dsp);
- if (zt_wink(p, index)) return NULL;
+ if (dahdi_wink(p, index)) return NULL;
dtmfbuf[0] = 0;
/* Wait for the first digit (up to 5 seconds). */
res = ast_waitfordigit(chan, 5000);
@@ -6261,7 +6230,7 @@ static void *ss_thread(void *data)
/* if international caca, do it again to get real ANO */
if ((p->sig == SIG_FEATDMF) && (dtmfbuf[1] != '0') && (strlen(dtmfbuf) != 14))
{
- if (zt_wink(p, index)) return NULL;
+ if (dahdi_wink(p, index)) return NULL;
dtmfbuf[0] = 0;
/* Wait for the first digit (up to 5 seconds). */
res = ast_waitfordigit(chan, 5000);
@@ -6272,7 +6241,7 @@ static void *ss_thread(void *data)
if (res > 0) {
/* if E911, take off hook */
if (p->sig == SIG_E911)
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+ dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_OFFHOOK);
res = my_getsigstr(chan, dtmfbuf + strlen(dtmfbuf), "#", 3000);
}
if ((res < 1) && (p->dsp)) ast_dsp_digitreset(p->dsp);
@@ -6336,7 +6305,7 @@ static void *ss_thread(void *data)
ast_hangup(chan);
return NULL;
}
- zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+ dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_OFFHOOK);
ast_dsp_set_digitmode(p->dsp, DSP_DIGITMODE_MF | p->dtmfrelax);
res = my_getsigstr(chan, anibuf, "#", 10000);
if ((res > 0) && (strlen(anibuf) > 2)) {
@@ -6419,13 +6388,13 @@ static void *ss_thread(void *data)
ast_log(LOG_WARNING, "Got a non-Feature Group B input on channel %d. Assuming E&M Wink instead\n", p->channel);
}
if ((p->sig == SIG_FEATDMF) || (p->sig == SIG_FEATDMF_TA)) {
- zt_wink(p, index);
+ dahdi_wink(p, index);
/* some switches require a minimum guard time between
the last FGD wink and something that answers
immediately. This ensures it */
if (ast_safe_sleep(chan,100)) return NULL;
}
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
if (NEED_MFDETECT(p)) {
if (p->dsp) {
if (!p->hardwaredtmf)
@@ -6443,13 +6412,13 @@ static void *ss_thread(void *data)
res = ast_pbx_run(chan);
if (res) {
ast_log(LOG_WARNING, "PBX exited non-zero\n");
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);
}
return NULL;
} else {
ast_verb(2, "Unknown extension '%s' in context '%s' requested\n", exten, chan->context);
sleep(2);
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_INFO);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_INFO);
if (res < 0)
ast_log(LOG_WARNING, "Unable to start special tone on %d\n", p->channel);
else
@@ -6457,7 +6426,7 @@ static void *ss_thread(void *data)
res = ast_streamfile(chan, "ss-noservice", chan->language);
if (res >= 0)
ast_waitstream(chan, "");
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);
ast_hangup(chan);
return NULL;
}
@@ -6492,21 +6461,21 @@ static void *ss_thread(void *data)
if (!ast_ignore_pattern(chan->context, exten))
tone_zone_play_tone(p->subs[index].zfd, -1);
else
- tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALTONE);
+ tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALTONE);
if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && strcmp(exten, ast_parking_ext())) {
if (!res || !ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
if (getforward) {
/* Record this as the forwarding extension */
ast_copy_string(p->call_forward, exten, sizeof(p->call_forward));
ast_verb(3, "Setting call forward to '%s' on channel %d\n", p->call_forward, p->channel);
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);
if (res)
break;
usleep(500000);
res = tone_zone_play_tone(p->subs[index].zfd, -1);
sleep(1);
memset(exten, 0, sizeof(exten));
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALTONE);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALTONE);
len = 0;
getforward = 0;
} else {
@@ -6523,11 +6492,11 @@ static void *ss_thread(void *data)
ast_set_callerid(chan, NULL, p->cid_name, NULL);
}
ast_setstate(chan, AST_STATE_RING);
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
res = ast_pbx_run(chan);
if (res) {
ast_log(LOG_WARNING, "PBX exited non-zero\n");
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);
}
return NULL;
}
@@ -6538,21 +6507,21 @@ static void *ss_thread(void *data)
}
} else if (res == 0) {
ast_debug(1, "not enough digits (and no ambiguous match)...\n");
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
- zt_wait_event(p->subs[index].zfd);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);
+ dahdi_wait_event(p->subs[index].zfd);
ast_hangup(chan);
return NULL;
} else if (p->callwaiting && !strcmp(exten, "*70")) {
ast_verb(3, "Disabling call waiting on %s\n", chan->name);
/* Disable call waiting if enabled */
p->callwaiting = 0;
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);
if (res) {
ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
chan->name, strerror(errno));
}
len = 0;
- ioctl(p->subs[index].zfd,ZT_CONFDIAG,&len);
+ ioctl(p->subs[index].zfd,DAHDI_CONFDIAG,&len);
memset(exten, 0, sizeof(exten));
timeout = firstdigittimeout;
@@ -6570,11 +6539,11 @@ static void *ss_thread(void *data)
swap_subs(p, SUB_CALLWAIT, SUB_THREEWAY);
unalloc_sub(p, SUB_THREEWAY);
}
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
if (ast_pickup_call(chan)) {
ast_debug(1, "No call pickup possible...\n");
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
- zt_wait_event(p->subs[index].zfd);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);
+ dahdi_wait_event(p->subs[index].zfd);
}
ast_hangup(chan);
return NULL;
@@ -6594,7 +6563,7 @@ static void *ss_thread(void *data)
if (chan->cid.cid_name)
ast_free(chan->cid.cid_name);
chan->cid.cid_name = NULL;
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);
if (res) {
ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
chan->name, strerror(errno));
@@ -6608,30 +6577,30 @@ static void *ss_thread(void *data)
res = ast_say_digit_str(chan, p->lastcid_num, "", chan->language);
}
if (!res)
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);
break;
} else if (!strcmp(exten, "*78")) {
- zap_dnd(p, 1);
+ dahdi_dnd(p, 1);
/* Do not disturb */
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);
getforward = 0;
memset(exten, 0, sizeof(exten));
len = 0;
} else if (!strcmp(exten, "*79")) {
- zap_dnd(p, 0);
+ dahdi_dnd(p, 0);
/* Do not disturb */
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);
getforward = 0;
memset(exten, 0, sizeof(exten));
len = 0;
} else if (p->cancallforward && !strcmp(exten, "*72")) {
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);
getforward = 1;
memset(exten, 0, sizeof(exten));
len = 0;
} else if (p->cancallforward && !strcmp(exten, "*73")) {
ast_verb(3, "Cancelling call forwarding on channel %d\n", p->channel);
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);
memset(p->call_forward, 0, sizeof(p->call_forward));
getforward = 0;
memset(exten, 0, sizeof(exten));
@@ -6648,7 +6617,7 @@ static void *ss_thread(void *data)
ast_verb(3, "Blacklisting number %s\n", p->lastcid_num);
res = ast_db_put("blacklist", p->lastcid_num, "1");
if (!res) {
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);
memset(exten, 0, sizeof(exten));
len = 0;
}
@@ -6663,7 +6632,7 @@ static void *ss_thread(void *data)
ast_free(chan->cid.cid_name);
chan->cid.cid_name = NULL;
ast_set_callerid(chan, p->cid_num, p->cid_name, NULL);
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);
if (res) {
ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
chan->name, strerror(errno));
@@ -6674,19 +6643,19 @@ static void *ss_thread(void *data)
} else if (!strcmp(exten, "*0")) {
struct ast_channel *nbridge =
p->subs[SUB_THREEWAY].owner;
- struct zt_pvt *pbridge = NULL;
+ struct dahdi_pvt *pbridge = NULL;
/* set up the private struct of the bridged one, if any */
if (nbridge && ast_bridged_channel(nbridge))
pbridge = ast_bridged_channel(nbridge)->tech_pvt;
if (nbridge && pbridge &&
- (nbridge->tech == &zap_tech) &&
- (ast_bridged_channel(nbridge)->tech == &zap_tech) &&
+ (nbridge->tech == &dahdi_tech) &&
+ (ast_bridged_channel(nbridge)->tech == &dahdi_tech) &&
ISTRUNK(pbridge)) {
- int func = ZT_FLASH;
+ int func = DAHDI_FLASH;
/* Clear out the dial buffer */
p->dop.dialstr[0] = '\0';
/* flash hookswitch */
- if ((ioctl(pbridge->subs[SUB_REAL].zfd,ZT_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
+ if ((ioctl(pbridge->subs[SUB_REAL].zfd,DAHDI_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
ast_log(LOG_WARNING, "Unable to flash external trunk on channel %s: %s\n",
nbridge->name, strerror(errno));
}
@@ -6698,8 +6667,8 @@ static void *ss_thread(void *data)
ast_hangup(chan);
return NULL;
} else {
- tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
- zt_wait_event(p->subs[index].zfd);
+ tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);
+ dahdi_wait_event(p->subs[index].zfd);
tone_zone_play_tone(p->subs[index].zfd, -1);
swap_subs(p, SUB_REAL, SUB_THREEWAY);
unalloc_sub(p, SUB_THREEWAY);
@@ -6783,7 +6752,7 @@ static void *ss_thread(void *data)
cs = NULL;
ast_debug(1, "Receiving DTMF cid on "
"channel %s\n", chan->name);
- zt_setlinear(p->subs[index].zfd, 0);
+ dahdi_setlinear(p->subs[index].zfd, 0);
res = 2000;
for (;;) {
struct ast_frame *f;
@@ -6808,7 +6777,7 @@ static void *ss_thread(void *data)
break; /* Got ring */
}
dtmfbuf[i] = '\0';
- zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
/* Got cid and ring. */
ast_debug(1, "CID got string '%s'\n", dtmfbuf);
callerid_get_dtmf(dtmfbuf, dtmfcid, &flags);
@@ -6828,25 +6797,25 @@ static void *ss_thread(void *data)
bump_gains(p);
#endif
/* Take out of linear mode for Caller*ID processing */
- zt_setlinear(p->subs[index].zfd, 0);
+ dahdi_setlinear(p->subs[index].zfd, 0);
/* First we wait and listen for the Caller*ID */
for (;;) {
- i = ZT_IOMUX_READ | ZT_IOMUX_SIGEVENT;
- if ((res = ioctl(p->subs[index].zfd, ZT_IOMUX, &i))) {
+ i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
+ if ((res = ioctl(p->subs[index].zfd, DAHDI_IOMUX, &i))) {
ast_log(LOG_WARNING, "I/O MUX failed: %s\n", strerror(errno));
callerid_free(cs);
ast_hangup(chan);
return NULL;
}
- if (i & ZT_IOMUX_SIGEVENT) {
- res = zt_get_event(p->subs[index].zfd);
+ if (i & DAHDI_IOMUX_SIGEVENT) {
+ res = dahdi_get_event(p->subs[index].zfd);
ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
if (p->cid_signalling == CID_SIG_V23_JP) {
-#ifdef ZT_EVENT_RINGBEGIN
- if (res == ZT_EVENT_RINGBEGIN) {
- res = zt_set_hook(p->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+#ifdef DAHDI_EVENT_RINGBEGIN
+ if (res == DAHDI_EVENT_RINGBEGIN) {
+ res = dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_OFFHOOK);
usleep(1);
}
#endif
@@ -6854,7 +6823,7 @@ static void *ss_thread(void *data)
res = 0;
break;
}
- } else if (i & ZT_IOMUX_READ) {
+ } else if (i & DAHDI_IOMUX_READ) {
res = read(p->subs[index].zfd, buf, sizeof(buf));
if (res < 0) {
if (errno != ELAST) {
@@ -6888,7 +6857,7 @@ static void *ss_thread(void *data)
}
if (p->cid_signalling == CID_SIG_V23_JP) {
- res = zt_set_hook(p->subs[SUB_REAL].zfd, ZT_ONHOOK);
+ res = dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_ONHOOK);
usleep(1);
res = 4000;
} else {
@@ -6931,15 +6900,15 @@ static void *ss_thread(void *data)
}
for (;;) {
- i = ZT_IOMUX_READ | ZT_IOMUX_SIGEVENT;
- if ((res = ioctl(p->subs[index].zfd, ZT_IOMUX, &i))) {
+ i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
+ if ((res = ioctl(p->subs[index].zfd, DAHDI_IOMUX, &i))) {
ast_log(LOG_WARNING, "I/O MUX failed: %s\n", strerror(errno));
callerid_free(cs);
ast_hangup(chan);
return NULL;
}
- if (i & ZT_IOMUX_SIGEVENT) {
- res = zt_get_event(p->subs[index].zfd);
+ if (i & DAHDI_IOMUX_SIGEVENT) {
+ res = dahdi_get_event(p->subs[index].zfd);
ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
res = 0;
/* Let us detect distinctive ring */
@@ -6949,10 +6918,10 @@ static void *ss_thread(void *data)
if (p->ringt < p->ringt_base/2)
break;
/* Increment the ringT counter so we can match it against
- values in zapata.conf for distinctive ring */
+ values in chan_dahdi.conf for distinctive ring */
if (++receivedRingT == (sizeof(curRingData) / sizeof(curRingData[0])))
break;
- } else if (i & ZT_IOMUX_READ) {
+ } else if (i & DAHDI_IOMUX_READ) {
res = read(p->subs[index].zfd, buf, sizeof(buf));
if (res < 0) {
if (errno != ELAST) {
@@ -6974,7 +6943,7 @@ static void *ss_thread(void *data)
/* this only shows up if you have n of the dring patterns filled in */
ast_verb(3, "Detected ring pattern: %d,%d,%d\n",curRingData[0],curRingData[1],curRingData[2]);
for (counter = 0; counter < 3; counter++) {
- /* Check to see if the rings we received match any of the ones in zapata.conf for this
+ /* Check to see if the rings we received match any of the ones in chan_dahdi.conf for this
channel */
distMatches = 0;
for (counter1 = 0; counter1 < 3; counter1++) {
@@ -7003,7 +6972,7 @@ static void *ss_thread(void *data)
}
}
/* Restore linear mode (if appropriate) for Caller*ID processing */
- zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
#if 1
restore_gains(p);
#endif
@@ -7022,7 +6991,7 @@ static void *ss_thread(void *data)
if (p->cid_signalling == CID_SIG_DTMF) {
int i = 0;
cs = NULL;
- zt_setlinear(p->subs[index].zfd, 0);
+ dahdi_setlinear(p->subs[index].zfd, 0);
res = 2000;
for (;;) {
struct ast_frame *f;
@@ -7046,7 +7015,7 @@ static void *ss_thread(void *data)
}
dtmfbuf[i] = '\0';
- zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
/* Got cid and ring. */
callerid_get_dtmf(dtmfbuf, dtmfcid, &flags);
ast_log(LOG_DEBUG, "CID is '%s', flags %d\n",
@@ -7080,20 +7049,20 @@ static void *ss_thread(void *data)
}
/* Take out of linear mode for Caller*ID processing */
- zt_setlinear(p->subs[index].zfd, 0);
+ dahdi_setlinear(p->subs[index].zfd, 0);
for (;;) {
- i = ZT_IOMUX_READ | ZT_IOMUX_SIGEVENT;
- if ((res = ioctl(p->subs[index].zfd, ZT_IOMUX, &i))) {
+ i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
+ if ((res = ioctl(p->subs[index].zfd, DAHDI_IOMUX, &i))) {
ast_log(LOG_WARNING, "I/O MUX failed: %s\n", strerror(errno));
callerid_free(cs);
ast_hangup(chan);
return NULL;
}
- if (i & ZT_IOMUX_SIGEVENT) {
- res = zt_get_event(p->subs[index].zfd);
+ if (i & DAHDI_IOMUX_SIGEVENT) {
+ res = dahdi_get_event(p->subs[index].zfd);
ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
/* If we get a PR event, they hung up while processing calerid */
- if ( res == ZT_EVENT_POLARITY && p->hanguponpolarityswitch && p->polarity == POLARITY_REV) {
+ if ( res == DAHDI_EVENT_POLARITY && p->hanguponpolarityswitch && p->polarity == POLARITY_REV) {
ast_log(LOG_DEBUG, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel);
p->polarity = POLARITY_IDLE;
callerid_free(cs);
@@ -7108,10 +7077,10 @@ static void *ss_thread(void *data)
if (p->ringt < p->ringt_base/2)
break;
/* Increment the ringT counter so we can match it against
- values in zapata.conf for distinctive ring */
+ values in chan_dahdi.conf for distinctive ring */
if (++receivedRingT == (sizeof(curRingData) / sizeof(curRingData[0])))
break;
- } else if (i & ZT_IOMUX_READ) {
+ } else if (i & DAHDI_IOMUX_READ) {
res = read(p->subs[index].zfd, buf, sizeof(buf));
if (res < 0) {
if (errno != ELAST) {
@@ -7151,15 +7120,15 @@ static void *ss_thread(void *data)
receivedRingT = 0;
ast_verb(3, "Detecting post-CID distinctive ring\n");
for (;;) {
- i = ZT_IOMUX_READ | ZT_IOMUX_SIGEVENT;
- if ((res = ioctl(p->subs[index].zfd, ZT_IOMUX, &i))) {
+ i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
+ if ((res = ioctl(p->subs[index].zfd, DAHDI_IOMUX, &i))) {
ast_log(LOG_WARNING, "I/O MUX failed: %s\n", strerror(errno));
callerid_free(cs);
ast_hangup(chan);
return NULL;
}
- if (i & ZT_IOMUX_SIGEVENT) {
- res = zt_get_event(p->subs[index].zfd);
+ if (i & DAHDI_IOMUX_SIGEVENT) {
+ res = dahdi_get_event(p->subs[index].zfd);
ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
res = 0;
/* Let us detect callerid when the telco uses distinctive ring */
@@ -7169,10 +7138,10 @@ static void *ss_thread(void *data)
if (p->ringt < p->ringt_base/2)
break;
/* Increment the ringT counter so we can match it against
- values in zapata.conf for distinctive ring */
+ values in chan_dahdi.conf for distinctive ring */
if (++receivedRingT == (sizeof(curRingData) / sizeof(curRingData[0])))
break;
- } else if (i & ZT_IOMUX_READ) {
+ } else if (i & DAHDI_IOMUX_READ) {
res = read(p->subs[index].zfd, buf, sizeof(buf));
if (res < 0) {
if (errno != ELAST) {
@@ -7197,7 +7166,7 @@ static void *ss_thread(void *data)
ast_verb(3, "Detected ring pattern: %d,%d,%d\n",curRingData[0],curRingData[1],curRingData[2]);
for (counter = 0; counter < 3; counter++) {
- /* Check to see if the rings we received match any of the ones in zapata.conf for this
+ /* Check to see if the rings we received match any of the ones in chan_dahdi.conf for this
channel */
/* this only shows up if you have n of the dring patterns filled in */
ast_verb(3, "Checking %d,%d,%d\n",
@@ -7230,7 +7199,7 @@ static void *ss_thread(void *data)
}
}
/* Restore linear mode (if appropriate) for Caller*ID processing */
- zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
#if 1
restore_gains(p);
#endif
@@ -7265,11 +7234,11 @@ static void *ss_thread(void *data)
return NULL;
default:
ast_log(LOG_WARNING, "Don't know how to handle simple switch with signalling %s on channel %d\n", sig2str(p->sig), p->channel);
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", p->channel);
}
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", p->channel);
ast_hangup(chan);
@@ -7277,7 +7246,7 @@ static void *ss_thread(void *data)
}
struct mwi_thread_data {
- struct zt_pvt *pvt;
+ struct dahdi_pvt *pvt;
unsigned char buf[READ_SIZE];
size_t len;
};
@@ -7320,35 +7289,35 @@ static void *mwi_thread(void *data)
bump_gains(mtd->pvt);
for (;;) {
- i = ZT_IOMUX_READ | ZT_IOMUX_SIGEVENT;
- if ((res = ioctl(mtd->pvt->subs[SUB_REAL].zfd, ZT_IOMUX, &i))) {
+ i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
+ if ((res = ioctl(mtd->pvt->subs[SUB_REAL].zfd, DAHDI_IOMUX, &i))) {
ast_log(LOG_WARNING, "I/O MUX failed: %s\n", strerror(errno));
goto quit;
}
- if (i & ZT_IOMUX_SIGEVENT) {
+ if (i & DAHDI_IOMUX_SIGEVENT) {
struct ast_channel *chan;
/* If we get an event, screen out events that we do not act on.
* Otherwise, cancel and go to the simple switch to let it deal with it.
*/
- res = zt_get_event(mtd->pvt->subs[SUB_REAL].zfd);
+ res = dahdi_get_event(mtd->pvt->subs[SUB_REAL].zfd);
switch (res) {
-#ifdef HAVE_ZAPTEL_NEONMWI
- case ZT_EVENT_NEONMWI_ACTIVE:
- case ZT_EVENT_NEONMWI_INACTIVE:
+#ifdef HAVE_DAHDI_NEONMWI
+ case DAHDI_EVENT_NEONMWI_ACTIVE:
+ case DAHDI_EVENT_NEONMWI_INACTIVE:
#endif
- case ZT_EVENT_NONE:
- case ZT_EVENT_BITSCHANGED:
+ case DAHDI_EVENT_NONE:
+ case DAHDI_EVENT_BITSCHANGED:
break;
- case ZT_EVENT_NOALARM:
+ case DAHDI_EVENT_NOALARM:
mtd->pvt->inalarm = 0;
ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", mtd->pvt->channel);
manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
"Channel: %d\r\n", mtd->pvt->channel);
break;
- case ZT_EVENT_ALARM:
+ case DAHDI_EVENT_ALARM:
mtd->pvt->inalarm = 1;
res = get_alarms(mtd->pvt);
ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", mtd->pvt->channel, alarm2str(res));
@@ -7364,13 +7333,13 @@ static void *mwi_thread(void *data)
restore_gains(mtd->pvt);
mtd->pvt->ringt = mtd->pvt->ringt_base;
- if ((chan = zt_new(mtd->pvt, AST_STATE_RING, 0, SUB_REAL, 0, 0))) {
+ if ((chan = dahdi_new(mtd->pvt, AST_STATE_RING, 0, SUB_REAL, 0, 0))) {
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", mtd->pvt->channel);
- res = tone_zone_play_tone(mtd->pvt->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(mtd->pvt->subs[SUB_REAL].zfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", mtd->pvt->channel);
ast_hangup(chan);
@@ -7382,7 +7351,7 @@ static void *mwi_thread(void *data)
ast_log(LOG_WARNING, "Could not create channel to handle call\n");
}
}
- } else if (i & ZT_IOMUX_READ) {
+ } else if (i & DAHDI_IOMUX_READ) {
if ((res = read(mtd->pvt->subs[SUB_REAL].zfd, mtd->buf, sizeof(mtd->buf))) < 0) {
if (errno != ELAST) {
ast_log(LOG_WARNING, "read returned error: %s\n", strerror(errno));
@@ -7437,11 +7406,11 @@ quit_no_clean:
return NULL;
}
-/* destroy a Zaptel channel, identified by its number */
-static int zap_destroy_channel_bynum(int channel)
+/* destroy a DAHDI channel, identified by its number */
+static int dahdi_destroy_channel_bynum(int channel)
{
- struct zt_pvt *tmp = NULL;
- struct zt_pvt *prev = NULL;
+ struct dahdi_pvt *tmp = NULL;
+ struct dahdi_pvt *prev = NULL;
tmp = iflist;
while (tmp) {
@@ -7455,7 +7424,7 @@ static int zap_destroy_channel_bynum(int channel)
return RESULT_FAILURE;
}
-static int handle_init_event(struct zt_pvt *i, int event)
+static int handle_init_event(struct dahdi_pvt *i, int event)
{
int res;
pthread_t threadid;
@@ -7464,11 +7433,11 @@ static int handle_init_event(struct zt_pvt *i, int event)
/* Handle an event on a given channel for the monitor thread. */
switch (event) {
- case ZT_EVENT_NONE:
- case ZT_EVENT_BITSCHANGED:
+ case DAHDI_EVENT_NONE:
+ case DAHDI_EVENT_BITSCHANGED:
break;
- case ZT_EVENT_WINKFLASH:
- case ZT_EVENT_RINGOFFHOOK:
+ case DAHDI_EVENT_WINKFLASH:
+ case DAHDI_EVENT_RINGOFFHOOK:
if (i->inalarm) break;
if (i->radio) break;
/* Got a ring/answer. What kind of channel are we? */
@@ -7476,7 +7445,7 @@ static int handle_init_event(struct zt_pvt *i, int event)
case SIG_FXOLS:
case SIG_FXOGS:
case SIG_FXOKS:
- res = zt_set_hook(i->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+ res = dahdi_set_hook(i->subs[SUB_REAL].zfd, DAHDI_OFFHOOK);
if (res && (errno == EBUSY))
break;
if (i->cidspill) {
@@ -7485,29 +7454,29 @@ static int handle_init_event(struct zt_pvt *i, int event)
i->cidspill = NULL;
}
if (i->immediate) {
- zt_enable_ec(i);
+ dahdi_enable_ec(i);
/* The channel is immediately up. Start right away */
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_RINGTONE);
- chan = zt_new(i, AST_STATE_RING, 1, SUB_REAL, 0, 0);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, DAHDI_TONE_RINGTONE);
+ chan = dahdi_new(i, AST_STATE_RING, 1, SUB_REAL, 0, 0);
if (!chan) {
ast_log(LOG_WARNING, "Unable to start PBX on channel %d\n", i->channel);
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
}
} else {
/* Check for callerid, digits, etc */
- chan = zt_new(i, AST_STATE_RESERVED, 0, SUB_REAL, 0, 0);
+ chan = dahdi_new(i, AST_STATE_RESERVED, 0, SUB_REAL, 0, 0);
if (chan) {
if (has_voicemail(i))
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_STUTTER);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, DAHDI_TONE_STUTTER);
else
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_DIALTONE);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, DAHDI_TONE_DIALTONE);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play dialtone on channel %d, do you have defaultzone and loadzone defined?\n", i->channel);
if (ast_pthread_create_detached(&threadid, NULL, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
ast_hangup(chan);
@@ -7538,13 +7507,13 @@ static int handle_init_event(struct zt_pvt *i, int event)
case SIG_SF:
/* Check for callerid, digits, etc */
if (i->cid_start == CID_START_POLARITY_IN) {
- chan = zt_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0);
+ chan = dahdi_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0);
} else {
- chan = zt_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0);
+ chan = dahdi_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0);
}
if (chan && ast_pthread_create_detached(&threadid, NULL, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
ast_hangup(chan);
@@ -7554,19 +7523,19 @@ static int handle_init_event(struct zt_pvt *i, int event)
break;
default:
ast_log(LOG_WARNING, "Don't know how to handle ring/answer with signalling %s on channel %d\n", sig2str(i->sig), i->channel);
- res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, DAHDI_TONE_CONGESTION);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
return -1;
}
break;
- case ZT_EVENT_NOALARM:
+ case DAHDI_EVENT_NOALARM:
i->inalarm = 0;
ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", i->channel);
manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
"Channel: %d\r\n", i->channel);
break;
- case ZT_EVENT_ALARM:
+ case DAHDI_EVENT_ALARM:
i->inalarm = 1;
res = get_alarms(i);
ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", i->channel, alarm2str(res));
@@ -7575,7 +7544,7 @@ static int handle_init_event(struct zt_pvt *i, int event)
"Channel: %d\r\n",
alarm2str(res), i->channel);
/* fall thru intentionally */
- case ZT_EVENT_ONHOOK:
+ case DAHDI_EVENT_ONHOOK:
if (i->radio)
break;
/* Back on hook. Hang up. */
@@ -7601,26 +7570,26 @@ static int handle_init_event(struct zt_pvt *i, int event)
case SIG_FXSGS:
case SIG_FXSKS:
case SIG_GR303FXSKS:
- zt_disable_ec(i);
+ dahdi_disable_ec(i);
res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, -1);
- zt_set_hook(i->subs[SUB_REAL].zfd, ZT_ONHOOK);
+ dahdi_set_hook(i->subs[SUB_REAL].zfd, DAHDI_ONHOOK);
break;
case SIG_GR303FXOKS:
case SIG_FXOKS:
- zt_disable_ec(i);
+ dahdi_disable_ec(i);
/* Diddle the battery for the zhone */
#ifdef ZHONE_HACK
- zt_set_hook(i->subs[SUB_REAL].zfd, ZT_OFFHOOK);
+ dahdi_set_hook(i->subs[SUB_REAL].zfd, DAHDI_OFFHOOK);
usleep(1);
#endif
res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, -1);
- zt_set_hook(i->subs[SUB_REAL].zfd, ZT_ONHOOK);
+ dahdi_set_hook(i->subs[SUB_REAL].zfd, DAHDI_ONHOOK);
break;
case SIG_PRI:
case SIG_SS7:
case SIG_BRI:
case SIG_BRI_PTMP:
- zt_disable_ec(i);
+ dahdi_disable_ec(i);
res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, -1);
break;
default:
@@ -7629,7 +7598,7 @@ static int handle_init_event(struct zt_pvt *i, int event)
return -1;
}
break;
- case ZT_EVENT_POLARITY:
+ case DAHDI_EVENT_POLARITY:
switch (i->sig) {
case SIG_FXSLS:
case SIG_FXSKS:
@@ -7645,7 +7614,7 @@ static int handle_init_event(struct zt_pvt *i, int event)
ast_verb(2, "Starting post polarity "
"CID detection on channel %d\n",
i->channel);
- chan = zt_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0);
+ chan = dahdi_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0);
if (chan && ast_pthread_create_detached(&threadid, NULL, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
}
@@ -7657,20 +7626,20 @@ static int handle_init_event(struct zt_pvt *i, int event)
"interface %d\n", i->channel);
}
break;
- case ZT_EVENT_REMOVED: /* destroy channel */
+ case DAHDI_EVENT_REMOVED: /* destroy channel */
ast_log(LOG_NOTICE,
- "Got ZT_EVENT_REMOVED. Destroying channel %d\n",
+ "Got DAHDI_EVENT_REMOVED. Destroying channel %d\n",
i->channel);
- zap_destroy_channel_bynum(i->channel);
+ dahdi_destroy_channel_bynum(i->channel);
break;
-#ifdef HAVE_ZAPTEL_NEONMWI
- case ZT_EVENT_NEONMWI_ACTIVE:
+#ifdef HAVE_DAHDI_NEONMWI
+ case DAHDI_EVENT_NEONMWI_ACTIVE:
if (i->mwimonitor_neon) {
notify_message(i->mailbox, 1);
ast_log(LOG_NOTICE, "NEON MWI set for channel %d, mailbox %s \n", i->channel, i->mailbox);
}
break;
- case ZT_EVENT_NEONMWI_INACTIVE:
+ case DAHDI_EVENT_NEONMWI_INACTIVE:
if (i->mwimonitor_neon) {
notify_message(i->mailbox, 0);
ast_log(LOG_NOTICE, "NEON MWI cleared for channel %d, mailbox %s\n", i->channel, i->mailbox);
@@ -7684,8 +7653,8 @@ static int handle_init_event(struct zt_pvt *i, int event)
static void *do_monitor(void *data)
{
int count, res, res2, spoint, pollres=0;
- struct zt_pvt *i;
- struct zt_pvt *last = NULL;
+ struct dahdi_pvt *i;
+ struct dahdi_pvt *last = NULL;
time_t thispass = 0, lastpass = 0;
int found;
char buf[1024];
@@ -7718,7 +7687,7 @@ static void *do_monitor(void *data)
lastalloc = ifcount;
}
/* Build the stuff we're going to poll on, that is the socket of every
- zt_pvt that does not have an associated owner channel */
+ dahdi_pvt that does not have an associated owner channel */
count = 0;
i = iflist;
while (i) {
@@ -7764,24 +7733,24 @@ static void *do_monitor(void *data)
last = i;
if (last) {
if (!last->cidspill && !last->owner && !ast_strlen_zero(last->mailbox) && (thispass - last->onhooktime > 3) &&
- (last->sig & __ZT_SIG_FXO)) {
+ (last->sig & __DAHDI_SIG_FXO)) {
res = has_voicemail(last);
if (last->msgstate != res) {
int x;
ast_debug(1, "Message status for %s changed from %d to %d on %d\n", last->mailbox, last->msgstate, res, last->channel);
-#ifdef ZT_VMWI
- res2 = ioctl(last->subs[SUB_REAL].zfd, ZT_VMWI, res);
+#ifdef DAHDI_VMWI
+ res2 = ioctl(last->subs[SUB_REAL].zfd, DAHDI_VMWI, res);
if (res2)
ast_log(LOG_DEBUG, "Unable to control message waiting led on channel %d\n", last->channel);
#endif
- x = ZT_FLUSH_BOTH;
- res2 = ioctl(last->subs[SUB_REAL].zfd, ZT_FLUSH, &x);
+ x = DAHDI_FLUSH_BOTH;
+ res2 = ioctl(last->subs[SUB_REAL].zfd, DAHDI_FLUSH, &x);
if (res2)
ast_log(LOG_WARNING, "Unable to flush input on channel %d\n", last->channel);
if ((last->cidspill = ast_calloc(1, MAX_CALLERID_SIZE))) {
/* Turn on on hook transfer for 4 seconds */
x = 4000;
- ioctl(last->subs[SUB_REAL].zfd, ZT_ONHOOKTRANSFER, &x);
+ ioctl(last->subs[SUB_REAL].zfd, DAHDI_ONHOOKTRANSFER, &x);
last->cidlen = vmwi_generate(last->cidspill, res, 1, AST_LAW(last));
last->cidpos = 0;
last->msgstate = res;
@@ -7797,7 +7766,7 @@ static void *do_monitor(void *data)
if ((i->subs[SUB_REAL].zfd > -1) && i->sig) {
if (i->radio && !i->owner)
{
- res = zt_get_event(i->subs[SUB_REAL].zfd);
+ res = dahdi_get_event(i->subs[SUB_REAL].zfd);
if (res)
{
ast_debug(1, "Monitor doohicky got event %s on radio channel %d\n", event2str(res), i->channel);
@@ -7878,7 +7847,7 @@ static void *do_monitor(void *data)
i = i->next;
continue;
}
- res = zt_get_event(i->subs[SUB_REAL].zfd);
+ res = dahdi_get_event(i->subs[SUB_REAL].zfd);
ast_debug(1, "Monitor doohicky got event %s on channel %d\n", event2str(res), i->channel);
/* Don't hold iflock while handling init events */
ast_mutex_unlock(&iflock);
@@ -7922,7 +7891,7 @@ static int restart_monitor(void)
}
#ifdef HAVE_PRI
-static int pri_resolve_span(int *span, int channel, int offset, struct zt_spaninfo *si)
+static int pri_resolve_span(int *span, int channel, int offset, struct dahdi_spaninfo *si)
{
int x;
int trunkgroup;
@@ -7962,8 +7931,8 @@ static int pri_resolve_span(int *span, int channel, int offset, struct zt_spanin
static int pri_create_trunkgroup(int trunkgroup, int *channels)
{
- struct zt_spaninfo si;
- ZT_PARAMS p;
+ struct dahdi_spaninfo si;
+ DAHDI_PARAMS p;
int fd;
int span;
int ospan=0;
@@ -7979,35 +7948,35 @@ static int pri_create_trunkgroup(int trunkgroup, int *channels)
break;
memset(&si, 0, sizeof(si));
memset(&p, 0, sizeof(p));
- fd = open("/dev/zap/channel", O_RDWR);
+ fd = open("/dev/dahdi/channel", O_RDWR);
if (fd < 0) {
ast_log(LOG_WARNING, "Failed to open channel: %s\n", strerror(errno));
return -1;
}
x = channels[y];
- if (ioctl(fd, ZT_SPECIFY, &x)) {
+ if (ioctl(fd, DAHDI_SPECIFY, &x)) {
ast_log(LOG_WARNING, "Failed to specify channel %d: %s\n", channels[y], strerror(errno));
- zt_close(fd);
+ dahdi_close(fd);
return -1;
}
- if (ioctl(fd, ZT_GET_PARAMS, &p)) {
+ if (ioctl(fd, DAHDI_GET_PARAMS, &p)) {
ast_log(LOG_WARNING, "Failed to get channel parameters for channel %d: %s\n", channels[y], strerror(errno));
return -1;
}
- if (ioctl(fd, ZT_SPANSTAT, &si)) {
+ if (ioctl(fd, DAHDI_SPANSTAT, &si)) {
ast_log(LOG_WARNING, "Failed go get span information on channel %d (span %d)\n", channels[y], p.spanno);
- zt_close(fd);
+ dahdi_close(fd);
return -1;
}
span = p.spanno - 1;
if (pris[span].trunkgroup) {
ast_log(LOG_WARNING, "Span %d is already provisioned for trunk group %d\n", span + 1, pris[span].trunkgroup);
- zt_close(fd);
+ dahdi_close(fd);
return -1;
}
if (pris[span].pvts[0]) {
ast_log(LOG_WARNING, "Span %d is already provisioned with channels (implicit PRI maybe?)\n", span + 1);
- zt_close(fd);
+ dahdi_close(fd);
return -1;
}
if (!y) {
@@ -8018,7 +7987,7 @@ static int pri_create_trunkgroup(int trunkgroup, int *channels)
pris[ospan].dchannels[y] = channels[y];
pris[ospan].dchanavail[y] |= DCHAN_PROVISIONED;
pris[span].span = span + 1;
- zt_close(fd);
+ dahdi_close(fd);
}
return 0;
}
@@ -8052,7 +8021,7 @@ static unsigned int parse_pointcode(const char *pcstring)
return 0;
}
-static struct zt_ss7 * ss7_resolve_linkset(int linkset)
+static struct dahdi_ss7 * ss7_resolve_linkset(int linkset)
{
if ((linkset < 0) || (linkset >= NUM_SPANS))
return NULL;
@@ -8061,8 +8030,8 @@ static struct zt_ss7 * ss7_resolve_linkset(int linkset)
}
#endif /* HAVE_SS7 */
-/* converts a Zaptel sigtype to signalling as can be configured from
- * zapata.conf.
+/* converts a DAHDI sigtype to signalling as can be configured from
+ * chan_dahdi.conf.
* While both have basically the same values, this will later be the
* place to add filters and sanity checks
*/
@@ -8071,23 +8040,23 @@ static int sigtype_to_signalling(int sigtype)
return sigtype;
}
-static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struct zt_pri *pri, int reloading)
+static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf, struct dahdi_pri *pri, int reloading)
{
- /* Make a zt_pvt structure for this interface (or CRV if "pri" is specified) */
- struct zt_pvt *tmp = NULL, *tmp2, *prev = NULL;
+ /* Make a dahdi_pvt structure for this interface (or CRV if "pri" is specified) */
+ struct dahdi_pvt *tmp = NULL, *tmp2, *prev = NULL;
char fn[80];
#if 1
- struct zt_bufferinfo bi;
+ struct dahdi_bufferinfo bi;
#endif
- struct zt_spaninfo si;
+ struct dahdi_spaninfo si;
int res;
int span = 0;
int here = 0;
int x;
- struct zt_pvt **wlist;
- struct zt_pvt **wend;
- ZT_PARAMS p;
+ struct dahdi_pvt **wlist;
+ struct dahdi_pvt **wend;
+ DAHDI_PARAMS p;
wlist = &iflist;
wend = &ifend;
@@ -8119,7 +8088,7 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
if (!here && !reloading) {
if (!(tmp = ast_calloc(1, sizeof(*tmp)))) {
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
ast_mutex_init(&tmp->lock);
@@ -8136,25 +8105,25 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
snprintf(fn, sizeof(fn), "%d", channel);
/* Open non-blocking */
if (!here)
- tmp->subs[SUB_REAL].zfd = zt_open(fn);
- /* Allocate a zapata structure */
+ tmp->subs[SUB_REAL].zfd = dahdi_open(fn);
+ /* Allocate a dahdi structure */
if (tmp->subs[SUB_REAL].zfd < 0) {
ast_log(LOG_ERROR, "Unable to open channel %d: %s\nhere = %d, tmp->channel = %d, channel = %d\n", channel, strerror(errno), here, tmp->channel, channel);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
memset(&p, 0, sizeof(p));
- res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &p);
+ res = ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &p);
if (res < 0) {
ast_log(LOG_ERROR, "Unable to get parameters\n");
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (conf->is_sig_auto)
chan_sig = sigtype_to_signalling(p.sigtype);
if (p.sigtype != (conf->chan.sig & 0x3ffff)) {
ast_log(LOG_ERROR, "Signalling requested on channel %d is %s but line is in %s signalling\n", channel, sig2str(conf->chan.sig), sig2str(p.sigtype));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
tmp->law = p.curlaw;
@@ -8169,24 +8138,24 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
}
}
#ifdef HAVE_SS7
- if (chan_sig == SIG_SS7) {
- struct zt_ss7 *ss7;
+ if (conf->chan.sig == SIG_SS7) {
+ struct dahdi_ss7 *ss7;
int clear = 0;
- if (ioctl(tmp->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &clear)) {
+ if (ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_AUDIOMODE, &clear)) {
ast_log(LOG_ERROR, "Unable to set clear mode on clear channel %d of span %d: %s\n", channel, p.spanno, strerror(errno));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
ss7 = ss7_resolve_linkset(cur_linkset);
if (!ss7) {
ast_log(LOG_ERROR, "Unable to find linkset %d\n", cur_linkset);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (cur_cicbeginswith < 0) {
ast_log(LOG_ERROR, "Need to set cicbeginswith for the channels!\n");
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
@@ -8209,27 +8178,27 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
}
#endif
#ifdef HAVE_PRI
- if ((chan_sig == SIG_PRI) || (chan_sig == SIG_BRI) || (chan_sig == SIG_BRI_PTMP) || (chan_sig == SIG_GR303FXOKS) || (chan_sig == SIG_GR303FXSKS)) {
+ if ((conf->chan.sig == SIG_PRI) || (conf->chan.sig == SIG_BRI) || (conf->chan.sig == SIG_BRI_PTMP) || (conf->chan.sig == SIG_GR303FXOKS) || (conf->chan.sig == SIG_GR303FXSKS)) {
int offset;
int myswitchtype;
int matchesdchan;
int x,y;
offset = 0;
- if (((chan_sig == SIG_PRI) || (chan_sig == SIG_BRI) || (chan_sig == SIG_BRI_PTMP))
- && ioctl(tmp->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &offset)) {
+ if (((conf->chan.sig == SIG_PRI) || (conf->chan.sig == SIG_BRI) || (conf->chan.sig == SIG_BRI_PTMP))
+ && ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_AUDIOMODE, &offset)) {
ast_log(LOG_ERROR, "Unable to set clear mode on clear channel %d of span %d: %s\n", channel, p.spanno, strerror(errno));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (span >= NUM_SPANS) {
ast_log(LOG_ERROR, "Channel %d does not lie on a span I know of (%d)\n", channel, span);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
} else {
si.spanno = 0;
- if (ioctl(tmp->subs[SUB_REAL].zfd,ZT_SPANSTAT,&si) == -1) {
+ if (ioctl(tmp->subs[SUB_REAL].zfd,DAHDI_SPANSTAT,&si) == -1) {
ast_log(LOG_ERROR, "Unable to get span status: %s\n", strerror(errno));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
/* Store the logical span first based upon the real span */
@@ -8237,12 +8206,12 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
pri_resolve_span(&span, channel, (channel - p.chanpos), &si);
if (span < 0) {
ast_log(LOG_WARNING, "Channel %d: Unable to find locate channel/trunk group!\n", channel);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
- if ((chan_sig == SIG_PRI) ||
- (chan_sig == SIG_BRI) ||
- (chan_sig == SIG_BRI_PTMP))
+ if ((conf->chan.sig == SIG_PRI) ||
+ (conf->chan.sig == SIG_BRI) ||
+ (conf->chan.sig == SIG_BRI_PTMP))
myswitchtype = conf->pri.switchtype;
else
myswitchtype = PRI_SWITCH_GR303_TMC;
@@ -8260,43 +8229,43 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
if (!matchesdchan) {
if (pris[span].nodetype && (pris[span].nodetype != conf->pri.nodetype)) {
ast_log(LOG_ERROR, "Span %d is already a %s node\n", span + 1, pri_node2str(pris[span].nodetype));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (pris[span].switchtype && (pris[span].switchtype != myswitchtype)) {
ast_log(LOG_ERROR, "Span %d is already a %s switch\n", span + 1, pri_switch2str(pris[span].switchtype));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if ((pris[span].dialplan) && (pris[span].dialplan != conf->pri.dialplan)) {
ast_log(LOG_ERROR, "Span %d is already a %s dialing plan\n", span + 1, dialplan2str(pris[span].dialplan));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (!ast_strlen_zero(pris[span].idledial) && strcmp(pris[span].idledial, conf->pri.idledial)) {
ast_log(LOG_ERROR, "Span %d already has idledial '%s'.\n", span + 1, conf->pri.idledial);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (!ast_strlen_zero(pris[span].idleext) && strcmp(pris[span].idleext, conf->pri.idleext)) {
ast_log(LOG_ERROR, "Span %d already has idleext '%s'.\n", span + 1, conf->pri.idleext);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (pris[span].minunused && (pris[span].minunused != conf->pri.minunused)) {
ast_log(LOG_ERROR, "Span %d already has minunused of %d.\n", span + 1, conf->pri.minunused);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (pris[span].minidle && (pris[span].minidle != conf->pri.minidle)) {
ast_log(LOG_ERROR, "Span %d already has minidle of %d.\n", span + 1, conf->pri.minidle);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (pris[span].numchans >= MAX_CHANNELS) {
ast_log(LOG_ERROR, "Unable to add channel %d: Too many channels in trunk group %d!\n", channel,
pris[span].trunkgroup);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
@@ -8325,7 +8294,7 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
tmp->call = NULL;
} else {
ast_log(LOG_ERROR, "Channel %d is reserved for D-channel.\n", offset);
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
}
@@ -8337,7 +8306,7 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
chan_sig = tmp->sig;
memset(&p, 0, sizeof(p));
if (tmp->subs[SUB_REAL].zfd > -1)
- res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &p);
+ res = ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &p);
}
/* Adjust starttime on loopstart and kewlstart trunks to reasonable values */
switch (chan_sig) {
@@ -8394,22 +8363,22 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
/* dont set parms on a pseudo-channel (or CRV) */
if (tmp->subs[SUB_REAL].zfd >= 0)
{
- res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_SET_PARAMS, &p);
+ res = ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_SET_PARAMS, &p);
if (res < 0) {
ast_log(LOG_ERROR, "Unable to set parameters\n");
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
}
#if 1
if (!here && (tmp->subs[SUB_REAL].zfd > -1)) {
memset(&bi, 0, sizeof(bi));
- res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_GET_BUFINFO, &bi);
+ res = ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_GET_BUFINFO, &bi);
if (!res) {
- bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+ bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+ bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = numbufs;
- res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_SET_BUFINFO, &bi);
+ res = ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_SET_BUFINFO, &bi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set buffer policy on channel %d\n", channel);
}
@@ -8419,7 +8388,7 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
#endif
tmp->immediate = conf->chan.immediate;
tmp->transfertobusy = conf->chan.transfertobusy;
- if (conf->chan.sig & __ZT_SIG_FXS) {
+ if (conf->chan.sig & __DAHDI_SIG_FXS) {
tmp->mwimonitor_fsk = conf->chan.mwimonitor_fsk;
tmp->mwimonitor_neon = conf->chan.mwimonitor_neon;
}
@@ -8453,11 +8422,7 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
tmp->echocancel = conf->chan.echocancel;
tmp->echotraining = conf->chan.echotraining;
tmp->pulse = conf->chan.pulse;
-#if defined(HAVE_ZAPTEL_ECHOCANPARAMS)
if (tmp->echocancel.head.tap_length) {
-#else
- if (tmp->echocancel) {
-#endif
tmp->echocanbridged = conf->chan.echocanbridged;
} else {
if (conf->chan.echocanbridged)
@@ -8478,7 +8443,7 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
tmp->use_callerid = conf->chan.use_callerid;
tmp->cid_signalling = conf->chan.cid_signalling;
tmp->cid_start = conf->chan.cid_start;
- tmp->zaptrcallerid = conf->chan.zaptrcallerid;
+ tmp->dahditrcallerid = conf->chan.dahditrcallerid;
tmp->restrictcid = conf->chan.restrictcid;
tmp->use_callingpres = conf->chan.use_callingpres;
tmp->priindication_oob = conf->chan.priindication_oob;
@@ -8554,9 +8519,9 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
if (!here) {
if ((chan_sig != SIG_BRI) && (chan_sig != SIG_BRI_PTMP) && (chan_sig != SIG_PRI) && (chan_sig != SIG_SS7))
/* Hang it up to be sure it's good */
- zt_set_hook(tmp->subs[SUB_REAL].zfd, ZT_ONHOOK);
+ dahdi_set_hook(tmp->subs[SUB_REAL].zfd, DAHDI_ONHOOK);
}
- ioctl(tmp->subs[SUB_REAL].zfd,ZT_SETTONEZONE,&tmp->tonezone);
+ ioctl(tmp->subs[SUB_REAL].zfd,DAHDI_SETTONEZONE,&tmp->tonezone);
#ifdef HAVE_PRI
/* the dchannel is down so put the channel in alarm */
if (tmp->pri && !pri_is_up(tmp->pri))
@@ -8565,9 +8530,9 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
tmp->inalarm = 0;
#endif
memset(&si, 0, sizeof(si));
- if (ioctl(tmp->subs[SUB_REAL].zfd,ZT_SPANSTAT,&si) == -1) {
+ if (ioctl(tmp->subs[SUB_REAL].zfd,DAHDI_SPANSTAT,&si) == -1) {
ast_log(LOG_ERROR, "Unable to get span status: %s\n", strerror(errno));
- destroy_zt_pvt(&tmp);
+ destroy_dahdi_pvt(&tmp);
return NULL;
}
if (si.alarms) tmp->inalarm = 1;
@@ -8594,7 +8559,7 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
*wend = tmp;
} else {
/* at least one member on the iflist */
- struct zt_pvt *working = *wlist;
+ struct dahdi_pvt *working = *wlist;
/* check if we maybe have to put it on the begining */
if (working->channel > tmp->channel) {
@@ -8632,10 +8597,10 @@ static struct zt_pvt *mkintf(int channel, const struct zt_chan_conf *conf, struc
return tmp;
}
-static inline int available(struct zt_pvt *p, int channelmatch, ast_group_t groupmatch, int *busy, int *channelmatched, int *groupmatched)
+static inline int available(struct dahdi_pvt *p, int channelmatch, ast_group_t groupmatch, int *busy, int *channelmatched, int *groupmatched)
{
int res;
- ZT_PARAMS par;
+ DAHDI_PARAMS par;
/* First, check group matching */
if (groupmatch) {
@@ -8690,7 +8655,7 @@ static inline int available(struct zt_pvt *p, int channelmatch, ast_group_t grou
return 1;
/* Check hook state */
if (p->subs[SUB_REAL].zfd > -1)
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &par);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &par);
else {
/* Assume not off hook on CVRS */
res = 0;
@@ -8707,7 +8672,7 @@ static inline int available(struct zt_pvt *p, int channelmatch, ast_group_t grou
if (par.rxisoffhook)
return 1;
else
-#ifdef ZAP_CHECK_HOOKSTATE
+#ifdef DAHDI_CHECK_HOOKSTATE
return 0;
#else
return 1;
@@ -8748,28 +8713,28 @@ static inline int available(struct zt_pvt *p, int channelmatch, ast_group_t grou
return 1;
}
-static struct zt_pvt *chandup(struct zt_pvt *src)
+static struct dahdi_pvt *chandup(struct dahdi_pvt *src)
{
- struct zt_pvt *p;
- ZT_BUFFERINFO bi;
+ struct dahdi_pvt *p;
+ DAHDI_BUFFERINFO bi;
int res;
if ((p = ast_malloc(sizeof(*p)))) {
- memcpy(p, src, sizeof(struct zt_pvt));
+ memcpy(p, src, sizeof(struct dahdi_pvt));
ast_mutex_init(&p->lock);
- p->subs[SUB_REAL].zfd = zt_open("/dev/zap/pseudo");
- /* Allocate a zapata structure */
+ p->subs[SUB_REAL].zfd = dahdi_open("/dev/dahdi/pseudo");
+ /* Allocate a dahdi structure */
if (p->subs[SUB_REAL].zfd < 0) {
ast_log(LOG_ERROR, "Unable to dup channel: %s\n", strerror(errno));
- destroy_zt_pvt(&p);
+ destroy_dahdi_pvt(&p);
return NULL;
}
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_GET_BUFINFO, &bi);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_GET_BUFINFO, &bi);
if (!res) {
- bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+ bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+ bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = numbufs;
- res = ioctl(p->subs[SUB_REAL].zfd, ZT_SET_BUFINFO, &bi);
+ res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_SET_BUFINFO, &bi);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set buffer policy on dup channel\n");
}
@@ -8787,7 +8752,7 @@ static struct zt_pvt *chandup(struct zt_pvt *src)
#ifdef HAVE_PRI
-static int pri_find_empty_chan(struct zt_pri *pri, int backwards)
+static int pri_find_empty_chan(struct dahdi_pri *pri, int backwards)
{
int x;
if (backwards)
@@ -8813,14 +8778,14 @@ static int pri_find_empty_chan(struct zt_pri *pri, int backwards)
}
#endif
-static struct ast_channel *zt_request(const char *type, int format, void *data, int *cause)
+static struct ast_channel *dahdi_request(const char *type, int format, void *data, int *cause)
{
ast_group_t groupmatch = 0;
int channelmatch = -1;
int roundrobin = 0;
int callwait = 0;
int busy = 0;
- struct zt_pvt *p;
+ struct dahdi_pvt *p;
struct ast_channel *tmp = NULL;
char *dest=NULL;
int x;
@@ -8832,9 +8797,9 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
int crv;
int bearer = -1;
int trunkgroup;
- struct zt_pri *pri=NULL;
+ struct dahdi_pri *pri=NULL;
#endif
- struct zt_pvt *exit, *start, *end;
+ struct dahdi_pvt *exit, *start, *end;
ast_mutex_t *lock;
int channelmatched = 0;
int groupmatched = 0;
@@ -8972,7 +8937,7 @@ static struct ast_channel *zt_request(const char *type, int format, void *data,
}
}
p->outgoing = 1;
- tmp = zt_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0);
+ tmp = dahdi_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0);
#ifdef HAVE_PRI
if (p->bearer) {
/* Log owner to bearer channel, too */
@@ -9035,15 +9000,15 @@ next:
}
#if defined(HAVE_PRI) || defined(HAVE_SS7)
-static int zt_setlaw(int zfd, int law)
+static int dahdi_setlaw(int zfd, int law)
{
- return ioctl(zfd, ZT_SETLAW, &law);
+ return ioctl(zfd, DAHDI_SETLAW, &law);
}
#endif
#ifdef HAVE_SS7
-static int ss7_find_cic(struct zt_ss7 *linkset, int cic, unsigned int dpc)
+static int ss7_find_cic(struct dahdi_ss7 *linkset, int cic, unsigned int dpc)
{
int i;
int winner = -1;
@@ -9056,10 +9021,10 @@ static int ss7_find_cic(struct zt_ss7 *linkset, int cic, unsigned int dpc)
return winner;
}
-static void ss7_handle_cqm(struct zt_ss7 *linkset, int startcic, int endcic, unsigned int dpc)
+static void ss7_handle_cqm(struct dahdi_ss7 *linkset, int startcic, int endcic, unsigned int dpc)
{
unsigned char status[32];
- struct zt_pvt *p = NULL;
+ struct dahdi_pvt *p = NULL;
int i, offset;
for (i = 0; i < linkset->numchans; i++) {
@@ -9088,7 +9053,7 @@ static void ss7_handle_cqm(struct zt_ss7 *linkset, int startcic, int endcic, uns
}
-static inline void ss7_block_cics(struct zt_ss7 *linkset, int startcic, int endcic, unsigned int dpc, unsigned char state[], int block)
+static inline void ss7_block_cics(struct dahdi_ss7 *linkset, int startcic, int endcic, unsigned int dpc, unsigned char state[], int block)
{
int i;
@@ -9103,7 +9068,7 @@ static inline void ss7_block_cics(struct zt_ss7 *linkset, int startcic, int endc
}
}
-static void ss7_inservice(struct zt_ss7 *linkset, int startcic, int endcic, unsigned int dpc)
+static void ss7_inservice(struct dahdi_ss7 *linkset, int startcic, int endcic, unsigned int dpc)
{
int i;
@@ -9113,7 +9078,7 @@ static void ss7_inservice(struct zt_ss7 *linkset, int startcic, int endcic, unsi
}
}
-static void ss7_reset_linkset(struct zt_ss7 *linkset)
+static void ss7_reset_linkset(struct dahdi_ss7 *linkset)
{
int i, startcic = -1, endcic, dpc;
@@ -9141,10 +9106,10 @@ static void ss7_reset_linkset(struct zt_ss7 *linkset)
}
}
-static void zt_loopback(struct zt_pvt *p, int enable)
+static void dahdi_loopback(struct dahdi_pvt *p, int enable)
{
if (p->loopedback != enable) {
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_LOOPBACK, &enable)) {
+ if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_LOOPBACK, &enable)) {
ast_log(LOG_WARNING, "Unable to set loopback on channel %d\n", p->channel);
return;
}
@@ -9153,7 +9118,7 @@ static void zt_loopback(struct zt_pvt *p, int enable)
}
/* XXX: This function is assumed to be called with the private channel lock and linkset lock held */
-static void ss7_start_call(struct zt_pvt *p, struct zt_ss7 *linkset)
+static void ss7_start_call(struct dahdi_pvt *p, struct dahdi_ss7 *linkset)
{
struct ss7 *ss7 = linkset->ss7;
int res;
@@ -9161,15 +9126,15 @@ static void ss7_start_call(struct zt_pvt *p, struct zt_ss7 *linkset)
struct ast_channel *c;
char tmp[256];
- if (ioctl(p->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &law) == -1)
+ if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_AUDIOMODE, &law) == -1)
ast_log(LOG_WARNING, "Unable to set audio mode on channel %d to %d\n", p->channel, law);
if (linkset->type == SS7_ITU)
- law = ZT_LAW_ALAW;
+ law = DAHDI_LAW_ALAW;
else
- law = ZT_LAW_MULAW;
+ law = DAHDI_LAW_MULAW;
- res = zt_setlaw(p->subs[SUB_REAL].zfd, law);
+ res = dahdi_setlaw(p->subs[SUB_REAL].zfd, law);
if (res < 0)
ast_log(LOG_WARNING, "Unable to set law on channel %d\n", p->channel);
@@ -9177,7 +9142,7 @@ static void ss7_start_call(struct zt_pvt *p, struct zt_ss7 *linkset)
isup_acm(ss7, p->ss7call);
ast_mutex_unlock(&linkset->lock);
- c = zt_new(p, AST_STATE_RING, 1, SUB_REAL, law, 0);
+ c = dahdi_new(p, AST_STATE_RING, 1, SUB_REAL, law, 0);
if (!c) {
ast_log(LOG_WARNING, "Unable to start PBX on CIC %d\n", p->cic);
@@ -9187,7 +9152,7 @@ static void ss7_start_call(struct zt_pvt *p, struct zt_ss7 *linkset)
} else
ast_verb(3, "Accepting call to '%s' on CIC %d\n", p->exten, p->cic);
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
/* We only reference these variables in the context of the ss7_linkset function
* when receiving either and IAM or a COT message. Since they are only accessed
@@ -9267,7 +9232,7 @@ static void ss7_start_call(struct zt_pvt *p, struct zt_ss7 *linkset)
ast_mutex_lock(&linkset->lock);
}
-static void ss7_apply_plan_to_number(char *buf, size_t size, const struct zt_ss7 *ss7, const char *number, const unsigned nai)
+static void ss7_apply_plan_to_number(char *buf, size_t size, const struct dahdi_ss7 *ss7, const char *number, const unsigned nai)
{
switch (nai) {
case SS7_NAI_INTERNATIONAL:
@@ -9296,10 +9261,10 @@ static void *ss7_linkset(void *data)
{
int res, i;
struct timeval *next = NULL, tv;
- struct zt_ss7 *linkset = (struct zt_ss7 *) data;
+ struct dahdi_ss7 *linkset = (struct dahdi_ss7 *) data;
struct ss7 *ss7 = linkset->ss7;
ss7_event *e = NULL;
- struct zt_pvt *p;
+ struct dahdi_pvt *p;
int chanpos;
struct pollfd pollers[NUM_DCHANS];
int cic;
@@ -9347,26 +9312,26 @@ static void *ss7_linkset(void *data)
for (i = 0; i < linkset->numsigchans; i++) {
if (pollers[i].revents & POLLPRI) {
int x;
- if (ioctl(pollers[i].fd, ZT_GETEVENT, &x)) {
+ if (ioctl(pollers[i].fd, DAHDI_GETEVENT, &x)) {
ast_log(LOG_ERROR, "Error in exception retrieval!\n");
}
switch (x) {
- case ZT_EVENT_OVERRUN:
+ case DAHDI_EVENT_OVERRUN:
ast_debug(1, "Overrun detected!\n");
break;
- case ZT_EVENT_BADFCS:
+ case DAHDI_EVENT_BADFCS:
ast_debug(1, "Bad FCS\n");
break;
- case ZT_EVENT_ABORT:
+ case DAHDI_EVENT_ABORT:
ast_debug(1, "HDLC Abort\n");
break;
- case ZT_EVENT_ALARM:
+ case DAHDI_EVENT_ALARM:
ast_log(LOG_ERROR, "Alarm on link!\n");
linkset->linkstate[i] |= (LINKSTATE_DOWN | LINKSTATE_INALARM);
linkset->linkstate[i] &= ~LINKSTATE_UP;
ss7_link_alarm(ss7, pollers[i].fd);
break;
- case ZT_EVENT_NOALARM:
+ case DAHDI_EVENT_NOALARM:
ast_log(LOG_ERROR, "Alarm cleared on link\n");
linkset->linkstate[i] &= ~(LINKSTATE_INALARM | LINKSTATE_DOWN);
linkset->linkstate[i] |= LINKSTATE_STARTING;
@@ -9407,7 +9372,7 @@ static void *ss7_linkset(void *data)
ast_verbose("--- SS7 Down ---\n");
linkset->state = LINKSET_STATE_DOWN;
for (i = 0; i < linkset->numchans; i++) {
- struct zt_pvt *p = linkset->pvts[i];
+ struct dahdi_pvt *p = linkset->pvts[i];
if (p)
p->inalarm = 1;
}
@@ -9433,7 +9398,7 @@ static void *ss7_linkset(void *data)
{
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, };
ast_debug(1, "Queuing frame PROGRESS on CIC %d\n", p->cic);
- zap_queue_frame(p, &f, linkset);
+ dahdi_queue_frame(p, &f, linkset);
p->progress = 1;
if (p->dsp && p->dsp_features) {
ast_dsp_set_features(p->dsp, p->dsp_features);
@@ -9456,18 +9421,11 @@ static void *ss7_linkset(void *data)
}
p = linkset->pvts[chanpos];
ast_mutex_lock(&p->lock);
-
p->inservice = 1;
p->remotelyblocked = 0;
dpc = p->dpc;
isup_set_call_dpc(e->rsc.call, dpc);
- if (p->ss7call)
- p->ss7call = NULL;
- if (p->owner)
- p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
-
ast_mutex_unlock(&p->lock);
-
isup_rlc(ss7, e->rsc.call);
break;
case ISUP_EVENT_GRS:
@@ -9564,7 +9522,7 @@ static void *ss7_linkset(void *data)
if (ast_exists_extension(NULL, p->context, p->exten, 1, p->cid_num)) {
if (e->iam.cot_check_required) {
- zt_loopback(p, 1);
+ dahdi_loopback(p, 1);
} else
ss7_start_call(p, linkset);
} else {
@@ -9585,7 +9543,7 @@ static void *ss7_linkset(void *data)
ast_mutex_lock(&p->lock);
if (p->loopedback) {
- zt_loopback(p, 0);
+ dahdi_loopback(p, 0);
ss7_start_call(p, linkset);
}
@@ -9603,7 +9561,7 @@ static void *ss7_linkset(void *data)
p = linkset->pvts[chanpos];
ast_mutex_lock(&p->lock);
- zt_loopback(p, 1);
+ dahdi_loopback(p, 1);
ast_mutex_unlock(&p->lock);
isup_lpa(linkset->ss7, e->ccr.cic, p->dpc);
@@ -9619,7 +9577,7 @@ static void *ss7_linkset(void *data)
p = linkset->pvts[chanpos];
ast_mutex_lock(&p->lock);
- zt_loopback(p, 1);
+ dahdi_loopback(p, 1);
ast_mutex_unlock(&p->lock);
isup_cvr(linkset->ss7, e->cvt.cic, p->dpc);
@@ -9639,7 +9597,7 @@ static void *ss7_linkset(void *data)
ast_log(LOG_WARNING, "REL on channel (CIC %d) without owner!\n", p->cic);
/* End the loopback if we have one */
- zt_loopback(p, 0);
+ dahdi_loopback(p, 0);
isup_rlc(ss7, e->rel.call);
p->ss7call = NULL;
@@ -9664,7 +9622,7 @@ static void *ss7_linkset(void *data)
}
ast_mutex_lock(&p->lock);
- zap_queue_frame(p, &f, linkset);
+ dahdi_queue_frame(p, &f, linkset);
p->proceeding = 1;
/* Send alerting if subscriber is free */
if (e->acm.called_party_status_ind == 1) {
@@ -9777,7 +9735,7 @@ static void *ss7_linkset(void *data)
ast_dsp_set_features(p->dsp, p->dsp_features);
p->dsp_features = 0;
}
- zt_enable_ec(p);
+ dahdi_enable_ec(p);
ast_mutex_unlock(&p->lock);
}
break;
@@ -9823,7 +9781,7 @@ static void *ss7_linkset(void *data)
return 0;
}
-static void zt_ss7_message(struct ss7 *ss7, char *s)
+static void dahdi_ss7_message(struct ss7 *ss7, char *s)
{
#if 0
int i;
@@ -9838,7 +9796,7 @@ static void zt_ss7_message(struct ss7 *ss7, char *s)
#endif
}
-static void zt_ss7_error(struct ss7 *ss7, char *s)
+static void dahdi_ss7_error(struct ss7 *ss7, char *s)
{
#if 0
int i;
@@ -9855,9 +9813,9 @@ static void zt_ss7_error(struct ss7 *ss7, char *s)
#endif /* HAVE_SS7 */
#ifdef HAVE_PRI
-static struct zt_pvt *pri_find_crv(struct zt_pri *pri, int crv)
+static struct dahdi_pvt *pri_find_crv(struct dahdi_pri *pri, int crv)
{
- struct zt_pvt *p;
+ struct dahdi_pvt *p;
p = pri->crvs;
while (p) {
if (p->channel == crv)
@@ -9868,19 +9826,19 @@ static struct zt_pvt *pri_find_crv(struct zt_pri *pri, int crv)
}
-static int pri_find_principle(struct zt_pri *pri, int channel)
+static int pri_find_principle(struct dahdi_pri *pri, int channel)
{
int x;
int span = PRI_SPAN(channel);
int spanfd;
- ZT_PARAMS param;
+ DAHDI_PARAMS param;
int principle = -1;
int explicit = PRI_EXPLICIT(channel);
channel = PRI_CHANNEL(channel);
if (!explicit) {
spanfd = pri_active_dchan_fd(pri);
- if (ioctl(spanfd, ZT_GET_PARAMS, &param))
+ if (ioctl(spanfd, DAHDI_GET_PARAMS, &param))
return -1;
span = pris[param.spanno - 1].prilogicalspan;
}
@@ -9895,10 +9853,10 @@ static int pri_find_principle(struct zt_pri *pri, int channel)
return principle;
}
-static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
+static int pri_fixup_principle(struct dahdi_pri *pri, int principle, q931_call *c)
{
int x;
- struct zt_pvt *crv;
+ struct dahdi_pvt *crv;
if (!c) {
if (principle < 0)
return -1;
@@ -9916,7 +9874,7 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
if (pri->pvts[x]->call == c) {
/* Found our call */
if (principle != x) {
- struct zt_pvt *new = pri->pvts[principle], *old = pri->pvts[x];
+ struct dahdi_pvt *new = pri->pvts[principle], *old = pri->pvts[x];
ast_verb(3, "Moving call from channel %d to channel %d\n",
old->channel, new->channel);
@@ -9930,7 +9888,7 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
old->owner = NULL;
if (new->owner) {
ast_string_field_build(new->owner, name,
- "Zap/%d:%d-%d", pri->trunkgroup,
+ "DAHDI/%d:%d-%d", pri->trunkgroup,
new->channel, 1);
new->owner->tech_pvt = new;
ast_channel_set_fd(new->owner, 0, new->subs[SUB_REAL].zfd);
@@ -9962,7 +9920,7 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
else {
/* Looks good. Drop the pseudo channel now, clear up the assignment, and
wakeup the potential sleeper */
- zt_close(crv->subs[SUB_REAL].zfd);
+ dahdi_close(crv->subs[SUB_REAL].zfd);
pri->pvts[principle]->call = crv->call;
pri_assign_bearer(crv, pri, pri->pvts[principle]);
ast_debug(1, "Assigning bearer %d/%d to CRV %d:%d\n",
@@ -9981,7 +9939,7 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
static void *do_idle_thread(void *vchan)
{
struct ast_channel *chan = vchan;
- struct zt_pvt *pvt = chan->tech_pvt;
+ struct dahdi_pvt *pvt = chan->tech_pvt;
struct ast_frame *f;
char ex[80];
/* Wait up to 30 seconds for an answer */
@@ -10029,7 +9987,7 @@ static void *do_idle_thread(void *vchan)
#ifndef PRI_RESTART
#error "Upgrade your libpri"
#endif
-static void zt_pri_message(struct pri *pri, char *s)
+static void dahdi_pri_message(struct pri *pri, char *s)
{
int x, y;
int dchan = -1, span = -1;
@@ -10065,7 +10023,7 @@ static void zt_pri_message(struct pri *pri, char *s)
ast_mutex_unlock(&pridebugfdlock);
}
-static void zt_pri_error(struct pri *pri, char *s)
+static void dahdi_pri_error(struct pri *pri, char *s)
{
int x, y;
int dchan = -1, span = -1;
@@ -10101,7 +10059,7 @@ static void zt_pri_error(struct pri *pri, char *s)
ast_mutex_unlock(&pridebugfdlock);
}
-static int pri_check_restart(struct zt_pri *pri)
+static int pri_check_restart(struct dahdi_pri *pri)
{
do {
pri->resetpos++;
@@ -10120,7 +10078,7 @@ static int pri_check_restart(struct zt_pri *pri)
return 0;
}
-static int pri_hangup_all(struct zt_pvt *p, struct zt_pri *pri)
+static int pri_hangup_all(struct dahdi_pvt *p, struct dahdi_pri *pri)
{
int x;
int redo;
@@ -10160,7 +10118,7 @@ static char * redirectingreason2str(int redirectingreason)
}
}
-static void apply_plan_to_number(char *buf, size_t size, const struct zt_pri *pri, const char *number, const int plan)
+static void apply_plan_to_number(char *buf, size_t size, const struct dahdi_pri *pri, const char *number, const int plan)
{
if (pri->dialplan == -2) { /* autodetect the TON but leave the number untouched */
snprintf(buf, size, "%s", number);
@@ -10191,7 +10149,7 @@ static void apply_plan_to_number(char *buf, size_t size, const struct zt_pri *pr
static void *pri_dchannel(void *vpri)
{
- struct zt_pri *pri = vpri;
+ struct dahdi_pri *pri = vpri;
pri_event *e;
struct pollfd fds[NUM_DCHANS];
int res;
@@ -10212,7 +10170,7 @@ static void *pri_dchannel(void *vpri)
int i, which=-1;
int numdchans;
int cause=0;
- struct zt_pvt *crv;
+ struct dahdi_pvt *crv;
pthread_t threadid;
char ani2str[6];
char plancallingnum[256];
@@ -10279,15 +10237,15 @@ static void *pri_dchannel(void *vpri)
if (ast_tvdiff_ms(ast_tvnow(), lastidle) > 1000) {
/* Don't create a new idle call more than once per second */
snprintf(idlen, sizeof(idlen), "%d/%s", pri->pvts[nextidle]->channel, pri->idledial);
- idle = zt_request("Zap", AST_FORMAT_ULAW, idlen, &cause);
+ idle = dahdi_request("DAHDI", AST_FORMAT_ULAW, idlen, &cause);
if (idle) {
pri->pvts[nextidle]->isidlecall = 1;
if (ast_pthread_create_background(&p, NULL, do_idle_thread, idle)) {
ast_log(LOG_WARNING, "Unable to start new thread for idle channel '%s'\n", idle->name);
- zt_hangup(idle);
+ dahdi_hangup(idle);
}
} else
- ast_log(LOG_WARNING, "Unable to request channel 'Zap/%s' for idle call\n", idlen);
+ ast_log(LOG_WARNING, "Unable to request channel 'DAHDI/%s' for idle call\n", idlen);
lastidle = ast_tvnow();
}
} else if ((haveidles < pri->minunused) &&
@@ -10363,7 +10321,7 @@ static void *pri_dchannel(void *vpri)
if (fds[which].revents & POLLPRI) {
/* Check for an event */
x = 0;
- res = ioctl(pri->fds[which], ZT_GETEVENT, &x);
+ res = ioctl(pri->fds[which], DAHDI_GETEVENT, &x);
if (x) {
ast_log(LOG_NOTICE, "PRI got event: %s (%d) on %s D-channel of span %d\n", event2str(x), x, pri_order(which), pri->span);
manager_event(EVENT_FLAG_SYSTEM, "PRIEvent",
@@ -10378,10 +10336,10 @@ static void *pri_dchannel(void *vpri)
);
}
/* Keep track of alarm state */
- if (x == ZT_EVENT_ALARM) {
+ if (x == DAHDI_EVENT_ALARM) {
pri->dchanavail[which] &= ~(DCHAN_NOTINALARM | DCHAN_UP);
pri_find_dchan(pri);
- } else if (x == ZT_EVENT_NOALARM) {
+ } else if (x == DAHDI_EVENT_NOALARM) {
pri->dchanavail[which] |= DCHAN_NOTINALARM;
pri_restart(pri->dchans[which]);
}
@@ -10441,7 +10399,7 @@ static void *pri_dchannel(void *vpri)
pri->resetting = 0;
/* Hangup active channels and put them in alarm mode */
for (i = 0; i < pri->numchans; i++) {
- struct zt_pvt *p = pri->pvts[i];
+ struct dahdi_pvt *p = pri->pvts[i];
if (p) {
if (!p->pri || !p->pri->pri || pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0) {
/* T309 is not enabled : hangup calls when alarm occurs */
@@ -10511,7 +10469,7 @@ static void *pri_dchannel(void *vpri)
if (chanpos > -1) {
ast_mutex_lock(&pri->pvts[chanpos]->lock);
/* queue DTMF frame if the PBX for this call was already started (we're forwarding KEYPAD_DIGITs further on */
- if ((pri->overlapdial & ZAP_OVERLAPDIAL_INCOMING) && pri->pvts[chanpos]->call==e->digit.call && pri->pvts[chanpos]->owner) {
+ if ((pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING) && pri->pvts[chanpos]->call==e->digit.call && pri->pvts[chanpos]->owner) {
/* how to do that */
int digitlen = strlen(e->digit.digits);
char digit;
@@ -10520,7 +10478,7 @@ static void *pri_dchannel(void *vpri)
digit = e->digit.digits[i];
{
struct ast_frame f = { AST_FRAME_DTMF, digit, };
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
}
}
}
@@ -10539,7 +10497,7 @@ static void *pri_dchannel(void *vpri)
if (chanpos > -1) {
ast_mutex_lock(&pri->pvts[chanpos]->lock);
/* queue DTMF frame if the PBX for this call was already started (we're forwarding INFORMATION further on */
- if ((pri->overlapdial & ZAP_OVERLAPDIAL_INCOMING) && pri->pvts[chanpos]->call==e->ring.call && pri->pvts[chanpos]->owner) {
+ if ((pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING) && pri->pvts[chanpos]->call==e->ring.call && pri->pvts[chanpos]->owner) {
/* how to do that */
int digitlen = strlen(e->ring.callednum);
char digit;
@@ -10548,7 +10506,7 @@ static void *pri_dchannel(void *vpri)
digit = e->ring.callednum[i];
{
struct ast_frame f = { AST_FRAME_DTMF, digit, };
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
}
}
}
@@ -10659,27 +10617,27 @@ static void *pri_dchannel(void *vpri)
pri->pvts[chanpos]->exten[1] = '\0';
}
/* Make sure extension exists (or in overlap dial mode, can exist) */
- if (((pri->overlapdial & ZAP_OVERLAPDIAL_INCOMING) && ast_canmatch_extension(NULL, pri->pvts[chanpos]->context, pri->pvts[chanpos]->exten, 1, pri->pvts[chanpos]->cid_num)) ||
+ if (((pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING) && ast_canmatch_extension(NULL, pri->pvts[chanpos]->context, pri->pvts[chanpos]->exten, 1, pri->pvts[chanpos]->cid_num)) ||
ast_exists_extension(NULL, pri->pvts[chanpos]->context, pri->pvts[chanpos]->exten, 1, pri->pvts[chanpos]->cid_num)) {
/* Setup law */
int law;
if (pri->switchtype != PRI_SWITCH_GR303_TMC) {
/* Set to audio mode at this point */
law = 1;
- if (ioctl(pri->pvts[chanpos]->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &law) == -1)
+ if (ioctl(pri->pvts[chanpos]->subs[SUB_REAL].zfd, DAHDI_AUDIOMODE, &law) == -1)
ast_log(LOG_WARNING, "Unable to set audio mode on channel %d to %d\n", pri->pvts[chanpos]->channel, law);
}
if (e->ring.layer1 == PRI_LAYER_1_ALAW)
- law = ZT_LAW_ALAW;
+ law = DAHDI_LAW_ALAW;
else
- law = ZT_LAW_MULAW;
- res = zt_setlaw(pri->pvts[chanpos]->subs[SUB_REAL].zfd, law);
+ law = DAHDI_LAW_MULAW;
+ res = dahdi_setlaw(pri->pvts[chanpos]->subs[SUB_REAL].zfd, law);
if (res < 0)
ast_log(LOG_WARNING, "Unable to set law on channel %d\n", pri->pvts[chanpos]->channel);
res = set_actual_gain(pri->pvts[chanpos]->subs[SUB_REAL].zfd, 0, pri->pvts[chanpos]->rxgain, pri->pvts[chanpos]->txgain, law);
if (res < 0)
ast_log(LOG_WARNING, "Unable to set gains on channel %d\n", pri->pvts[chanpos]->channel);
- if (e->ring.complete || !(pri->overlapdial & ZAP_OVERLAPDIAL_INCOMING)) {
+ if (e->ring.complete || !(pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING)) {
/* Just announce proceeding */
pri->pvts[chanpos]->proceeding = 1;
pri_proceeding(pri->pri, e->ring.call, PVT_TO_CHANNEL(pri->pvts[chanpos]), 0);
@@ -10693,17 +10651,17 @@ static void *pri_dchannel(void *vpri)
pri->pvts[chanpos]->callingpres = e->ring.callingpres;
/* Start PBX */
- if (!e->ring.complete && (pri->overlapdial & ZAP_OVERLAPDIAL_INCOMING) && ast_matchmore_extension(NULL, pri->pvts[chanpos]->context, pri->pvts[chanpos]->exten, 1, pri->pvts[chanpos]->cid_num)) {
+ if (!e->ring.complete && (pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING) && ast_matchmore_extension(NULL, pri->pvts[chanpos]->context, pri->pvts[chanpos]->exten, 1, pri->pvts[chanpos]->cid_num)) {
/* Release the PRI lock while we create the channel */
ast_mutex_unlock(&pri->lock);
if (crv) {
/* Set bearer and such */
pri_assign_bearer(crv, pri, pri->pvts[chanpos]);
- c = zt_new(crv, AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
+ c = dahdi_new(crv, AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
pri->pvts[chanpos]->owner = &inuse;
ast_debug(1, "Started up crv %d:%d on bearer channel %d\n", pri->trunkgroup, crv->channel, crv->bearer->channel);
} else {
- c = zt_new(pri->pvts[chanpos], AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
+ c = dahdi_new(pri->pvts[chanpos], AST_STATE_RESERVED, 0, SUB_REAL, law, e->ring.ctype);
}
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -10747,7 +10705,7 @@ static void *pri_dchannel(void *vpri)
} else {
ast_mutex_unlock(&pri->lock);
/* Release PRI lock while we create the channel */
- c = zt_new(pri->pvts[chanpos], AST_STATE_RING, 1, SUB_REAL, law, e->ring.ctype);
+ c = dahdi_new(pri->pvts[chanpos], AST_STATE_RING, 1, SUB_REAL, law, e->ring.ctype);
if (c) {
char calledtonstr[10];
@@ -10778,7 +10736,7 @@ static void *pri_dchannel(void *vpri)
plancallingnum, pri->pvts[chanpos]->exten,
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset, pri->span);
- zt_enable_ec(pri->pvts[chanpos]);
+ dahdi_enable_ec(pri->pvts[chanpos]);
} else {
ast_mutex_lock(&pri->lock);
@@ -10820,7 +10778,7 @@ static void *pri_dchannel(void *vpri)
} else {
ast_mutex_lock(&pri->pvts[chanpos]->lock);
if (ast_strlen_zero(pri->pvts[chanpos]->dop.dialstr)) {
- zt_enable_ec(pri->pvts[chanpos]);
+ dahdi_enable_ec(pri->pvts[chanpos]);
pri->pvts[chanpos]->subs[SUB_REAL].needringing = 1;
pri->pvts[chanpos]->alerting = 1;
} else
@@ -10880,7 +10838,7 @@ static void *pri_dchannel(void *vpri)
ast_mutex_lock(&pri->pvts[chanpos]->lock);
ast_debug(1, "Queuing frame from PRI_EVENT_PROGRESS on channel %d/%d span %d\n",
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
#ifdef PRI_PROGRESS_MASK
if (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) {
#else
@@ -10906,7 +10864,7 @@ static void *pri_dchannel(void *vpri)
ast_mutex_lock(&pri->pvts[chanpos]->lock);
ast_debug(1, "Queuing frame from PRI_EVENT_PROCEEDING on channel %d/%d span %d\n",
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
#ifdef PRI_PROGRESS_MASK
if (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) {
#else
@@ -10919,7 +10877,7 @@ static void *pri_dchannel(void *vpri)
}
/* Bring voice path up */
f.subclass = AST_CONTROL_PROGRESS;
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
}
pri->pvts[chanpos]->proceeding = 1;
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -10942,7 +10900,7 @@ static void *pri_dchannel(void *vpri)
ast_copy_string(pri->pvts[chanpos]->lastcid_num, e->facname.callingnum, sizeof(pri->pvts[chanpos]->lastcid_num));
ast_copy_string(pri->pvts[chanpos]->lastcid_name, e->facname.callingname, sizeof(pri->pvts[chanpos]->lastcid_name));
pri->pvts[chanpos]->subs[SUB_REAL].needcallerid =1;
- zt_enable_ec(pri->pvts[chanpos]);
+ dahdi_enable_ec(pri->pvts[chanpos]);
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
}
}
@@ -10970,8 +10928,8 @@ static void *pri_dchannel(void *vpri)
}
if (pri->pvts[chanpos]->realcall && (pri->pvts[chanpos]->realcall->sig == SIG_FXSKS)) {
ast_debug(1, "Starting up GR-303 trunk now that we got CONNECT...\n");
- x = ZT_START;
- res = ioctl(pri->pvts[chanpos]->subs[SUB_REAL].zfd, ZT_HOOK, &x);
+ x = DAHDI_START;
+ res = ioctl(pri->pvts[chanpos]->subs[SUB_REAL].zfd, DAHDI_HOOK, &x);
if (res < 0) {
if (errno != EINPROGRESS) {
ast_log(LOG_WARNING, "Unable to start channel: %s\n", strerror(errno));
@@ -10980,7 +10938,7 @@ static void *pri_dchannel(void *vpri)
} else if (!ast_strlen_zero(pri->pvts[chanpos]->dop.dialstr)) {
pri->pvts[chanpos]->dialing = 1;
/* Send any "w" waited stuff */
- res = ioctl(pri->pvts[chanpos]->subs[SUB_REAL].zfd, ZT_DIAL, &pri->pvts[chanpos]->dop);
+ res = ioctl(pri->pvts[chanpos]->subs[SUB_REAL].zfd, DAHDI_DIAL, &pri->pvts[chanpos]->dop);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to initiate dialing on trunk channel %d\n", pri->pvts[chanpos]->channel);
pri->pvts[chanpos]->dop.dialstr[0] = '\0';
@@ -10993,7 +10951,7 @@ static void *pri_dchannel(void *vpri)
} else {
pri->pvts[chanpos]->subs[SUB_REAL].needanswer =1;
/* Enable echo cancellation if it's not on already */
- zt_enable_ec(pri->pvts[chanpos]);
+ dahdi_enable_ec(pri->pvts[chanpos]);
}
#ifdef SUPPORT_USERUSER
@@ -11019,7 +10977,7 @@ static void *pri_dchannel(void *vpri)
if (chanpos > -1) {
ast_mutex_lock(&pri->pvts[chanpos]->lock);
if (!pri->pvts[chanpos]->alreadyhungup) {
- /* we're calling here zt_hangup so once we get there we need to clear p->call after calling pri_hangup */
+ /* we're calling here dahdi_hangup so once we get there we need to clear p->call after calling pri_hangup */
pri->pvts[chanpos]->alreadyhungup = 1;
if (pri->pvts[chanpos]->realcall)
pri_hangup_all(pri->pvts[chanpos]->realcall, pri);
@@ -11258,11 +11216,11 @@ static void *pri_dchannel(void *vpri)
switch (e->notify.info) {
case PRI_NOTIFY_REMOTE_HOLD:
f.subclass = AST_CONTROL_HOLD;
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
break;
case PRI_NOTIFY_REMOTE_RETRIEVAL:
f.subclass = AST_CONTROL_UNHOLD;
- zap_queue_frame(pri->pvts[chanpos], &f, pri);
+ dahdi_queue_frame(pri->pvts[chanpos], &f, pri);
break;
}
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -11278,40 +11236,40 @@ static void *pri_dchannel(void *vpri)
return NULL;
}
-static int start_pri(struct zt_pri *pri)
+static int start_pri(struct dahdi_pri *pri)
{
int res, x;
- ZT_PARAMS p;
- ZT_BUFFERINFO bi;
- struct zt_spaninfo si;
+ DAHDI_PARAMS p;
+ DAHDI_BUFFERINFO bi;
+ struct dahdi_spaninfo si;
int i;
for (i = 0; i < NUM_DCHANS; i++) {
if (!pri->dchannels[i])
break;
- pri->fds[i] = open("/dev/zap/channel", O_RDWR);
+ pri->fds[i] = open("/dev/dahdi/channel", O_RDWR);
x = pri->dchannels[i];
- if ((pri->fds[i] < 0) || (ioctl(pri->fds[i],ZT_SPECIFY,&x) == -1)) {
+ if ((pri->fds[i] < 0) || (ioctl(pri->fds[i],DAHDI_SPECIFY,&x) == -1)) {
ast_log(LOG_ERROR, "Unable to open D-channel %d (%s)\n", x, strerror(errno));
return -1;
}
- res = ioctl(pri->fds[i], ZT_GET_PARAMS, &p);
+ res = ioctl(pri->fds[i], DAHDI_GET_PARAMS, &p);
if (res) {
- zt_close(pri->fds[i]);
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
ast_log(LOG_ERROR, "Unable to get parameters for D-channel %d (%s)\n", x, strerror(errno));
return -1;
}
- if ((p.sigtype != ZT_SIG_HDLCFCS) && (p.sigtype != ZT_SIG_HARDHDLC)) {
- zt_close(pri->fds[i]);
+ if ((p.sigtype != DAHDI_SIG_HDLCFCS) && (p.sigtype != DAHDI_SIG_HARDHDLC)) {
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
- ast_log(LOG_ERROR, "D-channel %d is not in HDLC/FCS mode. See /etc/zaptel.conf\n", x);
+ ast_log(LOG_ERROR, "D-channel %d is not in HDLC/FCS mode. See /etc/dahdi.conf\n", x);
return -1;
}
memset(&si, 0, sizeof(si));
- res = ioctl(pri->fds[i], ZT_SPANSTAT, &si);
+ res = ioctl(pri->fds[i], DAHDI_SPANSTAT, &si);
if (res) {
- zt_close(pri->fds[i]);
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
ast_log(LOG_ERROR, "Unable to get span state for D-channel %d (%s)\n", x, strerror(errno));
}
@@ -11319,13 +11277,13 @@ static int start_pri(struct zt_pri *pri)
pri->dchanavail[i] |= DCHAN_NOTINALARM;
else
pri->dchanavail[i] &= ~DCHAN_NOTINALARM;
- bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+ bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+ bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = 32;
bi.bufsize = 1024;
- if (ioctl(pri->fds[i], ZT_SET_BUFINFO, &bi)) {
+ if (ioctl(pri->fds[i], DAHDI_SET_BUFINFO, &bi)) {
ast_log(LOG_ERROR, "Unable to set appropriate buffering on channel %d\n", x);
- zt_close(pri->fds[i]);
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
return -1;
}
@@ -11341,13 +11299,13 @@ static int start_pri(struct zt_pri *pri)
}
/* Force overlap dial if we're doing GR-303! */
if (pri->switchtype == PRI_SWITCH_GR303_TMC)
- pri->overlapdial |= ZAP_OVERLAPDIAL_BOTH;
- pri_set_overlapdial(pri->dchans[i],(pri->overlapdial & ZAP_OVERLAPDIAL_OUTGOING)?1:0);
+ pri->overlapdial |= DAHDI_OVERLAPDIAL_BOTH;
+ pri_set_overlapdial(pri->dchans[i],(pri->overlapdial & DAHDI_OVERLAPDIAL_OUTGOING)?1:0);
/* Enslave to master if appropriate */
if (i)
pri_enslave(pri->dchans[0], pri->dchans[i]);
if (!pri->dchans[i]) {
- zt_close(pri->fds[i]);
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
ast_log(LOG_ERROR, "Unable to create PRI structure\n");
return -1;
@@ -11368,7 +11326,7 @@ static int start_pri(struct zt_pri *pri)
for (i = 0; i < NUM_DCHANS; i++) {
if (!pri->dchannels[i])
break;
- zt_close(pri->fds[i]);
+ dahdi_close(pri->fds[i]);
pri->fds[i] = -1;
}
ast_log(LOG_ERROR, "Unable to spawn D-channel: %s\n", strerror(errno));
@@ -11667,7 +11625,7 @@ static char *handle_pri_show_span(struct ast_cli_entry *e, int cmd, struct ast_c
#else
pri_dump_info(pris[span-1].pri);
#endif
- ast_cli(a->fd, "Overlap Recv: %s\n\n", (pris[span-1].overlapdial & ZAP_OVERLAPDIAL_INCOMING)?"Yes":"No");
+ ast_cli(a->fd, "Overlap Recv: %s\n\n", (pris[span-1].overlapdial & DAHDI_OVERLAPDIAL_INCOMING)?"Yes":"No");
}
}
return CLI_SUCCESS;
@@ -11726,7 +11684,7 @@ static char *handle_pri_version(struct ast_cli_entry *e, int cmd, struct ast_cli
return CLI_SUCCESS;
}
-static struct ast_cli_entry zap_pri_cli[] = {
+static struct ast_cli_entry dahdi_pri_cli[] = {
AST_CLI_DEFINE(handle_pri_debug, "Enables PRI debugging on a span"),
AST_CLI_DEFINE(handle_pri_no_debug, "Disables PRI debugging on a span"),
AST_CLI_DEFINE(handle_pri_really_debug, "Enables REALLY INTENSE PRI debugging"),
@@ -11740,15 +11698,15 @@ static struct ast_cli_entry zap_pri_cli[] = {
#endif /* HAVE_PRI */
-static char *zap_destroy_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *dahdi_destroy_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int channel;
int ret;
switch (cmd) {
case CLI_INIT:
- e->command = "zap destroy channel";
+ e->command = "dahdi destroy channel";
e->usage =
- "Usage: zap destroy channel <chan num>\n"
+ "Usage: dahdi destroy channel <chan num>\n"
" DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING. Immediately removes a given channel, whether it is in use or not\n";
return NULL;
case CLI_GENERATE:
@@ -11758,37 +11716,55 @@ static char *zap_destroy_channel(struct ast_cli_entry *e, int cmd, struct ast_cl
return CLI_SHOWUSAGE;
channel = atoi(a->argv[3]);
- ret = zap_destroy_channel_bynum(channel);
+ ret = dahdi_destroy_channel_bynum(channel);
return ( RESULT_SUCCESS == ret ) ? CLI_SUCCESS : CLI_FAILURE;
}
-static int setup_zap(int reload);
-static int zap_restart(void)
+static char *handle_cli_zap_destroy_channel_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- ast_verb(1, "Destroying channels and reloading Zaptel configuration.\n");
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "zap destroy channel";
+ e->usage =
+ "Usage: zap destroy channel <chan num>\n"
+ " DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING. Immediately removes a given channel, whether it is in use or not\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ case CLI_HANDLER:
+ return dahdi_destroy_channel(e, cmd, a);
+ }
+
+ return CLI_FAILURE;
+}
+
+static int setup_dahdi(int reload);
+static int dahdi_restart(void)
+{
+ ast_verb(1, "Destroying channels and reloading DAHDI configuration.\n");
while (iflist) {
- ast_debug(1, "Destroying Zaptel channel no. %d\n", iflist->channel);
+ ast_debug(1, "Destroying DAHDI channel no. %d\n", iflist->channel);
/* Also updates iflist: */
destroy_channel(NULL, iflist, 1);
}
ast_debug(1, "Channels destroyed. Now re-reading config.\n");
- if (setup_zap(2) != 0) {
- ast_log(LOG_WARNING, "Reload channels from zap config failed!\n");
+ if (setup_dahdi(2) != 0) {
+ ast_log(LOG_WARNING, "Reload channels from dahdi config failed!\n");
return 1;
}
return 0;
}
-static char *zap_restart_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *dahdi_restart_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
switch (cmd) {
case CLI_INIT:
- e->command = "zap restart";
+ e->command = "dahdi restart";
e->usage =
- "Usage: zap restart\n"
- " Restarts the Zaptel channels: destroys them all and then\n"
- " re-reads them from zapata.conf.\n"
- " Note that this will STOP any running CALL on Zaptel channels.\n"
+ "Usage: dahdi restart\n"
+ " Restarts the DAHDI channels: destroys them all and then\n"
+ " re-reads them from chan_dahdi.conf.\n"
+ " Note that this will STOP any running CALL on DAHDI channels.\n"
"";
return NULL;
case CLI_GENERATE:
@@ -11797,43 +11773,64 @@ static char *zap_restart_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
if (a->argc != 2)
return CLI_SHOWUSAGE;
- if (zap_restart() != 0)
+ if (dahdi_restart() != 0)
return CLI_FAILURE;
return CLI_SUCCESS;
}
-static int action_zaprestart(struct mansession *s, const struct message *m)
+static char *handle_cli_zap_restart_cmd_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "zap restart";
+ e->usage =
+ "Usage: zap restart\n"
+ " Restarts the zap channels: destroys them all and then\n"
+ " re-reads them from chan_dahdi.conf.\n"
+ " Note that this will STOP any running CALL on zap channels.\n"
+ "";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ case CLI_HANDLER:
+ return dahdi_restart_cmd(e, cmd, a);
+ }
+
+ return CLI_FAILURE;
+}
+
+static int action_dahdirestart(struct mansession *s, const struct message *m)
{
- if (zap_restart() != 0) {
- astman_send_error(s, m, "Failed rereading Zaptel configuration");
+ if (dahdi_restart() != 0) {
+ astman_send_error(s, m, "Failed rereading DAHDI configuration");
return 1;
}
- astman_send_ack(s, m, "ZapRestart: Success");
+ astman_send_ack(s, m, "DAHDIRestart: Success");
return 0;
}
-static char *zap_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *dahdi_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
#define FORMAT "%7s %-10.10s %-15.15s %-10.10s %-20.20s %-10.10s %-10.10s\n"
#define FORMAT2 "%7s %-10.10s %-15.15s %-10.10s %-20.20s %-10.10s %-10.10s\n"
unsigned int targetnum = 0;
int filtertype = 0;
- struct zt_pvt *tmp = NULL;
+ struct dahdi_pvt *tmp = NULL;
char tmps[20] = "";
char statestr[20] = "";
char blockstr[20] = "";
ast_mutex_t *lock;
- struct zt_pvt *start;
+ struct dahdi_pvt *start;
#ifdef HAVE_PRI
int trunkgroup;
- struct zt_pri *pri = NULL;
+ struct dahdi_pri *pri = NULL;
int x;
#endif
switch (cmd) {
case CLI_INIT:
- e->command = "zap show channels [trunkgroup|group|context]";
+ e->command = "dahdi show channels [trunkgroup|group|context]";
e->usage =
- "Usage: zap show channels [ trunkgroup <trunkgroup> | group <group> | context <context> ]\n"
+ "Usage: dahdi show channels [ trunkgroup <trunkgroup> | group <group> | context <context> ]\n"
" Shows a list of available channels with optional filtering\n"
" <group> must be a number between 0 and 63\n";
return NULL;
@@ -11844,7 +11841,7 @@ static char *zap_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_
lock = &iflock;
start = iflist;
- /* syntax: zap show channels [ group <group> | context <context> | trunkgroup <trunkgroup> ] */
+ /* syntax: dahdi show channels [ group <group> | context <context> | trunkgroup <trunkgroup> ] */
if (!((a->argc == 3) || (a->argc == 5)))
return CLI_SHOWUSAGE;
@@ -11892,13 +11889,13 @@ static char *zap_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_
while (tmp) {
if (filtertype) {
switch(filtertype) {
- case 1: /* zap show channels group <group> */
+ case 1: /* dahdi show channels group <group> */
if (tmp->group != targetnum) {
tmp = tmp->next;
continue;
}
break;
- case 2: /* zap show channels context <context> */
+ case 2: /* dahdi show channels context <context> */
if (strcasecmp(tmp->context, a->argv[4])) {
tmp = tmp->next;
continue;
@@ -11936,25 +11933,44 @@ static char *zap_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_
#undef FORMAT2
}
-static char *zap_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *handle_cli_zap_show_channels_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "zap show channels [trunkgroup|group|context]";
+ e->usage =
+ "Usage: zap show channels [ trunkgroup <trunkgroup> | group <group> | context <context> ]\n"
+ " Shows a list of available channels with optional filtering\n"
+ " <group> must be a number between 0 and 63\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ case CLI_HANDLER:
+ return dahdi_show_channels(e, cmd, a);
+ }
+
+ return CLI_FAILURE;
+}
+
+static char *dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int channel;
- struct zt_pvt *tmp = NULL;
- ZT_CONFINFO ci;
- ZT_PARAMS ps;
+ struct dahdi_pvt *tmp = NULL;
+ DAHDI_CONFINFO ci;
+ DAHDI_PARAMS ps;
int x;
ast_mutex_t *lock;
- struct zt_pvt *start;
+ struct dahdi_pvt *start;
#ifdef HAVE_PRI
char *c;
int trunkgroup;
- struct zt_pri *pri=NULL;
+ struct dahdi_pri *pri=NULL;
#endif
switch (cmd) {
case CLI_INIT:
- e->command = "zap show channel";
+ e->command = "dahdi show channel";
e->usage =
- "Usage: zap show channel <chan num>\n"
+ "Usage: dahdi show channel <chan num>\n"
" Detailed information about a given channel\n";
return NULL;
case CLI_GENERATE:
@@ -12042,12 +12058,12 @@ static char *zap_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_a
ast_cli(a->fd, "TDD: %s\n", tmp->tdd ? "yes" : "no");
ast_cli(a->fd, "Relax DTMF: %s\n", tmp->dtmfrelax ? "yes" : "no");
ast_cli(a->fd, "Dialing/CallwaitCAS: %d/%d\n", tmp->dialing, tmp->callwaitcas);
- ast_cli(a->fd, "Default law: %s\n", tmp->law == ZT_LAW_MULAW ? "ulaw" : tmp->law == ZT_LAW_ALAW ? "alaw" : "unknown");
+ ast_cli(a->fd, "Default law: %s\n", tmp->law == DAHDI_LAW_MULAW ? "ulaw" : tmp->law == DAHDI_LAW_ALAW ? "alaw" : "unknown");
ast_cli(a->fd, "Fax Handled: %s\n", tmp->faxhandled ? "yes" : "no");
ast_cli(a->fd, "Pulse phone: %s\n", tmp->pulsedial ? "yes" : "no");
ast_cli(a->fd, "DND: %s\n", tmp->dnd ? "yes" : "no");
ast_cli(a->fd, "Echo Cancellation:\n");
-#if defined(HAVE_ZAPTEL_ECHOCANPARAMS)
+
if (tmp->echocancel.head.tap_length) {
ast_cli(a->fd, "\t%d taps\n", tmp->echocancel.head.tap_length);
for (x = 0; x < tmp->echocancel.head.param_count; x++) {
@@ -12057,14 +12073,6 @@ static char *zap_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_a
} else {
ast_cli(a->fd, "\tnone\n");
}
-#else
- if (tmp->echocancel) {
- ast_cli(a->fd, "\t%d taps\n", tmp->echocancel);
- ast_cli(a->fd, "\t%scurrently %s\n", tmp->echocanbridged ? "" : "(unless TDM bridged) ", tmp->echocanon ? "ON" : "OFF");
- }
- else
- ast_cli(a->fd, "\tnone\n");
-#endif
if (tmp->master)
ast_cli(a->fd, "Master Channel: %d\n", tmp->master->channel);
for (x = 0; x < MAX_SLAVES; x++) {
@@ -12096,15 +12104,15 @@ static char *zap_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_a
memset(&ci, 0, sizeof(ci));
ps.channo = tmp->channel;
if (tmp->subs[SUB_REAL].zfd > -1) {
- if (!ioctl(tmp->subs[SUB_REAL].zfd, ZT_GETCONF, &ci)) {
+ if (!ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_GETCONF, &ci)) {
ast_cli(a->fd, "Actual Confinfo: Num/%d, Mode/0x%04x\n", ci.confno, ci.confmode);
}
-#ifdef ZT_GETCONFMUTE
- if (!ioctl(tmp->subs[SUB_REAL].zfd, ZT_GETCONFMUTE, &x)) {
+#ifdef DAHDI_GETCONFMUTE
+ if (!ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_GETCONFMUTE, &x)) {
ast_cli(a->fd, "Actual Confmute: %s\n", x ? "Yes" : "No");
}
#endif
- if (ioctl(tmp->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &ps) < 0) {
+ if (ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &ps) < 0) {
ast_log(LOG_WARNING, "Failed to get parameters on channel %d\n", tmp->channel);
} else {
ast_cli(a->fd, "Hookstate (FXS only): %s\n", ps.rxisoffhook ? "Offhook" : "Onhook");
@@ -12121,14 +12129,32 @@ static char *zap_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_a
return CLI_FAILURE;
}
-static char *handle_zap_show_cadences(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *handle_cli_zap_show_channel_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "zap show channel";
+ e->usage =
+ "Usage: zap show channel <chan num>\n"
+ " Detailed information about a given channel\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ case CLI_HANDLER:
+ return dahdi_show_channel(e, cmd, a);
+ }
+
+ return CLI_FAILURE;
+}
+
+static char *handle_dahdi_show_cadences(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int i, j;
switch (cmd) {
case CLI_INIT:
- e->command = "zap show cadences";
+ e->command = "dahdi show cadences";
e->usage =
- "Usage: zap show cadences\n"
+ "Usage: dahdi show cadences\n"
" Shows all cadences currently defined\n";
return NULL;
case CLI_GENERATE:
@@ -12157,10 +12183,28 @@ static char *handle_zap_show_cadences(struct ast_cli_entry *e, int cmd, struct a
return CLI_SUCCESS;
}
+static char *handle_cli_zap_show_cadences_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch(cmd) {
+ case CLI_INIT:
+ e->command = "zap show cadences";
+ e->usage =
+ "Usage: zap show cadences\n"
+ " Shows all cadences currently defined\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ case CLI_HANDLER:
+ return handle_dahdi_show_cadences(e, cmd, a);
+ }
+
+ return CLI_FAILURE;
+}
+
/* Based on irqmiss.c */
-static char *zap_show_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *dahdi_show_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
-#ifdef ZT_SPANINFO_HAS_LINECONFIG
+#ifdef DAHDI_SPANINFO_HAS_LINECONFIG
#define FORMAT "%-40.40s %-7.7s %-6d %-6d %-6d %-3.3s %-4.4s %-8.8s %s\n"
#define FORMAT2 "%-40.40s %-7.7s %-6.6s %-6.6s %-6.6s %-3.3s %-4.4s %-8.8s %s\n"
#else
@@ -12172,48 +12216,48 @@ static char *zap_show_status(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
char alarms[50];
int ctl;
- ZT_SPANINFO s;
+ DAHDI_SPANINFO s;
switch (cmd) {
case CLI_INIT:
- e->command = "zap show status";
+ e->command = "dahdi show status";
e->usage =
- "Usage: zap show status\n"
- " Shows a list of Zaptel cards with status\n";
+ "Usage: dahdi show status\n"
+ " Shows a list of DAHDI cards with status\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
- ctl = open("/dev/zap/ctl", O_RDWR);
+ ctl = open("/dev/dahdi/ctl", O_RDWR);
if (ctl < 0) {
- ast_cli(a->fd, "No Zaptel interface found. Unable to open /dev/zap/ctl: %s\n", strerror(errno));
+ ast_cli(a->fd, "No DAHDI found. Unable to open /dev/dahdi/ctl: %s\n", strerror(errno));
return CLI_FAILURE;
}
ast_cli(a->fd, FORMAT2, "Description", "Alarms", "IRQ", "bpviol", "CRC4"
-#ifdef ZT_SPANINFO_HAS_LINECONFIG
+#ifdef DAHDI_SPANINFO_HAS_LINECONFIG
, "Framing", "Coding", "Options", "LBO"
#endif
);
- for (span = 1; span < ZT_MAX_SPANS; ++span) {
+ for (span = 1; span < DAHDI_MAX_SPANS; ++span) {
s.spanno = span;
- res = ioctl(ctl, ZT_SPANSTAT, &s);
+ res = ioctl(ctl, DAHDI_SPANSTAT, &s);
if (res) {
continue;
}
alarms[0] = '\0';
if (s.alarms > 0) {
- if (s.alarms & ZT_ALARM_BLUE)
+ if (s.alarms & DAHDI_ALARM_BLUE)
strcat(alarms, "BLU/");
- if (s.alarms & ZT_ALARM_YELLOW)
+ if (s.alarms & DAHDI_ALARM_YELLOW)
strcat(alarms, "YEL/");
- if (s.alarms & ZT_ALARM_RED)
+ if (s.alarms & DAHDI_ALARM_RED)
strcat(alarms, "RED/");
- if (s.alarms & ZT_ALARM_LOOPBACK)
+ if (s.alarms & DAHDI_ALARM_LOOPBACK)
strcat(alarms, "LB/");
- if (s.alarms & ZT_ALARM_RECOVER)
+ if (s.alarms & DAHDI_ALARM_RECOVER)
strcat(alarms, "REC/");
- if (s.alarms & ZT_ALARM_NOTOPEN)
+ if (s.alarms & DAHDI_ALARM_NOTOPEN)
strcat(alarms, "NOP/");
if (!strlen(alarms))
strcat(alarms, "UUU/");
@@ -12229,17 +12273,17 @@ static char *zap_show_status(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
}
ast_cli(a->fd, FORMAT, s.desc, alarms, s.irqmisses, s.bpvcount, s.crc4count
-#ifdef ZT_SPANINFO_HAS_LINECONFIG
- , s.lineconfig & ZT_CONFIG_D4 ? "D4" :
- s.lineconfig & ZT_CONFIG_ESF ? "ESF" :
- s.lineconfig & ZT_CONFIG_CCS ? "CCS" :
+#ifdef DAHDI_SPANINFO_HAS_LINECONFIG
+ , s.lineconfig & DAHDI_CONFIG_D4 ? "D4" :
+ s.lineconfig & DAHDI_CONFIG_ESF ? "ESF" :
+ s.lineconfig & DAHDI_CONFIG_CCS ? "CCS" :
"CAS"
- , s.lineconfig & ZT_CONFIG_B8ZS ? "B8ZS" :
- s.lineconfig & ZT_CONFIG_HDB3 ? "HDB3" :
- s.lineconfig & ZT_CONFIG_AMI ? "AMI" :
+ , s.lineconfig & DAHDI_CONFIG_B8ZS ? "B8ZS" :
+ s.lineconfig & DAHDI_CONFIG_HDB3 ? "HDB3" :
+ s.lineconfig & DAHDI_CONFIG_AMI ? "AMI" :
"Unk"
- , s.lineconfig & ZT_CONFIG_CRC4 ?
- s.lineconfig & ZT_CONFIG_NOTOPEN ? "CRC4/YEL" : "CRC4" : "YEL"
+ , s.lineconfig & DAHDI_CONFIG_CRC4 ?
+ s.lineconfig & DAHDI_CONFIG_NOTOPEN ? "CRC4/YEL" : "CRC4" : "YEL"
, lbostr[s.lbo]
#endif
);
@@ -12251,22 +12295,40 @@ static char *zap_show_status(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
#undef FORMAT2
}
-static char *zap_show_version(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *handle_cli_zap_show_status_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "zap show status";
+ e->usage =
+ "Usage: zap show status\n"
+ " Shows a list of zap cards with status\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ case CLI_HANDLER:
+ return dahdi_show_status(e, cmd, a);
+ }
+
+ return CLI_FAILURE;
+}
+
+static char *dahdi_show_version(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int pseudo_fd = -1;
- struct zt_versioninfo vi;
+ struct dahdi_versioninfo vi;
switch (cmd) {
case CLI_INIT:
- e->command = "zap show version";
+ e->command = "dahdi show version";
e->usage =
- "Usage: zap show version\n"
- " Shows the Zaptel version in use\n";
+ "Usage: dahdi show version\n"
+ " Shows the DAHDI version in use\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
- if ((pseudo_fd = open("/dev/zap/ctl", O_RDONLY)) < 0) {
+ if ((pseudo_fd = open("/dev/dahdi/ctl", O_RDONLY)) < 0) {
ast_cli(a->fd, "Failed to open control file to get version.\n");
return CLI_SUCCESS;
}
@@ -12274,30 +12336,47 @@ static char *zap_show_version(struct ast_cli_entry *e, int cmd, struct ast_cli_a
strcpy(vi.version, "Unknown");
strcpy(vi.echo_canceller, "Unknown");
- if (ioctl(pseudo_fd, ZT_GETVERSION, &vi))
+ if (ioctl(pseudo_fd, DAHDI_GETVERSION, &vi))
ast_cli(a->fd, "Failed to get version from control file.\n");
else
- ast_cli(a->fd, "Zaptel Version: %s Echo Canceller: %s\n", vi.version, vi.echo_canceller);
+ ast_cli(a->fd, "DAHDI Version: %s Echo Canceller: %s\n", vi.version, vi.echo_canceller);
close(pseudo_fd);
return CLI_SUCCESS;
}
-#if defined(HAVE_ZAPTEL_HWGAIN)
-static char *zap_set_hwgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *handle_cli_zap_show_version_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "zap show version";
+ e->usage =
+ "Usage: zap show version\n"
+ " Shows the zap version in use\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ case CLI_HANDLER:
+ return dahdi_show_version(e, cmd, a);
+ }
+
+ return CLI_FAILURE;
+}
+
+static char *dahdi_set_hwgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int channel;
int gain;
int tx;
- struct zt_hwgain hwgain;
- struct zt_pvt *tmp = NULL;
+ struct dahdi_hwgain hwgain;
+ struct dahdi_pvt *tmp = NULL;
switch (cmd) {
case CLI_INIT:
- e->command = "zap set hwgain";
+ e->command = "dahdi set hwgain";
e->usage =
- "Usage: zap set hwgain <rx|tx> <chan#> <gain>\n"
+ "Usage: dahdi set hwgain <rx|tx> <chan#> <gain>\n"
" Sets the hardware gain on a a given channel, overriding the\n"
" value provided at module loadtime, whether the channel is in\n"
" use or not. Changes take effect immediately.\n"
@@ -12334,7 +12413,7 @@ static char *zap_set_hwgain(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
hwgain.newgain = gain;
hwgain.tx = tx;
- if (ioctl(tmp->subs[SUB_REAL].zfd, ZT_SET_HWGAIN, &hwgain) < 0) {
+ if (ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_SET_HWGAIN, &hwgain) < 0) {
ast_cli(a->fd, "Unable to set the hardware gain for channel %d\n", channel);
ast_mutex_unlock(&iflock);
return CLI_FAILURE;
@@ -12353,22 +12432,44 @@ static char *zap_set_hwgain(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
return CLI_FAILURE;
}
-#endif
-static char *zap_set_swgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *handle_cli_zap_set_hwgain_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "zap set hwgain";
+ e->usage =
+ "Usage: zap set hwgain <rx|tx> <chan#> <gain>\n"
+ " Sets the hardware gain on a a given channel, overriding the\n"
+ " value provided at module loadtime, whether the channel is in\n"
+ " use or not. Changes take effect immediately.\n"
+ " <rx|tx> which direction do you want to change (relative to our module)\n"
+ " <chan num> is the channel number relative to the device\n"
+ " <gain> is the gain in dB (e.g. -3.5 for -3.5dB)\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ case CLI_HANDLER:
+ return dahdi_set_hwgain(e, cmd, a);
+ }
+
+ return CLI_FAILURE;
+}
+
+static char *dahdi_set_swgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int channel;
float gain;
int tx;
int res;
ast_mutex_t *lock;
- struct zt_pvt *tmp = NULL;
+ struct dahdi_pvt *tmp = NULL;
switch (cmd) {
case CLI_INIT:
- e->command = "zap set swgain";
+ e->command = "dahdi set swgain";
e->usage =
- "Usage: zap set swgain <rx|tx> <chan#> <gain>\n"
+ "Usage: dahdi set swgain <rx|tx> <chan#> <gain>\n"
" Sets the software gain on a a given channel, overriding the\n"
" value provided at module loadtime, whether the channel is in\n"
" use or not. Changes take effect immediately.\n"
@@ -12429,17 +12530,40 @@ static char *zap_set_swgain(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
}
-static char *zap_set_dnd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *handle_cli_zap_set_swgain_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "zap set swgain";
+ e->usage =
+ "Usage: zap set swgain <rx|tx> <chan#> <gain>\n"
+ " Sets the software gain on a a given channel, overriding the\n"
+ " value provided at module loadtime, whether the channel is in\n"
+ " use or not. Changes take effect immediately.\n"
+ " <rx|tx> which direction do you want to change (relative to our module)\n"
+ " <chan num> is the channel number relative to the device\n"
+ " <gain> is the gain in dB (e.g. -3.5 for -3.5dB)\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ case CLI_HANDLER:
+ return dahdi_set_swgain(e, cmd, a);
+ }
+
+ return CLI_FAILURE;
+}
+
+static char *dahdi_set_dnd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int channel;
int on;
- struct zt_pvt *zt_chan = NULL;
+ struct dahdi_pvt *dahdi_chan = NULL;
switch (cmd) {
case CLI_INIT:
- e->command = "zap set dnd";
+ e->command = "dahdi set dnd";
e->usage =
- "Usage: zap set dnd <chan#> <on|off>\n"
+ "Usage: dahdi set dnd <chan#> <on|off>\n"
" Sets/resets DND (Do Not Disturb) mode on a channel.\n"
" Changes take effect immediately.\n"
" <chan num> is the channel number\n"
@@ -12468,17 +12592,17 @@ static char *zap_set_dnd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
}
ast_mutex_lock(&iflock);
- for (zt_chan = iflist; zt_chan; zt_chan = zt_chan->next) {
- if (zt_chan->channel != channel)
+ for (dahdi_chan = iflist; dahdi_chan; dahdi_chan = dahdi_chan->next) {
+ if (dahdi_chan->channel != channel)
continue;
/* Found the channel. Actually set it */
- zap_dnd(zt_chan, on);
+ dahdi_dnd(dahdi_chan, on);
break;
}
ast_mutex_unlock(&iflock);
- if (!zt_chan) {
+ if (!dahdi_chan) {
ast_cli(a->fd, "Unable to find given channel %d\n", channel);
return CLI_FAILURE;
}
@@ -12486,33 +12610,64 @@ static char *zap_set_dnd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
return CLI_SUCCESS;
}
-static struct ast_cli_entry zap_cli[] = {
- AST_CLI_DEFINE(handle_zap_show_cadences, "List cadences"),
- AST_CLI_DEFINE(zap_show_channels, "Show active zapata channels"),
- AST_CLI_DEFINE(zap_show_channel, "Show information on a channel"),
- AST_CLI_DEFINE(zap_destroy_channel, "Destroy a channel"),
- AST_CLI_DEFINE(zap_restart_cmd, "Fully restart Zaptel channels"),
- AST_CLI_DEFINE(zap_show_status, "Show all Zaptel cards status"),
- AST_CLI_DEFINE(zap_show_version, "Show the Zaptel version in use"),
-#if defined(HAVE_ZAPTEL_HWGAIN)
- AST_CLI_DEFINE(zap_set_hwgain, "Set hardware gain on a channel"),
-#endif
- AST_CLI_DEFINE(zap_set_swgain, "Set software gain on a channel"),
- AST_CLI_DEFINE(zap_set_dnd, "Set software gain on a channel"),
+static char *handle_cli_zap_set_dnd_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "zap set dnd";
+ e->usage =
+ "Usage: zap set dnd <chan#> <on|off>\n"
+ " Sets/resets DND (Do Not Disturb) mode on a channel.\n"
+ " Changes take effect immediately.\n"
+ " <chan num> is the channel number\n"
+ " <on|off> Enable or disable DND mode?\n"
+ ;
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ case CLI_HANDLER:
+ return dahdi_set_dnd(e, cmd, a);
+ }
+
+ return CLI_FAILURE;
+}
+
+static struct ast_cli_entry cli_zap_show_cadences_deprecated = AST_CLI_DEFINE(handle_cli_zap_show_cadences_deprecated, "List cadences");
+static struct ast_cli_entry cli_zap_show_channels_deprecated = AST_CLI_DEFINE(handle_cli_zap_show_channels_deprecated, "Show active channels");
+static struct ast_cli_entry cli_zap_show_channel_deprecated = AST_CLI_DEFINE(handle_cli_zap_show_channel_deprecated, "Show information on a channel");
+static struct ast_cli_entry cli_zap_destroy_channel_deprecated = AST_CLI_DEFINE(handle_cli_zap_destroy_channel_deprecated, "Destroy a channel");
+static struct ast_cli_entry cli_zap_restart_cmd_deprecated = AST_CLI_DEFINE(handle_cli_zap_restart_cmd_deprecated, "Fully restart channels");
+static struct ast_cli_entry cli_zap_show_status_deprecated = AST_CLI_DEFINE(handle_cli_zap_show_status_deprecated, "Show all cards status");
+static struct ast_cli_entry cli_zap_show_version_deprecated = AST_CLI_DEFINE(handle_cli_zap_show_version_deprecated, "Show DAHDI version in use");
+static struct ast_cli_entry cli_zap_set_hwgain_deprecated = AST_CLI_DEFINE(handle_cli_zap_set_hwgain_deprecated, "Set hardware gain on a channel");
+static struct ast_cli_entry cli_zap_set_swgain_deprecated = AST_CLI_DEFINE(handle_cli_zap_set_swgain_deprecated, "Set software gain on a channel");
+static struct ast_cli_entry cli_zap_set_dnd_deprecated = AST_CLI_DEFINE(handle_cli_zap_set_dnd_deprecated, "Set software gain on a channel");
+
+static struct ast_cli_entry dahdi_cli[] = {
+ AST_CLI_DEFINE(handle_dahdi_show_cadences, "List cadences", .deprecate_cmd = &cli_zap_show_cadences_deprecated),
+ AST_CLI_DEFINE(dahdi_show_channels, "Show active DAHDI channels", .deprecate_cmd = &cli_zap_show_channels_deprecated),
+ AST_CLI_DEFINE(dahdi_show_channel, "Show information on a channel", .deprecate_cmd = &cli_zap_show_channel_deprecated),
+ AST_CLI_DEFINE(dahdi_destroy_channel, "Destroy a channel", .deprecate_cmd = &cli_zap_destroy_channel_deprecated),
+ AST_CLI_DEFINE(dahdi_restart_cmd, "Fully restart DAHDI channels", .deprecate_cmd = &cli_zap_restart_cmd_deprecated),
+ AST_CLI_DEFINE(dahdi_show_status, "Show all DAHDI cards status", .deprecate_cmd = &cli_zap_show_status_deprecated),
+ AST_CLI_DEFINE(dahdi_show_version, "Show the DAHDI version in use", .deprecate_cmd = &cli_zap_show_version_deprecated),
+ AST_CLI_DEFINE(dahdi_set_hwgain, "Set hardware gain on a channel", .deprecate_cmd = &cli_zap_set_hwgain_deprecated),
+ AST_CLI_DEFINE(dahdi_set_swgain, "Set software gain on a channel", .deprecate_cmd = &cli_zap_set_swgain_deprecated),
+ AST_CLI_DEFINE(dahdi_set_dnd, "Set software gain on a channel", .deprecate_cmd = &cli_zap_set_dnd_deprecated),
};
#define TRANSFER 0
#define HANGUP 1
-static int zap_fake_event(struct zt_pvt *p, int mode)
+static int dahdi_fake_event(struct dahdi_pvt *p, int mode)
{
if (p) {
switch (mode) {
case TRANSFER:
- p->fake_event = ZT_EVENT_WINKFLASH;
+ p->fake_event = DAHDI_EVENT_WINKFLASH;
break;
case HANGUP:
- p->fake_event = ZT_EVENT_ONHOOK;
+ p->fake_event = DAHDI_EVENT_ONHOOK;
break;
default:
ast_log(LOG_WARNING, "I don't know how to handle transfer event with this: %d on channel %s\n",mode, p->owner->name);
@@ -12520,9 +12675,9 @@ static int zap_fake_event(struct zt_pvt *p, int mode)
}
return 0;
}
-static struct zt_pvt *find_channel(int channel)
+static struct dahdi_pvt *find_channel(int channel)
{
- struct zt_pvt *p = iflist;
+ struct dahdi_pvt *p = iflist;
while (p) {
if (p->channel == channel) {
break;
@@ -12532,10 +12687,10 @@ static struct zt_pvt *find_channel(int channel)
return p;
}
-static int action_zapdndon(struct mansession *s, const struct message *m)
+static int action_dahdidndon(struct mansession *s, const struct message *m)
{
- struct zt_pvt *p = NULL;
- const char *channel = astman_get_header(m, "ZapChannel");
+ struct dahdi_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "DAHDIChannel");
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
@@ -12551,10 +12706,10 @@ static int action_zapdndon(struct mansession *s, const struct message *m)
return 0;
}
-static int action_zapdndoff(struct mansession *s, const struct message *m)
+static int action_dahdidndoff(struct mansession *s, const struct message *m)
{
- struct zt_pvt *p = NULL;
- const char *channel = astman_get_header(m, "ZapChannel");
+ struct dahdi_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "DAHDIChannel");
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
@@ -12572,8 +12727,8 @@ static int action_zapdndoff(struct mansession *s, const struct message *m)
static int action_transfer(struct mansession *s, const struct message *m)
{
- struct zt_pvt *p = NULL;
- const char *channel = astman_get_header(m, "ZapChannel");
+ struct dahdi_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "DAHDIChannel");
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
@@ -12584,15 +12739,15 @@ static int action_transfer(struct mansession *s, const struct message *m)
astman_send_error(s, m, "No such channel");
return 0;
}
- zap_fake_event(p,TRANSFER);
- astman_send_ack(s, m, "ZapTransfer");
+ dahdi_fake_event(p,TRANSFER);
+ astman_send_ack(s, m, "DAHDITransfer");
return 0;
}
static int action_transferhangup(struct mansession *s, const struct message *m)
{
- struct zt_pvt *p = NULL;
- const char *channel = astman_get_header(m, "ZapChannel");
+ struct dahdi_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "DAHDIChannel");
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
@@ -12603,15 +12758,15 @@ static int action_transferhangup(struct mansession *s, const struct message *m)
astman_send_error(s, m, "No such channel");
return 0;
}
- zap_fake_event(p,HANGUP);
- astman_send_ack(s, m, "ZapHangup");
+ dahdi_fake_event(p,HANGUP);
+ astman_send_ack(s, m, "DAHDIHangup");
return 0;
}
-static int action_zapdialoffhook(struct mansession *s, const struct message *m)
+static int action_dahdidialoffhook(struct mansession *s, const struct message *m)
{
- struct zt_pvt *p = NULL;
- const char *channel = astman_get_header(m, "ZapChannel");
+ struct dahdi_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "DAHDIChannel");
const char *number = astman_get_header(m, "Number");
int i;
@@ -12634,25 +12789,25 @@ static int action_zapdialoffhook(struct mansession *s, const struct message *m)
}
for (i = 0; i < strlen(number); i++) {
struct ast_frame f = { AST_FRAME_DTMF, number[i] };
- zap_queue_frame(p, &f, NULL);
+ dahdi_queue_frame(p, &f, NULL);
}
- astman_send_ack(s, m, "ZapDialOffhook");
+ astman_send_ack(s, m, "DAHDIDialOffhook");
return 0;
}
-static int action_zapshowchannels(struct mansession *s, const struct message *m)
+static int action_dahdishowchannels(struct mansession *s, const struct message *m)
{
- struct zt_pvt *tmp = NULL;
+ struct dahdi_pvt *tmp = NULL;
const char *id = astman_get_header(m, "ActionID");
- const char *zapchannel = astman_get_header(m, "ZapChannel");
+ const char *dahdichannel = astman_get_header(m, "DAHDIChannel");
char idText[256] = "";
int channels = 0;
- int zapchanquery = -1;
- if (!ast_strlen_zero(zapchannel)) {
- zapchanquery = atoi(zapchannel);
+ int dahdichanquery = -1;
+ if (!ast_strlen_zero(dahdichannel)) {
+ dahdichanquery = atoi(dahdichannel);
}
- astman_send_ack(s, m, "Zapata channel status will follow");
+ astman_send_ack(s, m, "DAHDI channel status will follow");
if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
@@ -12664,15 +12819,15 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m)
int alarm = get_alarms(tmp);
/* If a specific channel is queried for, only deliver status for that channel */
- if (zapchanquery > 0 && tmp->channel != zapchanquery)
+ if (dahdichanquery > 0 && tmp->channel != dahdichanquery)
continue;
channels++;
if (tmp->owner) {
/* Add data if we have a current call */
astman_append(s,
- "Event: ZapShowChannels\r\n"
- "ZapChannel: %d\r\n"
+ "Event: DAHDIShowChannels\r\n"
+ "DAHDIChannel: %d\r\n"
"Channel: %s\r\n"
"Uniqueid: %s\r\n"
"AccountCode: %s\r\n"
@@ -12694,8 +12849,8 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m)
alarm2str(alarm), idText);
} else {
astman_append(s,
- "Event: ZapShowChannels\r\n"
- "ZapChannel: %d\r\n"
+ "Event: DAHDIShowChannels\r\n"
+ "DAHDIChannel: %d\r\n"
"Signalling: %s\r\n"
"SignallingCode: %d\r\n"
"Context: %s\r\n"
@@ -12716,7 +12871,7 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m)
ast_mutex_unlock(&iflock);
astman_append(s,
- "Event: ZapShowChannelsComplete\r\n"
+ "Event: DAHDIShowChannelsComplete\r\n"
"%s"
"Items: %d\r\n"
"\r\n",
@@ -12728,7 +12883,7 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m)
static int __unload_module(void)
{
int x;
- struct zt_pvt *p, *pl;
+ struct dahdi_pvt *p, *pl;
#if defined(HAVE_PRI) || defined(HAVE_SS7)
int i;
#endif
@@ -12738,19 +12893,19 @@ static int __unload_module(void)
if (pris[i].master != AST_PTHREADT_NULL)
pthread_cancel(pris[i].master);
}
- ast_cli_unregister_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(struct ast_cli_entry));
- ast_unregister_application(zap_send_keypad_facility_app);
+ ast_cli_unregister_multiple(dahdi_pri_cli, sizeof(dahdi_pri_cli) / sizeof(struct ast_cli_entry));
+ ast_unregister_application(dahdi_send_keypad_facility_app);
#endif
- ast_cli_unregister_multiple(zap_cli, sizeof(zap_cli) / sizeof(struct ast_cli_entry));
- ast_manager_unregister( "ZapDialOffhook" );
- ast_manager_unregister( "ZapHangup" );
- ast_manager_unregister( "ZapTransfer" );
- ast_manager_unregister( "ZapDNDoff" );
- ast_manager_unregister( "ZapDNDon" );
- ast_manager_unregister("ZapShowChannels");
- ast_manager_unregister("ZapRestart");
- ast_channel_unregister(&zap_tech);
+ ast_cli_unregister_multiple(dahdi_cli, sizeof(dahdi_cli) / sizeof(struct ast_cli_entry));
+ ast_manager_unregister( "DAHDIDialOffhook" );
+ ast_manager_unregister( "DAHDIHangup" );
+ ast_manager_unregister( "DAHDITransfer" );
+ ast_manager_unregister( "DAHDIDNDoff" );
+ ast_manager_unregister( "DAHDIDNDon" );
+ ast_manager_unregister("DAHDIShowChannels");
+ ast_manager_unregister("DAHDIRestart");
+ ast_channel_unregister(&dahdi_tech);
ast_mutex_lock(&iflock);
/* Hangup all interfaces if they have an owner */
p = iflist;
@@ -12776,15 +12931,15 @@ static int __unload_module(void)
/* Free any callerid */
if (p->cidspill)
ast_free(p->cidspill);
- /* Close the zapata thingy */
+ /* Close the DAHDI thingy */
if (p->subs[SUB_REAL].zfd > -1)
- zt_close(p->subs[SUB_REAL].zfd);
+ dahdi_close(p->subs[SUB_REAL].zfd);
pl = p;
p = p->next;
x = pl->channel;
/* Free associated memory */
if (pl)
- destroy_zt_pvt(&pl);
+ destroy_dahdi_pvt(&pl);
ast_verb(3, "Unregistered channel %d\n", x);
}
iflist = NULL;
@@ -12795,7 +12950,7 @@ static int __unload_module(void)
for (i = 0; i < NUM_SPANS; i++) {
if (pris[i].master && (pris[i].master != AST_PTHREADT_NULL))
pthread_join(pris[i].master, NULL);
- zt_close(pris[i].fds[i]);
+ dahdi_close(pris[i].fds[i]);
}
#endif /* HAVE_PRI */
@@ -12803,7 +12958,7 @@ static int __unload_module(void)
for (i = 0; i < NUM_SPANS; i++) {
if (linksets[i].master && (linksets[i].master != AST_PTHREADT_NULL))
pthread_join(linksets[i].master, NULL);
- zt_close(linksets[i].fds[i]);
+ dahdi_close(linksets[i].fds[i]);
}
#endif /* HAVE_SS7 */
@@ -12813,12 +12968,12 @@ static int __unload_module(void)
#ifdef HAVE_SS7
static int linkset_addsigchan(int sigchan)
{
- struct zt_ss7 *link;
+ struct dahdi_ss7 *link;
int res;
int curfd;
- ZT_PARAMS p;
- ZT_BUFFERINFO bi;
- struct zt_spaninfo si;
+ DAHDI_PARAMS p;
+ DAHDI_BUFFERINFO bi;
+ struct dahdi_spaninfo si;
link = ss7_resolve_linkset(cur_linkset);
@@ -12858,48 +13013,44 @@ static int linkset_addsigchan(int sigchan)
}
curfd = link->numsigchans;
- link->fds[curfd] = open("/dev/zap/channel", O_RDWR, 0600);
- if ((link->fds[curfd] < 0) || (ioctl(link->fds[curfd],ZT_SPECIFY,&sigchan) == -1)) {
+ link->fds[curfd] = open("/dev/dahdi/channel", O_RDWR, 0600);
+ if ((link->fds[curfd] < 0) || (ioctl(link->fds[curfd],DAHDI_SPECIFY,&sigchan) == -1)) {
ast_log(LOG_ERROR, "Unable to open SS7 sigchan %d (%s)\n", sigchan, strerror(errno));
return -1;
}
- res = ioctl(link->fds[curfd], ZT_GET_PARAMS, &p);
+ res = ioctl(link->fds[curfd], DAHDI_GET_PARAMS, &p);
if (res) {
- zt_close(link->fds[curfd]);
+ dahdi_close(link->fds[curfd]);
link->fds[curfd] = -1;
ast_log(LOG_ERROR, "Unable to get parameters for sigchan %d (%s)\n", sigchan, strerror(errno));
return -1;
}
- if ((p.sigtype != ZT_SIG_HDLCFCS) && (p.sigtype != ZT_SIG_HARDHDLC)
-#if defined(HAVE_ZAPTEL_SIG_MTP2)
- && (p.sigtype != ZT_SIG_MTP2)
-#endif
- ) {
- zt_close(link->fds[curfd]);
+ if ((p.sigtype != DAHDI_SIG_HDLCFCS) && (p.sigtype != DAHDI_SIG_HARDHDLC) && (p.sigtype != DAHDI_SIG_MTP2)) {
+ dahdi_close(link->fds[curfd]);
link->fds[curfd] = -1;
- ast_log(LOG_ERROR, "sigchan %d is not in HDLC/FCS mode. See /etc/zaptel.conf\n", sigchan);
+ ast_log(LOG_ERROR, "sigchan %d is not in HDLC/FCS mode. See /etc/dahdi.conf\n", sigchan);
return -1;
}
- bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+ bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
+ bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
bi.numbufs = 32;
bi.bufsize = 512;
- if (ioctl(link->fds[curfd], ZT_SET_BUFINFO, &bi)) {
+ if (ioctl(link->fds[curfd], DAHDI_SET_BUFINFO, &bi)) {
ast_log(LOG_ERROR, "Unable to set appropriate buffering on channel %d\n", sigchan);
- zt_close(link->fds[curfd]);
+ dahdi_close(link->fds[curfd]);
link->fds[curfd] = -1;
return -1;
}
- ss7_add_link(link->ss7, SS7_TRANSPORT_ZAP, link->fds[curfd]);
+ ss7_add_link(link->ss7, SS7_TRANSPORT_DAHDI, link->fds[curfd]);
link->numsigchans++;
memset(&si, 0, sizeof(si));
- res = ioctl(link->fds[curfd], ZT_SPANSTAT, &si);
+ res = ioctl(link->fds[curfd], DAHDI_SPANSTAT, &si);
if (res) {
- zt_close(link->fds[curfd]);
+ dahdi_close(link->fds[curfd]);
link->fds[curfd] = -1;
ast_log(LOG_ERROR, "Unable to get span state for sigchan %d (%s)\n", sigchan, strerror(errno));
}
@@ -13112,7 +13263,7 @@ static char *handle_ss7_unblock_cic(struct ast_cli_entry *e, int cmd, struct ast
static char *handle_ss7_show_linkset(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int linkset;
- struct zt_ss7 *ss7;
+ struct dahdi_ss7 *ss7;
switch (cmd) {
case CLI_INIT:
e->command = "ss7 show linkset";
@@ -13158,7 +13309,7 @@ static char *handle_ss7_version(struct ast_cli_entry *e, int cmd, struct ast_cli
return CLI_SUCCESS;
}
-static struct ast_cli_entry zap_ss7_cli[] = {
+static struct ast_cli_entry dahdi_ss7_cli[] = {
AST_CLI_DEFINE(handle_ss7_debug, "Enables SS7 debugging on a linkset"),
AST_CLI_DEFINE(handle_ss7_no_debug, "Disables SS7 debugging on a linkset"),
AST_CLI_DEFINE(handle_ss7_block_cic, "Disables SS7 debugging on a linkset"),
@@ -13184,13 +13335,13 @@ static int unload_module(void)
return __unload_module();
}
-static int build_channels(struct zt_chan_conf *conf, int iscrv, const char *value, int reload, int lineno, int *found_pseudo)
+static int build_channels(struct dahdi_chan_conf *conf, int iscrv, const char *value, int reload, int lineno, int *found_pseudo)
{
char *c, *chan;
int x, start, finish;
- struct zt_pvt *tmp;
+ struct dahdi_pvt *tmp;
#ifdef HAVE_PRI
- struct zt_pri *pri;
+ struct dahdi_pri *pri;
int trunkgroup, y;
#endif
@@ -13272,15 +13423,14 @@ static int build_channels(struct zt_chan_conf *conf, int iscrv, const char *valu
return 0;
}
-/** The length of the parameters list of 'zapchan'.
+/** The length of the parameters list of 'dahdichan'.
* \todo Move definition of MAX_CHANLIST_LEN to a proper place. */
#define MAX_CHANLIST_LEN 80
-#if defined(HAVE_ZAPTEL_ECHOCANPARAMS)
-static void process_echocancel(struct zt_chan_conf *confp, const char *data, unsigned int line)
+static void process_echocancel(struct dahdi_chan_conf *confp, const char *data, unsigned int line)
{
char *parse = ast_strdupa(data);
- char *params[ZT_MAX_ECHOCANPARAMS + 1];
+ char *params[DAHDI_MAX_ECHOCANPARAMS + 1];
unsigned int param_count;
unsigned int x;
@@ -13327,20 +13477,19 @@ static void process_echocancel(struct zt_chan_conf *confp, const char *data, uns
confp->chan.echocancel.head.param_count++;
}
}
-#endif /* defined(HAVE_ZAPTEL_ECHOCANPARAMS) */
-/*! process_zap() - ignore keyword 'channel' and similar */
-#define PROC_ZAP_OPT_NOCHAN (1 << 0)
-/*! process_zap() - No warnings on non-existing cofiguration keywords */
-#define PROC_ZAP_OPT_NOWARN (1 << 1)
+/*! process_dahdi() - ignore keyword 'channel' and similar */
+#define PROC_DAHDI_OPT_NOCHAN (1 << 0)
+/*! process_dahdi() - No warnings on non-existing cofiguration keywords */
+#define PROC_DAHDI_OPT_NOWARN (1 << 1)
-static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int reload, int options)
+static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v, int reload, int options)
{
- struct zt_pvt *tmp;
+ struct dahdi_pvt *tmp;
const char *ringc; /* temporary string for parsing the dring number. */
int y;
int found_pseudo = 0;
- char zapchan[MAX_CHANLIST_LEN] = {};
+ char dahdichan[MAX_CHANLIST_LEN] = {};
for (; v; v = v->next) {
if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
@@ -13358,13 +13507,13 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
#endif
) {
int iscrv;
- if (options && PROC_ZAP_OPT_NOCHAN)
+ if (options && PROC_DAHDI_OPT_NOCHAN)
continue;
iscrv = !strcasecmp(v->name, "crv");
if (build_channels(confp, iscrv, v->value, reload, v->lineno, &found_pseudo))
return -1;
- } else if (!strcasecmp(v->name, "zapchan")) {
- ast_copy_string(zapchan, v->value, sizeof(zapchan));
+ } else if (!strcasecmp(v->name, "dahdichan")) {
+ ast_copy_string(dahdichan, v->value, sizeof(dahdichan));
} else if (!strcasecmp(v->name, "usedistinctiveringdetection")) {
usedistinctiveringdetection = ast_true(v->value);
} else if (!strcasecmp(v->name, "distinctiveringaftercid")) {
@@ -13458,16 +13607,7 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
} else if (!strcasecmp(v->value, "both") || ast_true(v->value))
confp->chan.callprogress |= CALLPROGRESS_FAX_INCOMING | CALLPROGRESS_FAX_OUTGOING;
} else if (!strcasecmp(v->name, "echocancel")) {
-#if defined(HAVE_ZAPTEL_ECHOCANPARAMS)
process_echocancel(confp, v->value, v->lineno);
-#else
- y = ast_strlen_zero(v->value) ? 0 : atoi(v->value);
-
- if ((y == 32) || (y == 64) || (y == 128) || (y == 256) || (y == 512) || (y == 1024))
- confp->chan.echocancel = y;
- else if ((confp->chan.echocancel = ast_true(v->value)))
- confp->chan.echocancel = 128;
-#endif
} else if (!strcasecmp(v->name, "echotraining")) {
if (sscanf(v->value, "%d", &y) == 1) {
if ((y < 10) || (y > 4000)) {
@@ -13573,8 +13713,8 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
ast_copy_string(confp->chan.cid_name, v->value, sizeof(confp->chan.cid_name));
} else if (!strcasecmp(v->name, "cid_number")) {
ast_copy_string(confp->chan.cid_num, v->value, sizeof(confp->chan.cid_num));
- } else if (!strcasecmp(v->name, "useincomingcalleridonzaptransfer")) {
- confp->chan.zaptrcallerid = ast_true(v->value);
+ } else if (!strcasecmp(v->name, "useincomingcalleridondahditransfer")) {
+ confp->chan.dahditrcallerid = ast_true(v->value);
} else if (!strcasecmp(v->name, "restrictcid")) {
confp->chan.restrictcid = ast_true(v->value);
} else if (!strcasecmp(v->name, "usecallingpres")) {
@@ -13868,15 +14008,15 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
ast_copy_string(confp->pri.idledial, v->value, sizeof(confp->pri.idledial));
} else if (!strcasecmp(v->name, "overlapdial")) {
if (ast_true(v->value)) {
- confp->pri.overlapdial = ZAP_OVERLAPDIAL_BOTH;
+ confp->pri.overlapdial = DAHDI_OVERLAPDIAL_BOTH;
} else if (!strcasecmp(v->value, "incoming")) {
- confp->pri.overlapdial = ZAP_OVERLAPDIAL_INCOMING;
+ confp->pri.overlapdial = DAHDI_OVERLAPDIAL_INCOMING;
} else if (!strcasecmp(v->value, "outgoing")) {
- confp->pri.overlapdial = ZAP_OVERLAPDIAL_OUTGOING;
+ confp->pri.overlapdial = DAHDI_OVERLAPDIAL_OUTGOING;
} else if (!strcasecmp(v->value, "both") || ast_true(v->value)) {
- confp->pri.overlapdial = ZAP_OVERLAPDIAL_BOTH;
+ confp->pri.overlapdial = DAHDI_OVERLAPDIAL_BOTH;
} else {
- confp->pri.overlapdial = ZAP_OVERLAPDIAL_NONE;
+ confp->pri.overlapdial = DAHDI_OVERLAPDIAL_NONE;
}
} else if (!strcasecmp(v->name, "pritimer")) {
#ifdef PRI_GETSET_TIMERS
@@ -13973,7 +14113,7 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
/* setup to scan our argument */
int element_count, c[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int i;
- struct zt_ring_cadence new_cadence;
+ struct dahdi_ring_cadence new_cadence;
int cid_location = -1;
int firstcadencepos = 0;
char original_args[80];
@@ -14009,7 +14149,7 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
} else {
if (firstcadencepos == 0) {
firstcadencepos = i; /* only recorded to avoid duplicate specification */
- /* duration will be passed negative to the Zaptel driver */
+ /* duration will be passed negative to the DAHDI driver */
} else {
ast_log(LOG_ERROR, "First cadence position specified twice: %s at line %d.\n", original_args, v->lineno);
cadence_is_ok = 0;
@@ -14071,11 +14211,11 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
int toneduration;
int ctlfd;
int res;
- struct zt_dialparams dps;
+ struct dahdi_dialparams dps;
- ctlfd = open("/dev/zap/ctl", O_RDWR);
+ ctlfd = open("/dev/dahdi/ctl", O_RDWR);
if (ctlfd == -1) {
- ast_log(LOG_ERROR, "Unable to open /dev/zap/ctl to set toneduration at line %d.\n", v->lineno);
+ ast_log(LOG_ERROR, "Unable to open /dev/dahdi/ctl to set toneduration at line %d.\n", v->lineno);
return -1;
}
@@ -14084,7 +14224,7 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
memset(&dps, 0, sizeof(dps));
dps.dtmf_tonelen = dps.mfv1_tonelen = toneduration;
- res = ioctl(ctlfd, ZT_SET_DIALPARAMS, &dps);
+ res = ioctl(ctlfd, DAHDI_SET_DIALPARAMS, &dps);
if (res < 0) {
ast_log(LOG_ERROR, "Invalid tone duration: %d ms at line %d.\n", toneduration, v->lineno);
return -1;
@@ -14098,13 +14238,13 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
} else if (!strcasecmp(v->name, "mwilevel")) {
mwilevel = atoi(v->value);
}
- } else if (!(options && PROC_ZAP_OPT_NOWARN) )
+ } else if (!(options && PROC_DAHDI_OPT_NOWARN) )
ast_log(LOG_WARNING, "Ignoring %s at line %d.\n", v->name, v->lineno);
}
- if (zapchan[0]) {
- /* The user has set 'zapchan' */
+ if (dahdichan[0]) {
+ /* The user has set 'dahdichan' */
/*< \todo pass proper line number instead of 0 */
- if (build_channels(confp, 0, zapchan, reload, 0, &found_pseudo)) {
+ if (build_channels(confp, 0, dahdichan, reload, 0, &found_pseudo)) {
return -1;
}
}
@@ -14129,12 +14269,12 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
return 0;
}
-static int setup_zap(int reload)
+static int setup_dahdi(int reload)
{
struct ast_config *cfg, *ucfg;
struct ast_variable *v;
- struct zt_chan_conf base_conf = zt_chan_conf_default();
- struct zt_chan_conf conf;
+ struct dahdi_chan_conf base_conf = dahdi_chan_conf_default();
+ struct dahdi_chan_conf conf;
struct ast_flags config_flags = { reload == 1 ? CONFIG_FLAG_FILEUNCHANGED : 0 };
const char *cat;
int res;
@@ -14181,22 +14321,22 @@ static int setup_zap(int reload)
while (c && (i < NUM_DCHANS)) {
dchannels[i] = atoi(c + 1);
if (dchannels[i] < 0) {
- ast_log(LOG_WARNING, "D-channel for trunk group %d must be a postiive number at line %d of zapata.conf\n", trunkgroup, v->lineno);
+ ast_log(LOG_WARNING, "D-channel for trunk group %d must be a postiive number at line %d of chan_dahdi.conf\n", trunkgroup, v->lineno);
} else
i++;
c = strchr(c + 1, ',');
}
if (i) {
if (pri_create_trunkgroup(trunkgroup, dchannels)) {
- ast_log(LOG_WARNING, "Unable to create trunk group %d with Primary D-channel %d at line %d of zapata.conf\n", trunkgroup, dchannels[0], v->lineno);
+ ast_log(LOG_WARNING, "Unable to create trunk group %d with Primary D-channel %d at line %d of chan_dahdi.conf\n", trunkgroup, dchannels[0], v->lineno);
} else
ast_verb(2, "Created trunk group %d with Primary D-channel %d and %d backup%s\n", trunkgroup, dchannels[0], i - 1, (i == 1) ? "" : "s");
} else
- ast_log(LOG_WARNING, "Trunk group %d lacks any valid D-channels at line %d of zapata.conf\n", trunkgroup, v->lineno);
+ ast_log(LOG_WARNING, "Trunk group %d lacks any valid D-channels at line %d of chan_dahdi.conf\n", trunkgroup, v->lineno);
} else
- ast_log(LOG_WARNING, "Trunk group %d lacks a primary D-channel at line %d of zapata.conf\n", trunkgroup, v->lineno);
+ ast_log(LOG_WARNING, "Trunk group %d lacks a primary D-channel at line %d of chan_dahdi.conf\n", trunkgroup, v->lineno);
} else
- ast_log(LOG_WARNING, "Trunk group identifier must be a positive integer at line %d of zapata.conf\n", v->lineno);
+ ast_log(LOG_WARNING, "Trunk group identifier must be a positive integer at line %d of chan_dahdi.conf\n", v->lineno);
} else if (!strcasecmp(v->name, "spanmap")) {
spanno = atoi(v->value);
if (spanno > 0) {
@@ -14213,13 +14353,13 @@ static int setup_zap(int reload)
} else
ast_verb(2, "Mapped span %d to trunk group %d (logical span %d)\n", spanno, trunkgroup, logicalspan);
} else
- ast_log(LOG_WARNING, "Logical span must be a postive number, or '0' (for unspecified) at line %d of zapata.conf\n", v->lineno);
+ ast_log(LOG_WARNING, "Logical span must be a postive number, or '0' (for unspecified) at line %d of chan_dahdi.conf\n", v->lineno);
} else
- ast_log(LOG_WARNING, "Trunk group must be a postive number at line %d of zapata.conf\n", v->lineno);
+ ast_log(LOG_WARNING, "Trunk group must be a postive number at line %d of chan_dahdi.conf\n", v->lineno);
} else
- ast_log(LOG_WARNING, "Missing trunk group for span map at line %d of zapata.conf\n", v->lineno);
+ ast_log(LOG_WARNING, "Missing trunk group for span map at line %d of chan_dahdi.conf\n", v->lineno);
} else
- ast_log(LOG_WARNING, "Span number must be a postive integer at line %d of zapata.conf\n", v->lineno);
+ ast_log(LOG_WARNING, "Span number must be a postive integer at line %d of chan_dahdi.conf\n", v->lineno);
} else {
ast_log(LOG_NOTICE, "Ignoring unknown keyword '%s' in trunkgroups\n", v->name);
}
@@ -14234,7 +14374,7 @@ static int setup_zap(int reload)
mwimonitornotify[0] = '\0';
v = ast_variable_browse(cfg, "channels");
- if ((res = process_zap(&base_conf, v, reload, 0))) {
+ if ((res = process_dahdi(&base_conf, v, reload, 0))) {
ast_mutex_unlock(&iflock);
ast_config_destroy(cfg);
if (ucfg) {
@@ -14243,7 +14383,7 @@ static int setup_zap(int reload)
return res;
}
- /* Now get configuration from all normal sections in zapata.conf: */
+ /* Now get configuration from all normal sections in chan_dahdi.conf: */
for (cat = ast_category_browse(cfg, NULL); cat ; cat = ast_category_browse(cfg, cat)) {
/* [channels] and [trunkgroups] are used. Let's also reserve
* [globals] and [general] for future use
@@ -14257,7 +14397,7 @@ static int setup_zap(int reload)
memcpy(&conf, &base_conf, sizeof(conf));
- if ((res = process_zap(&conf, ast_variable_browse(cfg, cat), reload, PROC_ZAP_OPT_NOCHAN))) {
+ if ((res = process_dahdi(&conf, ast_variable_browse(cfg, cat), reload, PROC_DAHDI_OPT_NOCHAN))) {
ast_mutex_unlock(&iflock);
ast_config_destroy(cfg);
if (ucfg) {
@@ -14272,14 +14412,14 @@ static int setup_zap(int reload)
if (ucfg) {
const char *chans;
- process_zap(&base_conf, ast_variable_browse(ucfg, "general"), 1, 0);
+ process_dahdi(&base_conf, ast_variable_browse(ucfg, "general"), 1, 0);
for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
if (!strcasecmp(cat, "general")) {
continue;
}
- chans = ast_variable_retrieve(ucfg, cat, "zapchan");
+ chans = ast_variable_retrieve(ucfg, cat, "dahdichan");
if (ast_strlen_zero(chans)) {
continue;
@@ -14287,7 +14427,7 @@ static int setup_zap(int reload)
memcpy(&conf, &base_conf, sizeof(conf));
- if ((res = process_zap(&conf, ast_variable_browse(ucfg, cat), reload, PROC_ZAP_OPT_NOCHAN | PROC_ZAP_OPT_NOWARN))) {
+ if ((res = process_dahdi(&conf, ast_variable_browse(ucfg, cat), reload, PROC_DAHDI_OPT_NOCHAN | PROC_DAHDI_OPT_NOWARN))) {
ast_config_destroy(ucfg);
ast_mutex_unlock(&iflock);
return res;
@@ -14346,10 +14486,10 @@ static int load_module(void)
for (i = 0; i < NUM_DCHANS; i++)
pris[y].fds[i] = -1;
}
- pri_set_error(zt_pri_error);
- pri_set_message(zt_pri_message);
- ast_register_application(zap_send_keypad_facility_app, zap_send_keypad_facility_exec,
- zap_send_keypad_facility_synopsis, zap_send_keypad_facility_descrip);
+ pri_set_error(dahdi_pri_error);
+ pri_set_message(dahdi_pri_message);
+ ast_register_application(dahdi_send_keypad_facility_app, dahdi_send_keypad_facility_exec,
+ dahdi_send_keypad_facility_synopsis, dahdi_send_keypad_facility_descrip);
#endif
#ifdef HAVE_SS7
memset(linksets, 0, sizeof(linksets));
@@ -14359,42 +14499,42 @@ static int load_module(void)
for (i = 0; i < NUM_DCHANS; i++)
linksets[y].fds[i] = -1;
}
- ss7_set_error(zt_ss7_error);
- ss7_set_message(zt_ss7_message);
+ ss7_set_error(dahdi_ss7_error);
+ ss7_set_message(dahdi_ss7_message);
#endif /* HAVE_SS7 */
- res = setup_zap(0);
- /* Make sure we can register our Zap channel type */
+ res = setup_dahdi(0);
+ /* Make sure we can register our DAHDI channel type */
if (res)
return AST_MODULE_LOAD_DECLINE;
- if (ast_channel_register(&zap_tech)) {
- ast_log(LOG_ERROR, "Unable to register channel class 'Zap'\n");
+ if (ast_channel_register(&dahdi_tech)) {
+ ast_log(LOG_ERROR, "Unable to register channel class 'DAHDI'\n");
__unload_module();
return AST_MODULE_LOAD_FAILURE;
}
#ifdef HAVE_PRI
ast_string_field_init(&inuse, 16);
ast_string_field_set(&inuse, name, "GR-303InUse");
- ast_cli_register_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(struct ast_cli_entry));
+ ast_cli_register_multiple(dahdi_pri_cli, sizeof(dahdi_pri_cli) / sizeof(struct ast_cli_entry));
#endif
#ifdef HAVE_SS7
- ast_cli_register_multiple(zap_ss7_cli, sizeof(zap_ss7_cli) / sizeof(zap_ss7_cli[0]));
+ ast_cli_register_multiple(dahdi_ss7_cli, sizeof(dahdi_ss7_cli) / sizeof(dahdi_ss7_cli[0]));
#endif
- ast_cli_register_multiple(zap_cli, sizeof(zap_cli) / sizeof(struct ast_cli_entry));
+ ast_cli_register_multiple(dahdi_cli, sizeof(dahdi_cli) / sizeof(struct ast_cli_entry));
memset(round_robin, 0, sizeof(round_robin));
- ast_manager_register( "ZapTransfer", 0, action_transfer, "Transfer Zap Channel" );
- ast_manager_register( "ZapHangup", 0, action_transferhangup, "Hangup Zap Channel" );
- ast_manager_register( "ZapDialOffhook", 0, action_zapdialoffhook, "Dial over Zap channel while offhook" );
- ast_manager_register( "ZapDNDon", 0, action_zapdndon, "Toggle Zap channel Do Not Disturb status ON" );
- ast_manager_register( "ZapDNDoff", 0, action_zapdndoff, "Toggle Zap channel Do Not Disturb status OFF" );
- ast_manager_register("ZapShowChannels", 0, action_zapshowchannels, "Show status zapata channels");
- ast_manager_register("ZapRestart", 0, action_zaprestart, "Fully Restart Zaptel channels (terminates calls)");
+ ast_manager_register( "DAHDITransfer", 0, action_transfer, "Transfer DAHDI Channel" );
+ ast_manager_register( "DAHDIHangup", 0, action_transferhangup, "Hangup DAHDI Channel" );
+ ast_manager_register( "DAHDIDialOffhook", 0, action_dahdidialoffhook, "Dial over DAHDI channel while offhook" );
+ ast_manager_register( "DAHDIDNDon", 0, action_dahdidndon, "Toggle DAHDI channel Do Not Disturb status ON" );
+ ast_manager_register( "DAHDIDNDoff", 0, action_dahdidndoff, "Toggle DAHDI channel Do Not Disturb status OFF" );
+ ast_manager_register("DAHDIShowChannels", 0, action_dahdishowchannels, "Show status DAHDI channels");
+ ast_manager_register("DAHDIRestart", 0, action_dahdirestart, "Fully Restart DAHDI channels (terminates calls)");
return res;
}
-static int zt_sendtext(struct ast_channel *c, const char *text)
+static int dahdi_sendtext(struct ast_channel *c, const char *text)
{
#define END_SILENCE_LEN 400
#define HEADER_MS 50
@@ -14403,7 +14543,7 @@ static int zt_sendtext(struct ast_channel *c, const char *text)
#define ASCII_BYTES_PER_CHAR 80
unsigned char *buf,*mybuf;
- struct zt_pvt *p = c->tech_pvt;
+ struct dahdi_pvt *p = c->tech_pvt;
struct pollfd fds[1];
int size,res,fd,len,x;
int bytes=0;
@@ -14413,7 +14553,7 @@ static int zt_sendtext(struct ast_channel *c, const char *text)
float scont = 0.0;
int index;
- index = zt_get_index(c, p, 0);
+ index = dahdi_get_index(c, p, 0);
if (index < 0) {
ast_log(LOG_WARNING, "Huh? I don't exist?\n");
return -1;
@@ -14498,22 +14638,22 @@ static int reload(void)
{
int res = 0;
- res = setup_zap(1);
+ res = setup_dahdi(1);
if (res) {
- ast_log(LOG_WARNING, "Reload of chan_zap.so is unsuccessful!\n");
+ ast_log(LOG_WARNING, "Reload of chan_dahdi.so is unsuccessful!\n");
return -1;
}
return 0;
}
/* This is a workaround so that menuselect displays a proper description
- * AST_MODULE_INFO(, , "Zapata Telephony"
+ * AST_MODULE_INFO(, , "DAHDI Telephony"
*/
-#ifdef ZAPATA_PRI
-#define tdesc "Zapata Telephony w/PRI"
+#ifdef DAHDI_PRI
+#define tdesc "DAHDI Telephony w/PRI"
#else
-#define tdesc "Zapata Telephony"
+#define tdesc "DAHDI Telephony"
#endif
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, tdesc,
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index d20cc1c2e..3ff7a256a 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -31,7 +31,7 @@
*/
/*** MODULEINFO
- <use>zaptel</use>
+ <use>dahdi</use>
<use>crypto</use>
***/
@@ -55,7 +55,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/stat.h>
#include <regex.h>
-#include "asterisk/zapata.h"
+#include "asterisk/dahdi.h"
#include "asterisk/paths.h" /* need ast_config_AST_DATA_DIR for firmware */
#include "asterisk/lock.h"
@@ -7238,17 +7238,17 @@ static int timing_read(int *id, int fd, short events, void *cbdata)
char buf[1024];
int res, processed = 0, totalcalls = 0;
struct iax2_trunk_peer *tpeer = NULL, *drop = NULL;
-#ifdef ZT_TIMERACK
+#ifdef DAHDI_TIMERACK
int x = 1;
#endif
struct timeval now = ast_tvnow();
if (iaxtrunkdebug)
ast_verbose("Beginning trunk processing. Trunk queue ceiling is %d bytes per host\n", trunkmaxsize);
if (events & AST_IO_PRI) {
-#ifdef ZT_TIMERACK
+#ifdef DAHDI_TIMERACK
/* Great, this is a timing interface, just call the ioctl */
- if (ioctl(fd, ZT_TIMERACK, &x)) {
- ast_log(LOG_WARNING, "Unable to acknowledge zap timer. IAX trunking will fail!\n");
+ if (ioctl(fd, DAHDI_TIMERACK, &x)) {
+ ast_log(LOG_WARNING, "Unable to acknowledge DAHDI timer. IAX trunking will fail!\n");
usleep(1);
return -1;
}
@@ -10366,7 +10366,7 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
} else if (!strcasecmp(v->name, "trunk")) {
ast_set2_flag(peer, ast_true(v->value), IAX_TRUNK);
if (ast_test_flag(peer, IAX_TRUNK) && (timingfd < 0)) {
- ast_log(LOG_WARNING, "Unable to support trunking on peer '%s' without zaptel timing\n", peer->name);
+ ast_log(LOG_WARNING, "Unable to support trunking on peer '%s' without DAHDI timing\n", peer->name);
ast_clear_flag(peer, IAX_TRUNK);
}
} else if (!strcasecmp(v->name, "auth")) {
@@ -10634,7 +10634,7 @@ static struct iax2_user *build_user(const char *name, struct ast_variable *v, st
} else if (!strcasecmp(v->name, "trunk")) {
ast_set2_flag(user, ast_true(v->value), IAX_TRUNK);
if (ast_test_flag(user, IAX_TRUNK) && (timingfd < 0)) {
- ast_log(LOG_WARNING, "Unable to support trunking on user '%s' without zaptel timing\n", user->name);
+ ast_log(LOG_WARNING, "Unable to support trunking on user '%s' without DAHDI timing\n", user->name);
ast_clear_flag(user, IAX_TRUNK);
}
} else if (!strcasecmp(v->name, "auth")) {
@@ -10828,14 +10828,14 @@ static void prune_peers(void)
static void set_timing(void)
{
-#ifdef HAVE_ZAPTEL
+#ifdef HAVE_DAHDI
int bs = trunkfreq * 8;
if (timingfd > -1) {
if (
-#ifdef ZT_TIMERACK
- ioctl(timingfd, ZT_TIMERCONFIG, &bs) &&
+#ifdef DAHDI_TIMERACK
+ ioctl(timingfd, DAHDI_TIMERCONFIG, &bs) &&
#endif
- ioctl(timingfd, ZT_SET_BLOCKSIZE, &bs))
+ ioctl(timingfd, DAHDI_SET_BLOCKSIZE, &bs))
ast_log(LOG_WARNING, "Unable to set blocksize on timing source\n");
}
#endif
@@ -12103,12 +12103,12 @@ static int load_module(void)
iax_set_error(iax_error_output);
jb_setoutput(jb_error_output, jb_warning_output, NULL);
-#ifdef HAVE_ZAPTEL
-#ifdef ZT_TIMERACK
- timingfd = open("/dev/zap/timer", O_RDWR);
+#ifdef HAVE_DAHDI
+#ifdef DAHDI_TIMERACK
+ timingfd = open("/dev/dahdi/timer", O_RDWR);
if (timingfd < 0)
#endif
- timingfd = open("/dev/zap/pseudo", O_RDWR);
+ timingfd = open("/dev/dahdi/pseudo", O_RDWR);
if (timingfd < 0)
ast_log(LOG_WARNING, "Unable to open IAX timing interface: %s\n", strerror(errno));
#endif
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 4dc9f671a..6cc7e66f0 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -2696,7 +2696,7 @@ static void *mgcp_ss(void *data)
ast_indicate(chan, -1);
} else {
/* XXX Redundant? We should already be playing dialtone */
- /*tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALTONE);*/
+ /*tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALTONE);*/
transmit_notify_request(sub, "L/dl");
}
if (ast_exists_extension(chan, chan->context, p->dtmf_buf, 1, p->cid_num)) {
@@ -2706,7 +2706,7 @@ static void *mgcp_ss(void *data)
ast_copy_string(p->call_forward, p->dtmf_buf, sizeof(p->call_forward));
ast_verb(3, "Setting call forward to '%s' on channel %s\n",
p->call_forward, chan->name);
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
if (res)
break;
@@ -2715,7 +2715,7 @@ static void *mgcp_ss(void *data)
ast_indicate(chan, -1);
sleep(1);
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALTONE);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALTONE);*/
transmit_notify_request(sub, "L/dl");
len = 0;
getforward = 0;
@@ -2729,7 +2729,7 @@ static void *mgcp_ss(void *data)
p->hidecallerid ? "" : p->cid_name,
chan->cid.cid_ani ? NULL : p->cid_num);
ast_setstate(chan, AST_STATE_RING);
- /*zt_enable_ec(p);*/
+ /*dahdi_enable_ec(p);*/
if (p->dtmfmode & MGCP_DTMF_HYBRID) {
p->dtmfmode |= MGCP_DTMF_INBAND;
ast_indicate(chan, -1);
@@ -2737,7 +2737,7 @@ static void *mgcp_ss(void *data)
res = ast_pbx_run(chan);
if (res) {
ast_log(LOG_WARNING, "PBX exited non-zero\n");
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);*/
/*transmit_notify_request(p, "nbz", 1);*/
transmit_notify_request(sub, "G/cg");
}
@@ -2750,9 +2750,9 @@ static void *mgcp_ss(void *data)
}
} else if (res == 0) {
ast_debug(1, "not enough digits (and no ambiguous match)...\n");
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);*/
transmit_notify_request(sub, "G/cg");
- /*zt_wait_event(p->subs[index].zfd);*/
+ /*dahdi_wait_event(p->subs[index].zfd);*/
ast_hangup(chan);
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
return NULL;
@@ -2760,7 +2760,7 @@ static void *mgcp_ss(void *data)
ast_verb(3, "Disabling call waiting on %s\n", chan->name);
/* Disable call waiting if enabled */
p->callwaiting = 0;
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
len = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
@@ -2772,7 +2772,7 @@ static void *mgcp_ss(void *data)
*/
if (ast_pickup_call(chan)) {
ast_log(LOG_WARNING, "No call pickup possible...\n");
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_CONGESTION);*/
transmit_notify_request(sub, "G/cg");
}
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
@@ -2783,7 +2783,7 @@ static void *mgcp_ss(void *data)
/* Disable Caller*ID if enabled */
p->hidecallerid = 1;
ast_set_callerid(chan, "", "", NULL);
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
len = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
@@ -2794,13 +2794,13 @@ static void *mgcp_ss(void *data)
res = ast_say_digit_str(chan, p->lastcallerid, "", chan->language);
}
if (!res)
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
break;
} else if (!strcmp(p->dtmf_buf, "*78")) {
/* Do not disturb */
ast_verb(3, "Enabled DND on channel %s\n", chan->name);
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
p->dnd = 1;
getforward = 0;
@@ -2809,21 +2809,21 @@ static void *mgcp_ss(void *data)
} else if (!strcmp(p->dtmf_buf, "*79")) {
/* Do not disturb */
ast_verb(3, "Disabled DND on channel %s\n", chan->name);
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
p->dnd = 0;
getforward = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
len = 0;
} else if (p->cancallforward && !strcmp(p->dtmf_buf, "*72")) {
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
getforward = 1;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
len = 0;
} else if (p->cancallforward && !strcmp(p->dtmf_buf, "*73")) {
ast_verb(3, "Cancelling call forwarding on channel %s\n", chan->name);
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
memset(p->call_forward, 0, sizeof(p->call_forward));
getforward = 0;
@@ -2840,7 +2840,7 @@ static void *mgcp_ss(void *data)
ast_verb(3, "Blacklisting number %s\n", p->lastcallerid);
res = ast_db_put("blacklist", p->lastcallerid, "1");
if (!res) {
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
len = 0;
@@ -2850,7 +2850,7 @@ static void *mgcp_ss(void *data)
/* Enable Caller*ID if enabled */
p->hidecallerid = 0;
ast_set_callerid(chan, p->cid_num, p->cid_name, NULL);
- /*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
+ /*res = tone_zone_play_tone(p->subs[index].zfd, DAHDI_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
len = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));