Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.392
diff -u -r1.392 chan_zap.c
--- chan_zap.c	16 Dec 2004 03:14:59 -0000	1.392
+++ chan_zap.c	26 Dec 2004 09:09:33 -0000
@@ -133,6 +133,7 @@
 #define SIG_PRI		ZT_SIG_CLEAR
 #define SIG_R2		ZT_SIG_CAS
 #define	SIG_SF		ZT_SIG_SF
+#define SIG_TR08	ZT_SIG_TR08
 #define SIG_SFWINK 	(0x100000 | ZT_SIG_SF)
 #define SIG_SF_FEATD	(0x200000 | ZT_SIG_SF)
 #define	SIG_SF_FEATDMF	(0x400000 | ZT_SIG_SF)
@@ -1032,6 +1033,8 @@
 		return "GR-303 Signalling with FXOKS";
 	case SIG_GR303FXSKS:
 		return "GR-303 Signalling with FXSKS";
+	case SIG_TR08:
+		return "TR-08 Signalling (FXO)";
 	case 0:
 		return "Pseudo Signalling";
 	default:
@@ -1539,6 +1542,7 @@
 	case SIG_FXOLS:
 	case SIG_FXOGS:
 	case SIG_FXOKS:
+	case SIG_TR08:
 		if (p->owner == ast) {
 			/* Normal ring, on hook */
 			
@@ -2178,6 +2182,7 @@
 		case SIG_FXOGS:
 		case SIG_FXOLS:
 		case SIG_FXOKS:
+		case SIG_TR08:
 			res = ioctl(p->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &par);
 			if (!res) {
 #if 0
@@ -2310,6 +2315,7 @@
 	case SIG_FXOLS:
 	case SIG_FXOGS:
 	case SIG_FXOKS:
+	case SIG_TR08:
 		/* Pick up the line */
 		ast_log(LOG_DEBUG, "Took %s off hook\n", ast->name);
 		if(p->hanguponpolarityswitch) {
@@ -3223,6 +3229,7 @@
 			case SIG_FXOLS:
 			case SIG_FXOGS:
 			case SIG_FXOKS:
+			case SIG_TR08:
 				p->onhooktime = time(NULL);
 				p->msgstate = -1;
 				/* Check for some special conditions regarding call waiting */
@@ -3355,6 +3362,7 @@
 			case SIG_FXOLS:
 			case SIG_FXOGS:
 			case SIG_FXOKS:
+			case SIG_TR08:
 				switch(ast->_state) {
 				case AST_STATE_RINGING:
 					zt_enable_ec(p);
@@ -3497,6 +3505,7 @@
 			case SIG_FXOLS:
 			case SIG_FXOGS:
 			case SIG_FXOKS:
+			case SIG_TR08:
 				ast_log(LOG_DEBUG, "Winkflash, index: %d, normal: %d, callwait: %d, thirdcall: %d\n",
 					index, p->subs[SUB_REAL].zfd, p->subs[SUB_CALLWAIT].zfd, p->subs[SUB_THREEWAY].zfd);
 				p->callwaitcas = 0;
@@ -4565,7 +4574,8 @@
 		tmp->pvt->indicate = zt_indicate;
 		tmp->pvt->fixup = zt_fixup;
 		tmp->pvt->setoption = zt_setoption;
-		if ((i->sig == SIG_FXOKS) || (i->sig == SIG_FXOGS) || (i->sig == SIG_FXOLS)) {
+		if ((i->sig == SIG_FXOKS) || (i->sig == SIG_FXOGS) || (i->sig == SIG_FXOLS) ||
+		    (i->sig == SIG_TR08)) {
 			/* Only FXO signalled stuff can be picked up */
 			tmp->callgroup = i->callgroup;
 			tmp->pickupgroup = i->pickupgroup;
@@ -4959,6 +4969,7 @@
 	case SIG_FXOLS:
 	case SIG_FXOGS:
 	case SIG_FXOKS:
+	case SIG_TR08:
 		/* Read the first digit */
 		timeout = firstdigittimeout;
 		/* If starting a threeway call, never timeout on the first digit so someone
@@ -5707,6 +5718,7 @@
 		case SIG_FXOLS:
 		case SIG_FXOGS:
 		case SIG_FXOKS:
+		case SIG_TR08:
 		        zt_set_hook(i->subs[SUB_REAL].zfd, ZT_OFFHOOK);
 			if (i->cidspill) {
 				/* Cancel VMWI spill */
@@ -5803,6 +5815,7 @@
 		switch(i->sig) {
 		case SIG_FXOLS:
 		case SIG_FXOGS:
+		case SIG_TR08:
 		case SIG_FEATD:
 		case SIG_FEATDMF:
 		case SIG_E911:
@@ -6336,8 +6349,8 @@
 					destroy_zt_pvt(&tmp);
 					return NULL;
 				}
-				if (p.sigtype != (signalling & 0x3ffff)) {
-					ast_log(LOG_ERROR, "Signalling requested on channel %d is %s but line is in %s signalling\n", channel, sig2str(signalling), sig2str(p.sigtype));
+				if (p.sigtype != (signalling & 0xfffff)) {
+					ast_log(LOG_ERROR, "Signaling requested on channel %d is %s but line is in %s signalling\n", channel, sig2str(signalling), sig2str(p.sigtype));
 					destroy_zt_pvt(&tmp);
 					return tmp;
 				}
@@ -6559,7 +6572,8 @@
 		tmp->sig = signalling;
 		tmp->radio = radio;
 		tmp->firstradio = 0;
-		if ((signalling == SIG_FXOKS) || (signalling == SIG_FXOLS) || (signalling == SIG_FXOGS))
+		if ((signalling == SIG_FXOKS) || (signalling == SIG_FXOLS) ||
+		    (signalling == SIG_FXOGS) || (signalling == SIG_TR08))
 			tmp->permcallwaiting = callwaiting;
 		else
 			tmp->permcallwaiting = 0;
@@ -6712,7 +6726,8 @@
 	if ((channelmatch > 0) && (p->channel != channelmatch))
 		return 0;
 	/* We're at least busy at this point */
-	if ((p->sig == SIG_FXOKS) || (p->sig == SIG_FXOLS) || (p->sig == SIG_FXOGS)) {
+	if ((p->sig == SIG_FXOKS) || (p->sig == SIG_FXOLS) ||
+	    (p->sig == SIG_FXOGS) || (p->sig == SIG_TR08)) {
 		if (busy)
 			*busy = 1;
 	}
@@ -6781,7 +6796,8 @@
 	}
 
 	/* If it's not an FXO, forget about call wait */
-	if ((p->sig != SIG_FXOKS) && (p->sig != SIG_FXOLS) && (p->sig != SIG_FXOGS)) 
+	if ((p->sig != SIG_FXOKS) && (p->sig != SIG_FXOLS) &&
+	    (p->sig != SIG_FXOGS) && (p->sig != SIG_TR08)) 
 		return 0;
 
 	if (!p->callwaiting) {
@@ -9572,6 +9588,9 @@
 					cur_radio = 0;
 				} else if (!strcasecmp(v->value, "featb")) {
 					cur_signalling = SIG_FEATB;
+					cur_radio = 0;
+				} else if (!strcasecmp(v->value, "tr08")) {
+					cur_signalling = SIG_TR08;
 					cur_radio = 0;
 #ifdef ZAPATA_PRI
 				} else if (!strcasecmp(v->value, "pri_net")) {
