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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 5 14:42:29 CDT 2008


Author: jpeeler
Date: Thu Jun  5 14:42:29 2008
New Revision: 120825

URL: http://svn.digium.com/view/asterisk?view=rev&rev=120825
Log:
make use of the proper device nodes when using zaptel

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

Modified: team/jpeeler/chan_dahdi14/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi14/channels/chan_dahdi.c?view=diff&rev=120825&r1=120824&r2=120825
==============================================================================
--- team/jpeeler/chan_dahdi14/channels/chan_dahdi.c (original)
+++ team/jpeeler/chan_dahdi14/channels/chan_dahdi.c Thu Jun  5 14:42:29 2008
@@ -882,7 +882,11 @@
 			ast_log(LOG_WARNING, "Invalid channel number '%s'\n", fn);
 			return -1;
 		}
+#ifdef HAVE_ZAPTEL
+		fn = "/dev/zap/channel";
+#else
 		fn = "/dev/dahdi/channel";
+#endif
 	}
 	fd = open(fn, O_RDWR | O_NONBLOCK);
 	if (fd < 0) {
@@ -930,7 +934,11 @@
 	DAHDI_BUFFERINFO bi;
 	int res;
 	if (p->subs[x].dfd < 0) {
+#ifdef HAVE_ZAPTEL
+		p->subs[x].dfd = dahdi_open("/dev/zap/pseudo");
+#else
 		p->subs[x].dfd = dahdi_open("/dev/dahdi/pseudo");
+#endif
 		if (p->subs[x].dfd > -1) {
 			res = ioctl(p->subs[x].dfd, DAHDI_GET_BUFINFO, &bi);
 			if (!res) {
@@ -7078,7 +7086,11 @@
 			break;
 		memset(&si, 0, sizeof(si));
 		memset(&p, 0, sizeof(p));
+#ifdef HAVE_ZAPTEL
+		fd = open("/dev/zap/channel", O_RDWR);
+#else
 		fd = open("/dev/dahdi/channel", O_RDWR);
+#endif
 		if (fd < 0) {
 			ast_log(LOG_WARNING, "Failed to open channel: %s\n", strerror(errno));
 			return -1;
@@ -7721,7 +7733,11 @@
 	if ((p = ast_malloc(sizeof(*p)))) {
 		memcpy(p, src, sizeof(struct dahdi_pvt));
 		ast_mutex_init(&p->lock);
+#ifdef HAVE_ZAPTEL
+		p->subs[SUB_REAL].dfd = dahdi_open("/dev/zap/pseudo");
+#else
 		p->subs[SUB_REAL].dfd = dahdi_open("/dev/dahdi/pseudo");
+#endif
 		/* Allocate a DAHDI structure */
 		if (p->subs[SUB_REAL].dfd < 0) {
 			ast_log(LOG_ERROR, "Unable to dup channel: %s\n",  strerror(errno));
@@ -9459,7 +9475,11 @@
 	for (i = 0; i < NUM_DCHANS; i++) {
 		if (!pri->dchannels[i])
 			break;
-		pri->fds[i] = open("/dev/dahdi/channel", O_RDWR, 0600);
+#ifdef HAVE_ZAPTEL
+		pri->fds[i] = open("/dev/zap/channel", O_RDWR, 0600);
+#else
+		pri->fds[i] = open("/dev/zap/channel", O_RDWR, 0600);
+#endif
 		x = pri->dchannels[i];
 		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));
@@ -10143,7 +10163,11 @@
 	int ctl;
 	DAHDI_SPANINFO s;
 
+#ifdef HAVE_ZAPTEL
+	ctl = open("/dev/zap/ctl", O_RDWR);
+#else
 	ctl = open("/dev/dahdi/ctl", O_RDWR);
+#endif
 	if (ctl < 0) {
 		ast_log(LOG_WARNING, "Unable to open /dev/dahdi/ctl: %s\n", strerror(errno));
 		ast_cli(fd, "No DAHDI interface found.\n");
@@ -11243,7 +11267,12 @@
 				int res;
 				DAHDI_DIAL_PARAMS dps;
 
+#ifdef HAVE_ZAPTEL
+				ctlfd = open("/dev/zap/ctl", O_RDWR);
+#else
 				ctlfd = open("/dev/dahdi/ctl", O_RDWR);
+#endif
+
 				if (ctlfd == -1) {
 					ast_log(LOG_ERROR, "Unable to open /dev/dahdi/ctl to set toneduration\n");
 					return -1;




More information about the svn-commits mailing list