[svn-commits] jpeeler: branch jpeeler/chan_dahdi14 r119459 - /team/jpeeler/chan_dahdi14/cha...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri May 30 17:32:47 CDT 2008


Author: jpeeler
Date: Fri May 30 17:32:47 2008
New Revision: 119459

URL: http://svn.digium.com/view/asterisk?view=rev&rev=119459
Log:
convert a lot of stuff (hopefully all of it) to dahdi in chan_zap using sed

Modified:
    team/jpeeler/chan_dahdi14/channels/chan_zap.c

Modified: team/jpeeler/chan_dahdi14/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi14/channels/chan_zap.c?view=diff&rev=119459&r1=119458&r2=119459
==============================================================================
--- team/jpeeler/chan_dahdi14/channels/chan_zap.c (original)
+++ team/jpeeler/chan_dahdi14/channels/chan_zap.c Fri May 30 17:32:47 2008
@@ -18,19 +18,19 @@
 
 /*! \file
  *
- * \brief Zaptel Pseudo TDM interface 
+ * \brief DAHDI Pseudo TDM interface 
  *
  * \author Mark Spencer <markster at 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,8 @@
 
 /*** MODULEINFO
 	<depend>res_smdi</depend>
-	<depend>zaptel_vldtmf</depend>
-	<depend>zaptel</depend>
+	<depend>DAHDI_vldtmf</depend>
+	<depend>DAHDI</depend>
 	<depend>tonezone</depend>
 	<depend>res_features</depend>
 	<use>pri</use>
@@ -67,8 +67,8 @@
 #include <sys/ioctl.h>
 #include <math.h>
 #include <ctype.h>
-#include <zaptel/zaptel.h>
-#include <zaptel/tonezone.h>
+#include <dahdi/user.h>
+#include <dahdi/tonezone.h>
 
 #ifdef HAVE_PRI
 #include <libpri.h>
@@ -117,7 +117,7 @@
 static struct ast_jb_conf global_jbconf;
 
 #if !defined(DAHDI_SIG_EM_E1) || (defined(HAVE_PRI) && !defined(ZT_SIG_HARDHDLC))
-#error "Your zaptel is too old.  Please update"
+#error "Your DAHDI is too old.  Please update"
 #endif
 
 #ifndef DAHDI_TONEDETECT
@@ -145,7 +145,7 @@
  * 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
@@ -229,7 +229,7 @@
 /*! \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);
 
 
@@ -249,12 +249,12 @@
 
 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 int zt_sendtext(struct ast_channel *c, const char *text);
-
-/*! \brief Avoid the silly zt_getevent which ignores a bunch of events */
-static inline int zt_get_event(int fd)
+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 dahdi_sendtext(struct ast_channel *c, const char *text);
+
+/*! \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, DAHDI_GETEVENT, &j) == -1)
@@ -262,8 +262,8 @@
 	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 = DAHDI_IOMUX_SIGEVENT;
@@ -286,7 +286,7 @@
 #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;
 
@@ -297,7 +297,7 @@
 #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 */
@@ -333,13 +333,13 @@
 	int resetpos;
 	time_t lastreset;						/*!< time when unused channels were last reset */
 	long resetinterval;						/*!< Interval (in seconds) for resetting unused channels */
-	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)
@@ -347,14 +347,14 @@
 #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 */
@@ -366,7 +366,7 @@
 #define POLARITY_REV    1
 
 
-static struct zt_distRings drings;
+static struct dahdi_distRings drings;
 
 struct distRingData {
 	int ring[3];
@@ -374,7 +374,7 @@
 struct ringContextData {
 	char contextData[AST_MAX_CONTEXT];
 };
-struct zt_distRings {
+struct dahdi_distRings {
 	struct distRingData ringnum[3];
 	struct ringContextData ringContext[3];
 };
@@ -385,8 +385,8 @@
 	"Threeway"
 };
 
-struct zt_subchannel {
-	int zfd;
+struct dahdi_subchannel {
+	int dfd;
 	struct ast_channel *owner;
 	int chan;
 	short buffer[AST_FRIENDLY_OFFSET/2 + READ_SIZE];
@@ -409,29 +409,29 @@
 
 #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 zt_pvt *slaves[MAX_SLAVES];		/*!< Slave to us (follows our conferencing) */
-	struct zt_pvt *master;				/*!< Master to us (we follow their conferencing) */
+	struct dahdi_subchannel sub_unused;		/*!< Just a safety precaution */
+	struct dahdi_subchannel subs[3];			/*!< Sub-channels */
+	struct dahdi_confinfo saveconf;			/*!< Saved conference info */
+
+	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 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;
@@ -477,7 +477,7 @@
 	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 */
 #if defined(HAVE_PRI)
 	unsigned int alerting:1;
@@ -491,7 +491,7 @@
 	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];
@@ -565,9 +565,9 @@
 	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;
@@ -582,27 +582,27 @@
  * 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)
  *
- * @seealso zt_chan_init for the default values.
+ * @seealso 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
 	DAHDI_PARAMS timing;
 
 	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,
@@ -633,7 +633,7 @@
 
 			.cid_signalling = CID_SIG_BELL,
 			.cid_start = CID_START_RING,
-			.zaptrcallerid = 0,
+			.dahditrcallerid = 0,
 			.use_callerid = 1,
 			.sig = -1,
 			.outsigmod = -1,
@@ -670,40 +670,40 @@
 }
 
 
-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, 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, 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
@@ -712,10 +712,10 @@
 #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 */
@@ -735,7 +735,7 @@
 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 */
@@ -759,7 +759,7 @@
 #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)
@@ -777,9 +777,9 @@
 }
 
 #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
@@ -805,9 +805,9 @@
 }
 
 #ifdef HAVE_PRI
-static void zap_queue_frame(struct zt_pvt *p, struct ast_frame *f, struct zt_pri *pri)
+static void dahdi_queue_frame(struct dahdi_pvt *p, struct ast_frame *f, struct dahdi_pri *pri)
 #else
-static void zap_queue_frame(struct zt_pvt *p, struct ast_frame *f, void *pri)
+static void dahdi_queue_frame(struct dahdi_pvt *p, struct ast_frame *f, void *pri)
 #endif
 {
 	/* We must unlock the PRI to avoid the possibility of a deadlock */
@@ -833,9 +833,9 @@
 #endif		
 }
 
-static int restore_gains(struct zt_pvt *p);
-
-static void swap_subs(struct zt_pvt *p, int a, int b)
+static int restore_gains(struct dahdi_pvt *p);
+
+static void swap_subs(struct dahdi_pvt *p, int a, int b)
 {
 	int tchan;
 	int tinthreeway;
@@ -856,14 +856,14 @@
 	p->subs[b].inthreeway = tinthreeway;
 
 	if (p->subs[a].owner) 
-		p->subs[a].owner->fds[0] = p->subs[a].zfd;
+		p->subs[a].owner->fds[0] = p->subs[a].dfd;
 	if (p->subs[b].owner) 
-		p->subs[b].owner->fds[0] = p->subs[b].zfd;
+		p->subs[b].owner->fds[0] = p->subs[b].dfd;
 	wakeup_sub(p, a, NULL);
 	wakeup_sub(p, b, NULL);
 }
 
-static int zt_open(char *fn)
+static int dahdi_open(char *fn)
 {
 	int fd;
 	int isnum;
@@ -883,7 +883,7 @@
 			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) {
@@ -910,48 +910,48 @@
 	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 dfd, int linear)
 {
 	int res;
-	res = ioctl(zfd, DAHDI_SETLINEAR, &linear);
+	res = ioctl(dfd, 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)
 {
 	DAHDI_BUFFERINFO bi;
 	int res;
-	if (p->subs[x].zfd < 0) {
-		p->subs[x].zfd = zt_open("/dev/zap/pseudo");
-		if (p->subs[x].zfd > -1) {
-			res = ioctl(p->subs[x].zfd, DAHDI_GET_BUFINFO, &bi);
+	if (p->subs[x].dfd < 0) {
+		p->subs[x].dfd = dahdi_open("/dev/dahdi/pseudo");
+		if (p->subs[x].dfd > -1) {
+			res = ioctl(p->subs[x].dfd, DAHDI_GET_BUFINFO, &bi);
 			if (!res) {
 				bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
 				bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
 				bi.numbufs = numbufs;
-				res = ioctl(p->subs[x].zfd, DAHDI_SET_BUFINFO, &bi);
+				res = ioctl(p->subs[x].dfd, 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, 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);
-				p->subs[x].zfd = -1;
+			if (ioctl(p->subs[x].dfd, 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].dfd);
+				dahdi_close(p->subs[x].dfd);
+				p->subs[x].dfd = -1;
 				return -1;
 			}
 			if (option_debug)
-				ast_log(LOG_DEBUG, "Allocated %s subchannel on FD %d channel %d\n", subnames[x], p->subs[x].zfd, p->subs[x].chan);
+				ast_log(LOG_DEBUG, "Allocated %s subchannel on FD %d channel %d\n", subnames[x], p->subs[x].dfd, p->subs[x].chan);
 			return 0;
 		} else
 			ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
@@ -961,17 +961,17 @@
 	return -1;
 }
 
-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);
 		return -1;
 	}
 	ast_log(LOG_DEBUG, "Released sub %d of channel %d\n", x, p->channel);
-	if (p->subs[x].zfd > -1) {
-		zt_close(p->subs[x].zfd);
-	}
-	p->subs[x].zfd = -1;
+	if (p->subs[x].dfd > -1) {
+		dahdi_close(p->subs[x].dfd);
+	}
+	p->subs[x].dfd = -1;
 	p->subs[x].linear = 0;
 	p->subs[x].chan = 0;
 	p->subs[x].owner = NULL;
@@ -997,9 +997,9 @@
 		return -1;
 }
 
-static int zt_digit_begin(struct ast_channel *chan, char digit)
-{
-	struct zt_pvt *pvt;
+static int dahdi_digit_begin(struct ast_channel *chan, char digit)
+{
+	struct dahdi_pvt *pvt;
 	int index;
 	int dtmf = -1;
 	
@@ -1007,7 +1007,7 @@
 
 	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;
@@ -1033,7 +1033,7 @@
 	if ((dtmf = digit_to_dtmfindex(digit)) == -1)
 		goto out;
 
-	if (pvt->pulse || ioctl(pvt->subs[SUB_REAL].zfd, DAHDI_SENDTONE, &dtmf)) {
+	if (pvt->pulse || ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_SENDTONE, &dtmf)) {
 		int res;
 		DAHDI_DIAL_OPERATION zo = {
 			.op = DAHDI_DIAL_OP_APPEND,
@@ -1041,7 +1041,7 @@
 			.dialstr[1] = digit,
 			.dialstr[2] = 0,
 		};
-		if ((res = ioctl(pvt->subs[SUB_REAL].zfd, DAHDI_DIAL, &zo)))
+		if ((res = ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_DIAL, &zo)))
 			ast_log(LOG_WARNING, "Couldn't dial digit %c\n", digit);
 		else
 			pvt->dialing = 1;
@@ -1057,9 +1057,9 @@
 	return 0;
 }
 
-static int zt_digit_end(struct ast_channel *chan, char digit, unsigned int duration)
-{
-	struct zt_pvt *pvt;
+static int dahdi_digit_end(struct ast_channel *chan, char digit, unsigned int duration)
+{
+	struct dahdi_pvt *pvt;
 	int res = 0;
 	int index;
 	int x;
@@ -1068,7 +1068,7 @@
 
 	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;
@@ -1082,7 +1082,7 @@
 	if (pvt->begindigit) {
 		x = -1;
 		ast_log(LOG_DEBUG, "Ending VLDTMF digit '%c'\n", digit);
-		res = ioctl(pvt->subs[SUB_REAL].zfd, DAHDI_SENDTONE, &x);
+		res = ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_SENDTONE, &x);
 		pvt->dialing = 0;
 		pvt->begindigit = 0;
 	}
@@ -1157,7 +1157,7 @@
 }
 #endif
 
-static char *zap_sig2str(int sig)
+static char *dahdi_sig2str(int sig)
 {
 	static char buf[256];
 	switch (sig) {
@@ -1217,9 +1217,9 @@
 	}
 }
 
-#define sig2str zap_sig2str
-
-static int conf_add(struct zt_pvt *p, struct zt_subchannel *c, int index, int slavechannel)
+#define sig2str dahdi_sig2str
+
+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 */
@@ -1243,21 +1243,21 @@
 	}
 	if ((zi.confno == c->curconf.confno) && (zi.confmode == c->curconf.confmode))
 		return 0;
-	if (c->zfd < 0)
+	if (c->dfd < 0)
 		return 0;
-	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);
+	if (ioctl(c->dfd, DAHDI_SETCONF, &zi)) {
+		ast_log(LOG_WARNING, "Failed to add %d to conference %d/%d\n", c->dfd, zi.confmode, zi.confno);
 		return -1;
 	}
 	if (slavechannel < 1) {
 		p->confno = zi.confno;
 	}
 	memcpy(&c->curconf, &zi, sizeof(c->curconf));
-	ast_log(LOG_DEBUG, "Added %d to conference %d/%d\n", c->zfd, c->curconf.confmode, c->curconf.confno);
+	ast_log(LOG_DEBUG, "Added %d to conference %d/%d\n", c->dfd, c->curconf.confmode, c->curconf.confno);
 	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 == DAHDI_CONF_DIGITALMON))
@@ -1268,11 +1268,11 @@
 	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)
 {
 	DAHDI_CONFINFO zi;
-	if (/* Can't delete if there's no zfd */
-		(c->zfd < 0) ||
+	if (/* Can't delete if there's no dfd */
+		(c->dfd < 0) ||
 		/* Don't delete from the conference if it's not our conference */
 		!isourconf(p, c)
 		/* Don't delete if we don't think it's conferenced at all (implied) */
@@ -1281,27 +1281,27 @@
 	zi.chan = 0;
 	zi.confno = 0;
 	zi.confmode = 0;
-	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);
+	if (ioctl(c->dfd, DAHDI_SETCONF, &zi)) {
+		ast_log(LOG_WARNING, "Failed to drop %d from conference %d/%d\n", c->dfd, c->curconf.confmode, c->curconf.confno);
 		return -1;
 	}
-	ast_log(LOG_DEBUG, "Removed %d from conference %d/%d\n", c->zfd, c->curconf.confmode, c->curconf.confno);
+	ast_log(LOG_DEBUG, "Removed %d from conference %d/%d\n", c->dfd, c->curconf.confmode, c->curconf.confno);
 	memcpy(&c->curconf, &zi, sizeof(c->curconf));
 	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 */
 	for (x = 0; x < 3; x++) {
 		/* Any three-way calling makes slave native mode *definitely* out
 		   of the question */
-		if ((p->subs[x].zfd > -1) && p->subs[x].inthreeway)
+		if ((p->subs[x].dfd > -1) && p->subs[x].inthreeway)
 			useslavenative = 0;
 	}
 	/* If we don't have any 3-way calls, check to see if we have
@@ -1334,31 +1334,31 @@
 	return useslavenative;
 }
 
-static int reset_conf(struct zt_pvt *p)
+static int reset_conf(struct dahdi_pvt *p)
 {
 	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, DAHDI_SETCONF, &zi))
+	if (p->subs[SUB_REAL].dfd > -1) {
+		if (ioctl(p->subs[SUB_REAL].dfd, 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 */
 	for (x = 0; x < 3; x++) {
 		/* Look for three way calls */
-		if ((p->subs[x].zfd > -1) && p->subs[x].inthreeway) {
+		if ((p->subs[x].dfd > -1) && p->subs[x].inthreeway) {
 			conf_add(p, &p->subs[x], x, 0);
 			needconf++;
 		} else {
@@ -1404,7 +1404,7 @@
 	return 0;
 }
 
-static void zt_enable_ec(struct zt_pvt *p)
+static void dahdi_enable_ec(struct dahdi_pvt *p)
 {
 	int x;
 	int res;
@@ -1421,12 +1421,12 @@
 	if (p->echocancel) {
 		if (p->sig == SIG_PRI) {
 			x = 1;
-			res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_AUDIOMODE, &x);
+			res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &x);
 			if (res)
 				ast_log(LOG_WARNING, "Unable to enable audio mode on channel %d (%s)\n", p->channel, strerror(errno));
 		}
 		x = p->echocancel;
-		res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_ECHOCANCEL, &x);
+		res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL, &x);
 		if (res) 
 			ast_log(LOG_WARNING, "Unable to enable echo cancellation on channel %d (%s)\n", p->channel, strerror(errno));
 		else {
@@ -1438,13 +1438,13 @@
 		ast_log(LOG_DEBUG, "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->echocancel && p->echotraining) {
 		x = p->echotraining;
-		res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_ECHOTRAIN, &x);
+		res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOTRAIN, &x);
 		if (res)
 			ast_log(LOG_WARNING, "Unable to request echo training on channel %d\n", p->channel);
 		else {
@@ -1454,13 +1454,13 @@
 		ast_log(LOG_DEBUG, "No echo training requested\n");
 }
 
-static void zt_disable_ec(struct zt_pvt *p)
+static void dahdi_disable_ec(struct dahdi_pvt *p)
 {
 	int x;
 	int res;
 	if (p->echocancel) {
 		x = 0;
-		res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_ECHOCANCEL, &x);
+		res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL, &x);
 		if (res)
 			ast_log(LOG_WARNING, "Unable to disable echo cancellation on channel %d\n", p->channel);
 		else if (option_debug)
@@ -1469,7 +1469,7 @@
 	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;
@@ -1503,7 +1503,7 @@
 	}
 }
 
-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;
@@ -1539,7 +1539,7 @@
 
 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));
@@ -1558,7 +1558,7 @@
 
 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));
@@ -1579,12 +1579,12 @@
 	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;
 
 	/* Bump receive gain by 5.0db */
-	res = set_actual_gain(p->subs[SUB_REAL].zfd, 0, p->rxgain + 5.0, p->txgain, p->law);
+	res = set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain + 5.0, p->txgain, p->law);
 	if (res) {
 		ast_log(LOG_WARNING, "Unable to bump gain: %s\n", strerror(errno));
 		return -1;
@@ -1593,11 +1593,11 @@
 	return 0;
 }
 
-static int restore_gains(struct zt_pvt *p)
+static int restore_gains(struct dahdi_pvt *p)
 {
 	int res;
 
-	res = set_actual_gain(p->subs[SUB_REAL].zfd, 0, p->rxgain, p->txgain, p->law);
+	res = set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->law);
 	if (res) {
 		ast_log(LOG_WARNING, "Unable to restore gains: %s\n", strerror(errno));
 		return -1;
@@ -1606,7 +1606,7 @@
 	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;
 
@@ -1616,38 +1616,38 @@
 	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) {
 		y = 1;
-		res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_AUDIOMODE, &y);
+		res = ioctl(p->subs[SUB_REAL].dfd, 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, DAHDI_CONFMUTE, &x);
+	res = ioctl(p->subs[SUB_REAL].dfd, 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)
-{
-	struct zt_confinfo c;
+static int save_conference(struct dahdi_pvt *p)
+{
+	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, DAHDI_GETCONF, &p->saveconf);
+	res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_GETCONF, &p->saveconf);
 	if (res) {
 		ast_log(LOG_WARNING, "Unable to get conference info: %s\n", strerror(errno));
 		p->saveconf.confmode = 0;
@@ -1656,7 +1656,7 @@
 	c.chan = 0;
 	c.confno = 0;
 	c.confmode = DAHDI_CONF_NORMAL;
-	res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_SETCONF, &c);
+	res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCONF, &c);
 	if (res) {
 		ast_log(LOG_WARNING, "Unable to set conference info: %s\n", strerror(errno));
 		return -1;
@@ -1666,11 +1666,11 @@
 	return 0;
 }
 
-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, DAHDI_SETCONF, &p->saveconf);
+		res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCONF, &p->saveconf);
 		p->saveconf.confmode = 0;
 		if (res) {
 			ast_log(LOG_WARNING, "Unable to restore conference info: %s\n", strerror(errno));
@@ -1682,9 +1682,9 @@
 	return 0;
 }
 
-static int send_callerid(struct zt_pvt *p);
-
-static int send_cwcidspill(struct zt_pvt *p)
+static int send_callerid(struct dahdi_pvt *p);
+
+static int send_cwcidspill(struct dahdi_pvt *p)
 {
 	p->callwaitcas = 0;
 	p->cidcwexpire = 0;
@@ -1700,23 +1700,23 @@
 	return 0;
 }
 
-static int has_voicemail(struct zt_pvt *p)
+static int has_voicemail(struct dahdi_pvt *p)
 {
 
 	return ast_app_has_voicemail(p->mailbox, NULL);
 }
 
-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].dfd, 0);
 	}
 	while (p->cidpos < p->cidlen) {
-		res = write(p->subs[SUB_REAL].zfd, p->cidspill + p->cidpos, p->cidlen - p->cidpos);
+		res = write(p->subs[SUB_REAL].dfd, p->cidspill + p->cidpos, p->cidlen - p->cidpos);
 		if (res < 0) {
 			if (errno == EAGAIN)
 				return 0;
@@ -1739,9 +1739,9 @@
 	return 0;
 }
 
-static int zt_callwait(struct ast_channel *ast)
-{
-	struct zt_pvt *p = ast->tech_pvt;
+static int dahdi_callwait(struct ast_channel *ast)
+{
+	struct dahdi_pvt *p = ast->tech_pvt;
 	p->callwaitingrepeat = CALLWAITING_REPEAT_SAMPLES;
 	if (p->cidspill) {
 		ast_log(LOG_WARNING, "Spill already exists?!?\n");
@@ -1767,9 +1767,9 @@
 	return 0;
 }
 
-static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
-{
-	struct zt_pvt *p = ast->tech_pvt;
+static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
+{
+	struct dahdi_pvt *p = ast->tech_pvt;
 	int x, res, index,mysig;
 	char *c, *n, *l;
 #ifdef HAVE_PRI
@@ -1785,7 +1785,7 @@
 		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;
 	}
@@ -1798,12 +1798,12 @@
 		return 0;
 	}
 	x = DAHDI_FLUSH_READ | ZT_FLUSH_WRITE;
-	res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_FLUSH, &x);
+	res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_FLUSH, &x);
 	if (res)
 		ast_log(LOG_WARNING, "Unable to flush input on channel %d\n", p->channel);
 	p->outgoing = 1;
 
-	set_actual_gain(p->subs[SUB_REAL].zfd, 0, p->rxgain, p->txgain, p->law);
+	set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->law);
 
 	mysig = p->sig;
 	if (p->outsigmod > -1)
@@ -1833,11 +1833,11 @@
 			}
 			/* Choose proper cadence */
 			if ((p->distinctivering > 0) && (p->distinctivering <= num_cadence)) {
-				if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_SETCADENCE, &cadences[p->distinctivering - 1]))
+				if (ioctl(p->subs[SUB_REAL].dfd, 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, DAHDI_SETCADENCE, NULL))
+				if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCADENCE, NULL))
 					ast_log(LOG_WARNING, "Unable to reset default ring on '%s'\n", ast->name);
 				p->cidrings = p->sendcalleridafter;
 			}
@@ -1858,7 +1858,7 @@
 				p->dop.dialstr[0] = '\0';
 			}
 			x = DAHDI_RING;
-			if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_HOOK, &x) && (errno != EINPROGRESS)) {
+			if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_HOOK, &x) && (errno != EINPROGRESS)) {
 				ast_log(LOG_WARNING, "Unable to ring phone: %s\n", strerror(errno));
 				ast_mutex_unlock(&p->lock);
 				return -1;
@@ -1876,12 +1876,12 @@
 			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, DAHDI_TONE_RINGTONE))
+			if (tone_zone_play_tone(p->subs[SUB_CALLWAIT].dfd, DAHDI_TONE_RINGTONE))
 				ast_log(LOG_WARNING, "Unable to generate call-wait ring-back on channel %s\n", ast->name);
 				
 		}
@@ -1896,7 +1896,7 @@
 		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;
 		}
@@ -1934,7 +1934,7 @@
 		if (!p->pri) {
 #endif
 			x = DAHDI_START;
-			res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_HOOK, &x);
+			res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_HOOK, &x);
 			if (res < 0) {
 				if (errno != EINPROGRESS) {
 					ast_log(LOG_WARNING, "Unable to start channel: %s\n", strerror(errno));
@@ -2013,9 +2013,9 @@
 		} else
 			p->echobreak = 0;
 		if (!res) {
-			if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_DIAL, &p->dop)) {
+			if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop)) {
 				x = DAHDI_ONHOOK;
-				ioctl(p->subs[SUB_REAL].zfd, DAHDI_HOOK, &x);
+				ioctl(p->subs[SUB_REAL].dfd, 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;
@@ -2204,9 +2204,9 @@
 	return 0;
 }
 
-static void destroy_zt_pvt(struct zt_pvt **pvt)
-{
-	struct zt_pvt *p = *pvt;
+static void destroy_dahdi_pvt(struct dahdi_pvt **pvt)
+{
+	struct dahdi_pvt *p = *pvt;
 	/* Remove channel from the list */
 	if (p->prev)
 		p->prev->next = p->next;
@@ -2219,7 +2219,7 @@
 	*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;
@@ -2248,10 +2248,10 @@
 				else
 					ifend = NULL;
 			}
-			if (cur->subs[SUB_REAL].zfd > -1) {
-				zt_close(cur->subs[SUB_REAL].zfd);
-			}
-			destroy_zt_pvt(&cur);
+			if (cur->subs[SUB_REAL].dfd > -1) {
+				dahdi_close(cur->subs[SUB_REAL].dfd);
+			}
+			destroy_dahdi_pvt(&cur);
 		}
 	} else {
 		if (prev) {
@@ -2267,27 +2267,27 @@
 			else
 				ifend = NULL;
 		}
-		if (cur->subs[SUB_REAL].zfd > -1) {
-			zt_close(cur->subs[SUB_REAL].zfd);
-		}
-		destroy_zt_pvt(&cur);
+		if (cur->subs[SUB_REAL].dfd > -1) {
+			dahdi_close(cur->subs[SUB_REAL].dfd);
+		}
+		destroy_dahdi_pvt(&cur);
 	}
 	return 0;
 }
 
 #ifdef HAVE_PRI
-static char *zap_send_keypad_facility_app = "ZapSendKeypadFacility";
-
-static char *zap_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_app = "DAHDISendKeypadFacility";
+
+static char *dahdi_send_keypad_facility_synopsis = "Send digits out of band over a PRI";
+
+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)) {
@@ -2295,7 +2295,7 @@
 		return -1;
 	}
 
-	p = (struct zt_pvt *)chan->tech_pvt;
+	p = (struct dahdi_pvt *)chan->tech_pvt;
 
 	if (!p) {
 		ast_log(LOG_DEBUG, "Unable to find technology private\n");
@@ -2324,7 +2324,7 @@
 	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++) {
@@ -2334,13 +2334,13 @@
 	return 0;
 }
 
-static int pri_assign_bearer(struct zt_pvt *crv, struct zt_pri *pri, struct zt_pvt *bearer)

[... 3875 lines stripped ...]



More information about the svn-commits mailing list