[svn-commits] seanbright: branch seanbright/resolve-shadow-warnings r132504 - in /team/sean...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 21 14:44:37 CDT 2008


Author: seanbright
Date: Mon Jul 21 14:44:37 2008
New Revision: 132504

URL: http://svn.digium.com/view/asterisk?view=rev&rev=132504
Log:
I like to compile.

Modified:
    team/seanbright/resolve-shadow-warnings/apps/app_dahdibarge.c
    team/seanbright/resolve-shadow-warnings/apps/app_dahdiscan.c
    team/seanbright/resolve-shadow-warnings/channels/chan_dahdi.c
    team/seanbright/resolve-shadow-warnings/codecs/codec_dahdi.c

Modified: team/seanbright/resolve-shadow-warnings/apps/app_dahdibarge.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_dahdibarge.c?view=diff&rev=132504&r1=132503&r2=132504
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_dahdibarge.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_dahdibarge.c Mon Jul 21 14:44:37 2008
@@ -252,11 +252,11 @@
 
 static int conf_exec(struct ast_channel *chan, void *data)
 {
-	int res=-1;
+	int res = -1;
 	int retrycnt = 0;
 	int confflags = 0;
 	int confno = 0;
-	char confstr[80] = "";
+	char confnostr[80] = "";
 	
 	if (!ast_strlen_zero(data)) {
 		if ((sscanf(data, "DAHDI/%d", &confno) != 1) &&
@@ -271,10 +271,10 @@
 
 	while(!confno && (++retrycnt < 4)) {
 		/* Prompt user for conference number */
-		confstr[0] = '\0';
-		res = ast_app_getdata(chan, "conf-getchannel",confstr, sizeof(confstr) - 1, 0);
+		confnostr[0] = '\0';
+		res = ast_app_getdata(chan, "conf-getchannel", confnostr, sizeof(confnostr) - 1, 0);
 		if (res <0) goto out;
-		if (sscanf(confstr, "%d", &confno) != 1)
+		if (sscanf(confnostr, "%d", &confno) != 1)
 			confno = 0;
 	}
 	if (confno) {

Modified: team/seanbright/resolve-shadow-warnings/apps/app_dahdiscan.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_dahdiscan.c?view=diff&rev=132504&r1=132503&r2=132504
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_dahdiscan.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_dahdiscan.c Mon Jul 21 14:44:37 2008
@@ -285,7 +285,7 @@
 	int res=-1;
 	int confflags = 0;
 	int confno = 0;
-	char confstr[80] = "", *tmp = NULL;
+	char confnostr[80] = "", *tmp = NULL;
 	struct ast_channel *tempchan = NULL, *lastchan = NULL, *ichan = NULL;
 	struct ast_frame *f;
 	char *desired_group;
@@ -336,12 +336,12 @@
 		}
 		if (tempchan && (!strcmp(tempchan->tech->type, "DAHDI")) && (tempchan != chan)) {
 			ast_verb(3, "DAHDI channel %s is in-use, monitoring...\n", tempchan->name);
-			ast_copy_string(confstr, tempchan->name, sizeof(confstr));
+			ast_copy_string(confnostr, tempchan->name, sizeof(confnostr));
 			ast_channel_unlock(tempchan);
-			if ((tmp = strchr(confstr, '-'))) {
+			if ((tmp = strchr(confnostr, '-'))) {
 				*tmp = '\0';
 			}
-			confno = atoi(strchr(confstr, '/') + 1);
+			confno = atoi(strchr(confnostr, '/') + 1);
 			ast_stopstream(chan);
 			ast_say_number(chan, confno, AST_DIGIT_ANY, chan->language, (char *) NULL);
 			res = conf_run(chan, confno, confflags);

Modified: team/seanbright/resolve-shadow-warnings/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_dahdi.c?view=diff&rev=132504&r1=132503&r2=132504
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_dahdi.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_dahdi.c Mon Jul 21 14:44:37 2008
@@ -1218,16 +1218,16 @@
 static int dahdi_digit_begin(struct ast_channel *chan, char digit)
 {
 	struct dahdi_pvt *pvt;
-	int index;
+	int idx;
 	int dtmf = -1;
 	
 	pvt = chan->tech_pvt;
 
 	ast_mutex_lock(&pvt->lock);
 
-	index = dahdi_get_index(chan, pvt, 0);
-
-	if ((index != SUB_REAL) || !pvt->owner)
+	idx = dahdi_get_index(chan, pvt, 0);
+
+	if ((idx != SUB_REAL) || !pvt->owner)
 		goto out;
 
 #ifdef HAVE_PRI
@@ -1281,16 +1281,16 @@
 {
 	struct dahdi_pvt *pvt;
 	int res = 0;
-	int index;
+	int idx;
 	int x;
 	
 	pvt = chan->tech_pvt;
 
 	ast_mutex_lock(&pvt->lock);
 	
-	index = dahdi_get_index(chan, pvt, 0);
-
-	if ((index != SUB_REAL) || !pvt->owner || pvt->pulse)
+	idx = dahdi_get_index(chan, pvt, 0);
+
+	if ((idx != SUB_REAL) || !pvt->owner || pvt->pulse)
 		goto out;
 
 #ifdef HAVE_PRI
@@ -1349,14 +1349,14 @@
 	{ DAHDI_ALARM_NONE, "None" },
 };
 
-static char *alarm2str(int alarm)
+static char *alarm2str(int alm)
 {
 	int x;
 	for (x = 0; x < ARRAY_LEN(alarms); x++) {
-		if (alarms[x].alarm & alarm)
+		if (alarms[x].alarm & alm)
 			return alarms[x].name;
 	}
-	return alarm ? "Unknown Alarm" : "No Alarm";
+	return alm ? "Unknown Alarm" : "No Alarm";
 }
 
 static char *event2str(int event)
@@ -1446,7 +1446,7 @@
 
 #define sig2str dahdi_sig2str
 
-static int conf_add(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index, int slavechannel)
+static int conf_add(struct dahdi_pvt *p, struct dahdi_subchannel *c, int idx, int slavechannel)
 {
 	/* If the conference already exists, and we're already in it
 	   don't bother doing anything */
@@ -1460,7 +1460,7 @@
 		zi.confmode = DAHDI_CONF_DIGITALMON;
 		zi.confno = slavechannel;
 	} else {
-		if (!index) {
+		if (!idx) {
 			/* Real-side and pseudo-side both participate in conference */
 			zi.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER |
 				DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER;
@@ -1495,7 +1495,7 @@
 	return 0;
 }
 
-static int conf_del(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index)
+static int conf_del(struct dahdi_pvt *p, struct dahdi_subchannel *c, int idx)
 {
 	DAHDI_CONFINFO zi;
 	if (/* Can't delete if there's no zfd */
@@ -2076,7 +2076,7 @@
 static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
 {
 	struct dahdi_pvt *p = ast->tech_pvt;
-	int x, res, index,mysig;
+	int x, res, idx,mysig;
 	char *c, *n, *l;
 #ifdef HAVE_PRI
 	char *s = NULL;
@@ -2202,9 +2202,9 @@
 		else
 			p->lastcid_name[0] = '\0';
 		ast_setstate(ast, AST_STATE_RINGING);
-		index = dahdi_get_index(ast, p, 0);
-		if (index > -1) {
-			p->subs[index].needringing = 1;
+		idx = dahdi_get_index(ast, p, 0);
+		if (idx > -1) {
+			p->subs[idx].needringing = 1;
 		}
 		break;
 	case SIG_FXSLS:
@@ -2963,7 +2963,7 @@
 static int dahdi_hangup(struct ast_channel *ast)
 {
 	int res;
-	int index,x, law;
+	int idx,x, law;
 	/*static int restore_gains(struct dahdi_pvt *p);*/
 	struct dahdi_pvt *p = ast->tech_pvt;
 	struct dahdi_pvt *tmp = NULL;
@@ -2978,7 +2978,7 @@
 	
 	ast_mutex_lock(&p->lock);
 	
-	index = dahdi_get_index(ast, p, 1);
+	idx = 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,22 +3005,22 @@
 		p->exten[0] = '\0';
 
 	ast_debug(1, "Hangup: channel: %d index = %d, normal = %d, callwait = %d, thirdcall = %d\n",
-		p->channel, index, p->subs[SUB_REAL].zfd, p->subs[SUB_CALLWAIT].zfd, p->subs[SUB_THREEWAY].zfd);
+		p->channel, idx, p->subs[SUB_REAL].zfd, p->subs[SUB_CALLWAIT].zfd, p->subs[SUB_THREEWAY].zfd);
 	p->ignoredtmf = 0;
 	
-	if (index > -1) {
+	if (idx > -1) {
 		/* Real channel, do some fixup */
-		p->subs[index].owner = NULL;
-		p->subs[index].needanswer = 0;
-		p->subs[index].needflash = 0;
-		p->subs[index].needringing = 0;
-		p->subs[index].needbusy = 0;
-		p->subs[index].needcongestion = 0;
-		p->subs[index].linear = 0;
-		p->subs[index].needcallerid = 0;
+		p->subs[idx].owner = NULL;
+		p->subs[idx].needanswer = 0;
+		p->subs[idx].needflash = 0;
+		p->subs[idx].needringing = 0;
+		p->subs[idx].needbusy = 0;
+		p->subs[idx].needcongestion = 0;
+		p->subs[idx].linear = 0;
+		p->subs[idx].needcallerid = 0;
 		p->polarity = POLARITY_IDLE;
-		dahdi_setlinear(p->subs[index].zfd, 0);
-		if (index == SUB_REAL) {
+		dahdi_setlinear(p->subs[idx].zfd, 0);
+		if (idx == 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");
 				if (p->subs[SUB_CALLWAIT].inthreeway) {
@@ -3071,7 +3071,7 @@
 				}
 				p->subs[SUB_REAL].inthreeway = 0;
 			}
-		} else if (index == SUB_CALLWAIT) {
+		} else if (idx == SUB_CALLWAIT) {
 			/* Ditch the holding callwait call, and immediately make it availabe */
 			if (p->subs[SUB_CALLWAIT].inthreeway) {
 				/* This is actually part of a three way, placed on hold.  Place the third part
@@ -3087,7 +3087,7 @@
 				unalloc_sub(p, SUB_THREEWAY);
 			} else
 				unalloc_sub(p, SUB_CALLWAIT);
-		} else if (index == SUB_THREEWAY) {
+		} else if (idx == SUB_THREEWAY) {
 			if (p->subs[SUB_CALLWAIT].inthreeway) {
 				/* The other party of the three way call is currently in a call-wait state.
 				   Start music on hold for them, and take the main guy out of the third call */
@@ -3315,13 +3315,13 @@
 {
 	struct dahdi_pvt *p = ast->tech_pvt;
 	int res = 0;
-	int index;
+	int idx;
 	int oldstate = ast->_state;
 	ast_setstate(ast, AST_STATE_UP);
 	ast_mutex_lock(&p->lock);
-	index = dahdi_get_index(ast, p, 0);
-	if (index < 0)
-		index = SUB_REAL;
+	idx = dahdi_get_index(ast, p, 0);
+	if (idx < 0)
+		idx = SUB_REAL;
 	/* nothing to do if a radio channel */
 	if ((p->radio || (p->oprmode < 0))) {
 		ast_mutex_unlock(&p->lock);
@@ -3357,9 +3357,9 @@
 			p->polaritydelaytv = ast_tvnow();
 		}
 		res = dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_OFFHOOK);
-		tone_zone_play_tone(p->subs[index].zfd, -1);
+		tone_zone_play_tone(p->subs[idx].zfd, -1);
 		p->dialing = 0;
-		if ((index == SUB_REAL) && p->subs[SUB_THREEWAY].inthreeway) {
+		if ((idx == SUB_REAL) && p->subs[SUB_THREEWAY].inthreeway) {
 			if (oldstate == AST_STATE_RINGING) {
 				ast_debug(1, "Finally swapping real and threeway\n");
 				tone_zone_play_tone(p->subs[SUB_THREEWAY].zfd, -1);
@@ -3415,7 +3415,7 @@
 	char *cp;
 	signed char *scp;
 	int x;
-	int index;
+	int idx;
 	struct dahdi_pvt *p = chan->tech_pvt, *pp;
 	struct oprmode *oprmode;
 	
@@ -3429,22 +3429,22 @@
 	switch (option) {
 	case AST_OPTION_TXGAIN:
 		scp = (signed char *) data;
-		index = dahdi_get_index(chan, p, 0);
-		if (index < 0) {
+		idx = dahdi_get_index(chan, p, 0);
+		if (idx < 0) {
 			ast_log(LOG_WARNING, "No index in TXGAIN?\n");
 			return -1;
 		}
 		ast_debug(1, "Setting actual tx gain on %s to %f\n", chan->name, p->txgain + (float) *scp);
-		return set_actual_txgain(p->subs[index].zfd, 0, p->txgain + (float) *scp, p->law);
+		return set_actual_txgain(p->subs[idx].zfd, 0, p->txgain + (float) *scp, p->law);
 	case AST_OPTION_RXGAIN:
 		scp = (signed char *) data;
-		index = dahdi_get_index(chan, p, 0);
-		if (index < 0) {
+		idx = dahdi_get_index(chan, p, 0);
+		if (idx < 0) {
 			ast_log(LOG_WARNING, "No index in RXGAIN?\n");
 			return -1;
 		}
 		ast_debug(1, "Setting actual rx gain on %s to %f\n", chan->name, p->rxgain + (float) *scp);
-		return set_actual_rxgain(p->subs[index].zfd, 0, p->rxgain + (float) *scp, p->law);
+		return set_actual_rxgain(p->subs[idx].zfd, 0, p->rxgain + (float) *scp, p->law);
 	case AST_OPTION_TONE_VERIFY:
 		if (!p->dsp)
 			break;
@@ -3488,12 +3488,12 @@
 			memset(buf, 0x7f, sizeof(mybuf)); /* set to silence */
 			ast_tdd_gen_ecdisa(buf + 16000, 16000);  /* put in tone */
 			len = 40000;
-			index = dahdi_get_index(chan, p, 0);
-			if (index < 0) {
+			idx = dahdi_get_index(chan, p, 0);
+			if (idx < 0) {
 				ast_log(LOG_WARNING, "No index in TDD?\n");
 				return -1;
 			}
-			fd = p->subs[index].zfd;
+			fd = p->subs[idx].zfd;
 			while (len) {
 				if (ast_check_hangup(chan))
 					return -1;
@@ -4179,7 +4179,7 @@
 	return DAHDI_ALARM_NONE;
 }
 
-static void dahdi_handle_dtmfup(struct ast_channel *ast, int index, struct ast_frame **dest)
+static void dahdi_handle_dtmfup(struct ast_channel *ast, int idx, struct ast_frame **dest)
 {
 	struct dahdi_pvt *p = ast->tech_pvt;
 	struct ast_frame *f = *dest;
@@ -4190,9 +4190,9 @@
 		ast_debug(1, "Confirm answer on %s!\n", ast->name);
 		/* Upon receiving a DTMF digit, consider this an answer confirmation instead
 		   of a DTMF digit */
-		p->subs[index].f.frametype = AST_FRAME_CONTROL;
-		p->subs[index].f.subclass = AST_CONTROL_ANSWER;
-		*dest = &p->subs[index].f;
+		p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+		p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
+		*dest = &p->subs[idx].f;
 		/* Reset confirmanswer so DTMF's will behave properly for the duration of the call */
 		p->confirmanswer = 0;
 	} else if (p->callwaitcas) {
@@ -4203,9 +4203,9 @@
 			send_cwcidspill(p);
 		}
 		p->callwaitcas = 0;
-		p->subs[index].f.frametype = AST_FRAME_NULL;
-		p->subs[index].f.subclass = 0;
-		*dest = &p->subs[index].f;
+		p->subs[idx].f.frametype = AST_FRAME_NULL;
+		p->subs[idx].f.subclass = 0;
+		*dest = &p->subs[idx].f;
 	} else if (f->subclass == 'f') {
 		/* Fax tone -- Handle and return NULL */
 		if ((p->callprogress & CALLPROGRESS_FAX) && !p->faxhandled) {
@@ -4226,45 +4226,45 @@
 		} else
 			ast_debug(1, "Fax already handled\n");
 		dahdi_confmute(p, 0);
-		p->subs[index].f.frametype = AST_FRAME_NULL;
-		p->subs[index].f.subclass = 0;
-		*dest = &p->subs[index].f;
+		p->subs[idx].f.frametype = AST_FRAME_NULL;
+		p->subs[idx].f.subclass = 0;
+		*dest = &p->subs[idx].f;
 	}
 }
 			
 static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
 {
 	int res, x;
-	int index, mysig;
+	int idx, mysig;
 	char *c;
 	struct dahdi_pvt *p = ast->tech_pvt;
 	pthread_t threadid;
 	struct ast_channel *chan;
 	struct ast_frame *f;
 
-	index = dahdi_get_index(ast, p, 0);
+	idx = dahdi_get_index(ast, p, 0);
 	mysig = p->sig;
 	if (p->outsigmod > -1)
 		mysig = p->outsigmod;
-	p->subs[index].f.frametype = AST_FRAME_NULL;
-	p->subs[index].f.subclass = 0;
-	p->subs[index].f.datalen = 0;
-	p->subs[index].f.samples = 0;
-	p->subs[index].f.mallocd = 0;
-	p->subs[index].f.offset = 0;
-	p->subs[index].f.src = "dahdi_handle_event";
-	p->subs[index].f.data.ptr = NULL;
-	f = &p->subs[index].f;
-
-	if (index < 0)
-		return &p->subs[index].f;
+	p->subs[idx].f.frametype = AST_FRAME_NULL;
+	p->subs[idx].f.subclass = 0;
+	p->subs[idx].f.datalen = 0;
+	p->subs[idx].f.samples = 0;
+	p->subs[idx].f.mallocd = 0;
+	p->subs[idx].f.offset = 0;
+	p->subs[idx].f.src = "dahdi_handle_event";
+	p->subs[idx].f.data.ptr = NULL;
+	f = &p->subs[idx].f;
+
+	if (idx < 0)
+		return &p->subs[idx].f;
 	if (p->fake_event) {
 		res = p->fake_event;
 		p->fake_event = 0;
 	} else
-		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);
+		res = dahdi_get_event(p->subs[idx].zfd);
+
+	ast_debug(1, "Got event %s(%d) on channel %d (index %d)\n", event2str(res), res, p->channel, idx);
 
 	if (res & (DAHDI_EVENT_PULSEDIGIT | DAHDI_EVENT_DTMFUP)) {
 		p->pulsedial =  (res & DAHDI_EVENT_PULSEDIGIT) ? 1 : 0;
@@ -4274,12 +4274,12 @@
 			/* absorb event */
 		} else {
 #endif
-			p->subs[index].f.frametype = AST_FRAME_DTMF_END;
-			p->subs[index].f.subclass = res & 0xff;
+			p->subs[idx].f.frametype = AST_FRAME_DTMF_END;
+			p->subs[idx].f.subclass = res & 0xff;
 #ifdef HAVE_PRI
 		}
 #endif
-		dahdi_handle_dtmfup(ast, index, &f);
+		dahdi_handle_dtmfup(ast, idx, &f);
 		return f;
 	}
 
@@ -4287,9 +4287,9 @@
 		ast_debug(1, "DTMF Down '%c'\n", res & 0xff);
 		/* Mute conference */
 		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;
+		p->subs[idx].f.frametype = AST_FRAME_DTMF_BEGIN;
+		p->subs[idx].f.subclass = res & 0xff;
+		return &p->subs[idx].f;
 	}
 
 	switch (res) {
@@ -4304,12 +4304,12 @@
 		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);
+				tone_zone_play_tone(p->subs[idx].zfd, -1);
 			break;	
 		case DAHDI_EVENT_DIALCOMPLETE:
 			if (p->inalarm) break;
 			if ((p->radio || (p->oprmode < 0))) break;
-			if (ioctl(p->subs[index].zfd,DAHDI_DIALING,&x) == -1) {
+			if (ioctl(p->subs[idx].zfd,DAHDI_DIALING,&x) == -1) {
 				ast_log(LOG_DEBUG, "DAHDI_DIALING ioctl failed on %s: %s\n",ast->name, strerror(errno));
 				return NULL;
 			}
@@ -4327,8 +4327,8 @@
 						/* if thru with dialing after offhook */
 						if (ast->_state == AST_STATE_DIALING_OFFHOOK) {
 							ast_setstate(ast, AST_STATE_UP);
-							p->subs[index].f.frametype = AST_FRAME_CONTROL;
-							p->subs[index].f.subclass = AST_CONTROL_ANSWER;
+							p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+							p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
 							break;
 						} else { /* if to state wait for offhook to dial rest */
 							/* we now wait for off hook */
@@ -4342,8 +4342,8 @@
 							ast_setstate(ast, AST_STATE_RINGING);
 						} else if (!p->answeronpolarityswitch) {
 							ast_setstate(ast, AST_STATE_UP);
-							p->subs[index].f.frametype = AST_FRAME_CONTROL;
-							p->subs[index].f.subclass = AST_CONTROL_ANSWER;
+							p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+							p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
 							/* If aops=0 and hops=1, this is necessary */
 							p->polarity = POLARITY_REV;
 						} else {
@@ -4399,8 +4399,8 @@
 #endif
 		case DAHDI_EVENT_ONHOOK:
 			if (p->radio) {
-				p->subs[index].f.frametype = AST_FRAME_CONTROL;
-				p->subs[index].f.subclass = AST_CONTROL_RADIO_UNKEY;
+				p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+				p->subs[idx].f.subclass = AST_CONTROL_RADIO_UNKEY;
 				break;
 			}
 			if (p->oprmode < 0)
@@ -4423,7 +4423,7 @@
 				p->onhooktime = time(NULL);
 				p->msgstate = -1;
 				/* Check for some special conditions regarding call waiting */
-				if (index == SUB_REAL) {
+				if (idx == SUB_REAL) {
 					/* The normal line was hung up */
 					if (p->subs[SUB_CALLWAIT].owner) {
 						/* There's a call waiting call, so ring the phone, but make it unowned in the mean time */
@@ -4431,8 +4431,8 @@
 						ast_verb(3, "Channel %d still has (callwait) call, ringing phone\n", p->channel);
 						unalloc_sub(p, SUB_CALLWAIT);	
 #if 0
-						p->subs[index].needanswer = 0;
-						p->subs[index].needringing = 0;
+						p->subs[idx].needanswer = 0;
+						p->subs[idx].needringing = 0;
 #endif						
 						p->callwaitingrepeat = 0;
 						p->cidcwexpire = 0;
@@ -4512,7 +4512,7 @@
 						}
 					}
 				} else {
-					ast_log(LOG_WARNING, "Got a hangup and my index is %d?\n", index);
+					ast_log(LOG_WARNING, "Got a hangup and my index is %d?\n", idx);
 				}
 				/* Fall through */
 			default:
@@ -4535,8 +4535,8 @@
 			}
 			if (p->radio)
 			{
-				p->subs[index].f.frametype = AST_FRAME_CONTROL;
-				p->subs[index].f.subclass = AST_CONTROL_RADIO_KEY;
+				p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+				p->subs[idx].f.subclass = AST_CONTROL_RADIO_KEY;
 				break;
  			}
 			/* for E911, its supposed to wait for offhook then dial
@@ -4566,7 +4566,7 @@
 					return NULL;
 					}
 				p->dialing = 1;
-				return &p->subs[index].f;
+				return &p->subs[idx].f;
 			}
 			switch (p->sig) {
 			case SIG_FXOLS:
@@ -4576,10 +4576,10 @@
 				case AST_STATE_RINGING:
 					dahdi_enable_ec(p);
 					dahdi_train_ec(p);
-					p->subs[index].f.frametype = AST_FRAME_CONTROL;
-					p->subs[index].f.subclass = AST_CONTROL_ANSWER;
+					p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+					p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
 					/* Make sure it stops ringing */
-					dahdi_set_hook(p->subs[index].zfd, DAHDI_OFFHOOK);
+					dahdi_set_hook(p->subs[idx].zfd, DAHDI_OFFHOOK);
 					ast_debug(1, "channel %d answered\n", p->channel);
 					if (p->cidspill) {
 						/* Cancel any running CallerID spill */
@@ -4590,8 +4590,8 @@
 					p->callwaitcas = 0;
 					if (p->confirmanswer) {
 						/* Ignore answer if "confirm answer" is enabled */
-						p->subs[index].f.frametype = AST_FRAME_NULL;
-						p->subs[index].f.subclass = 0;
+						p->subs[idx].f.frametype = AST_FRAME_NULL;
+						p->subs[idx].f.subclass = 0;
 					} else if (!ast_strlen_zero(p->dop.dialstr)) {
 						/* nick at dccinc.com 4/3/03 - fxo should be able to do deferred dialing */
 						res = ioctl(p->subs[SUB_REAL].zfd, DAHDI_DIAL, &p->dop);
@@ -4601,29 +4601,29 @@
 							return NULL;
 						} else {
 							ast_debug(1, "Sent FXO deferred digit string: %s\n", p->dop.dialstr);
-							p->subs[index].f.frametype = AST_FRAME_NULL;
-							p->subs[index].f.subclass = 0;
+							p->subs[idx].f.frametype = AST_FRAME_NULL;
+							p->subs[idx].f.subclass = 0;
 							p->dialing = 1;
 						}
 						p->dop.dialstr[0] = '\0';
 						ast_setstate(ast, AST_STATE_DIALING);
 					} else
 						ast_setstate(ast, AST_STATE_UP);
-					return &p->subs[index].f;
+					return &p->subs[idx].f;
 				case AST_STATE_DOWN:
 					ast_setstate(ast, AST_STATE_RING);
 					ast->rings = 1;
-					p->subs[index].f.frametype = AST_FRAME_CONTROL;
-					p->subs[index].f.subclass = AST_CONTROL_OFFHOOK;
+					p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+					p->subs[idx].f.subclass = AST_CONTROL_OFFHOOK;
 					ast_debug(1, "channel %d picked up\n", p->channel);
-					return &p->subs[index].f;
+					return &p->subs[idx].f;
 				case AST_STATE_UP:
 					/* Make sure it stops ringing */
-					dahdi_set_hook(p->subs[index].zfd, DAHDI_OFFHOOK);
+					dahdi_set_hook(p->subs[idx].zfd, DAHDI_OFFHOOK);
 					/* Okay -- probably call waiting*/
 					if (ast_bridged_channel(p->owner))
 						ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
-					p->subs[index].needunhold = 1;
+					p->subs[idx].needunhold = 1;
 					break;
 				case AST_STATE_RESERVED:
 					/* Start up dialtone */
@@ -4670,16 +4670,16 @@
 					ast_setstate(ast, AST_STATE_RING);
 				if ((ast->_state == AST_STATE_DOWN) || (ast->_state == AST_STATE_RING)) {
 					ast_debug(1, "Ring detected\n");
-					p->subs[index].f.frametype = AST_FRAME_CONTROL;
-					p->subs[index].f.subclass = AST_CONTROL_RING;
+					p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+					p->subs[idx].f.subclass = AST_CONTROL_RING;
 				} else if (p->outgoing && ((ast->_state == AST_STATE_RINGING) || (ast->_state == AST_STATE_DIALING))) {
 					ast_debug(1, "Line answered\n");
 					if (p->confirmanswer) {
-						p->subs[index].f.frametype = AST_FRAME_NULL;
-						p->subs[index].f.subclass = 0;
+						p->subs[idx].f.frametype = AST_FRAME_NULL;
+						p->subs[idx].f.subclass = 0;
 					} else {
-						p->subs[index].f.frametype = AST_FRAME_CONTROL;
-						p->subs[index].f.subclass = AST_CONTROL_ANSWER;
+						p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+						p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
 						ast_setstate(ast, AST_STATE_UP);
 					}
 				} else if (ast->_state != AST_STATE_RING)
@@ -4712,8 +4712,8 @@
 				p->cidspill = NULL;
 				p->callwaitcas = 0;
 			}
-			p->subs[index].f.frametype = AST_FRAME_CONTROL;
-			p->subs[index].f.subclass = AST_CONTROL_RINGING;
+			p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+			p->subs[idx].f.subclass = AST_CONTROL_RINGING;
 			break;
 		case DAHDI_EVENT_RINGERON:
 			break;
@@ -4756,11 +4756,11 @@
 			case SIG_FXOGS:
 			case SIG_FXOKS:
 				ast_debug(1, "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);
+					idx, p->subs[SUB_REAL].zfd, p->subs[SUB_CALLWAIT].zfd, p->subs[SUB_THREEWAY].zfd);
 				p->callwaitcas = 0;
 
-				if (index != SUB_REAL) {
-					ast_log(LOG_WARNING, "Got flash hook with index %d on channel %d?!?\n", index, p->channel);
+				if (idx != SUB_REAL) {
+					ast_log(LOG_WARNING, "Got flash hook with index %d on channel %d?!?\n", idx, p->channel);
 					goto winkflashdone;
 				}
 				
@@ -5070,7 +5070,7 @@
 		default:
 			ast_debug(1, "Dunno what to do with event %d on channel %d\n", res, p->channel);
 	}
-	return &p->subs[index].f;
+	return &p->subs[idx].f;
 }
 
 static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
@@ -5078,21 +5078,21 @@
 	struct dahdi_pvt *p = ast->tech_pvt;
 	int res;
 	int usedindex=-1;
-	int index;
+	int idx;
 	struct ast_frame *f;
 
 
-	index = dahdi_get_index(ast, p, 1);
+	idx = dahdi_get_index(ast, p, 1);
 	
-	p->subs[index].f.frametype = AST_FRAME_NULL;
-	p->subs[index].f.datalen = 0;
-	p->subs[index].f.samples = 0;
-	p->subs[index].f.mallocd = 0;
-	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 = "dahdi_exception";
-	p->subs[index].f.data.ptr = NULL;
+	p->subs[idx].f.frametype = AST_FRAME_NULL;
+	p->subs[idx].f.datalen = 0;
+	p->subs[idx].f.samples = 0;
+	p->subs[idx].f.mallocd = 0;
+	p->subs[idx].f.offset = 0;
+	p->subs[idx].f.subclass = 0;
+	p->subs[idx].f.delivery = ast_tv(0,0);
+	p->subs[idx].f.src = "dahdi_exception";
+	p->subs[idx].f.data.ptr = NULL;
 	
 	
 	if ((!p->owner) && (!(p->radio || (p->oprmode < 0)))) {
@@ -5164,7 +5164,7 @@
 		default:
 			ast_log(LOG_WARNING, "Don't know how to absorb event %s\n", event2str(res));
 		}
-		f = &p->subs[index].f;
+		f = &p->subs[idx].f;
 		return f;
 	}
 	if (!(p->radio || (p->oprmode < 0))) 
@@ -5172,7 +5172,7 @@
 	/* If it's not us, return NULL immediately */
 	if (ast != p->owner) {
 		ast_log(LOG_WARNING, "We're %s, not %s\n", ast->name, p->owner->name);
-		f = &p->subs[index].f;
+		f = &p->subs[idx].f;
 		return f;
 	}
 	f = dahdi_handle_event(ast);
@@ -5193,7 +5193,7 @@
 {
 	struct dahdi_pvt *p = ast->tech_pvt;
 	int res;
-	int index;
+	int idx;
 	void *readbuf;
 	struct ast_frame *f;
 
@@ -5201,10 +5201,10 @@
 		CHANNEL_DEADLOCK_AVOIDANCE(ast);
 	}
 
-	index = dahdi_get_index(ast, p, 0);
+	idx = dahdi_get_index(ast, p, 0);
 	
 	/* Hang up if we don't really exist */
-	if (index < 0)	{
+	if (idx < 0)	{
 		ast_log(LOG_WARNING, "We dont exist?\n");
 		ast_mutex_unlock(&p->lock);
 		return NULL;
@@ -5212,15 +5212,15 @@
 	
 	if ((p->radio || (p->oprmode < 0)) && p->inalarm) return NULL;
 
-	p->subs[index].f.frametype = AST_FRAME_NULL;
-	p->subs[index].f.datalen = 0;
-	p->subs[index].f.samples = 0;
-	p->subs[index].f.mallocd = 0;
-	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 = "dahdi_read";
-	p->subs[index].f.data.ptr = NULL;
+	p->subs[idx].f.frametype = AST_FRAME_NULL;
+	p->subs[idx].f.datalen = 0;
+	p->subs[idx].f.samples = 0;
+	p->subs[idx].f.mallocd = 0;
+	p->subs[idx].f.offset = 0;
+	p->subs[idx].f.subclass = 0;
+	p->subs[idx].f.delivery = ast_tv(0,0);
+	p->subs[idx].f.src = "dahdi_read";
+	p->subs[idx].f.data.ptr = NULL;
 	
 	/* make sure it sends initial key state as first frame */
 	if ((p->radio || (p->oprmode < 0)) && (!p->firstradio))
@@ -5233,17 +5233,17 @@
 			return NULL;
 		}
 		p->firstradio = 1;
-		p->subs[index].f.frametype = AST_FRAME_CONTROL;
+		p->subs[idx].f.frametype = AST_FRAME_CONTROL;
 		if (ps.rxisoffhook)
 		{
-			p->subs[index].f.subclass = AST_CONTROL_RADIO_KEY;
+			p->subs[idx].f.subclass = AST_CONTROL_RADIO_KEY;
 		}
 		else
 		{
-			p->subs[index].f.subclass = AST_CONTROL_RADIO_UNKEY;
+			p->subs[idx].f.subclass = AST_CONTROL_RADIO_UNKEY;
 		}
 		ast_mutex_unlock(&p->lock);
-		return &p->subs[index].f;
+		return &p->subs[idx].f;
 	}
 	if (p->ringt == 1) {
 		ast_mutex_unlock(&p->lock);
@@ -5252,103 +5252,103 @@
 	else if (p->ringt > 0) 
 		p->ringt--;
 
-	if (p->subs[index].needringing) {
+	if (p->subs[idx].needringing) {
 		/* Send ringing frame if requested */
-		p->subs[index].needringing = 0;
-		p->subs[index].f.frametype = AST_FRAME_CONTROL;
-		p->subs[index].f.subclass = AST_CONTROL_RINGING;
+		p->subs[idx].needringing = 0;
+		p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+		p->subs[idx].f.subclass = AST_CONTROL_RINGING;
 		ast_setstate(ast, AST_STATE_RINGING);
 		ast_mutex_unlock(&p->lock);
-		return &p->subs[index].f;
-	}
-
-	if (p->subs[index].needbusy) {
+		return &p->subs[idx].f;
+	}
+
+	if (p->subs[idx].needbusy) {
 		/* Send busy frame if requested */
-		p->subs[index].needbusy = 0;
-		p->subs[index].f.frametype = AST_FRAME_CONTROL;
-		p->subs[index].f.subclass = AST_CONTROL_BUSY;
+		p->subs[idx].needbusy = 0;
+		p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+		p->subs[idx].f.subclass = AST_CONTROL_BUSY;
 		ast_mutex_unlock(&p->lock);
-		return &p->subs[index].f;
-	}
-
-	if (p->subs[index].needcongestion) {
+		return &p->subs[idx].f;
+	}
+
+	if (p->subs[idx].needcongestion) {
 		/* Send congestion frame if requested */
-		p->subs[index].needcongestion = 0;
-		p->subs[index].f.frametype = AST_FRAME_CONTROL;
-		p->subs[index].f.subclass = AST_CONTROL_CONGESTION;
+		p->subs[idx].needcongestion = 0;
+		p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+		p->subs[idx].f.subclass = AST_CONTROL_CONGESTION;
 		ast_mutex_unlock(&p->lock);
-		return &p->subs[index].f;
-	}
-
-	if (p->subs[index].needcallerid) {
+		return &p->subs[idx].f;
+	}
+
+	if (p->subs[idx].needcallerid) {
 		ast_set_callerid(ast, S_OR(p->lastcid_num, NULL),
 							S_OR(p->lastcid_name, NULL),
 							S_OR(p->lastcid_num, NULL)
 							);
-		p->subs[index].needcallerid = 0;
+		p->subs[idx].needcallerid = 0;
 	}
 	
-	if (p->subs[index].needanswer) {
+	if (p->subs[idx].needanswer) {
 		/* Send answer frame if requested */
-		p->subs[index].needanswer = 0;
-		p->subs[index].f.frametype = AST_FRAME_CONTROL;
-		p->subs[index].f.subclass = AST_CONTROL_ANSWER;
+		p->subs[idx].needanswer = 0;
+		p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+		p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
 		ast_mutex_unlock(&p->lock);
-		return &p->subs[index].f;
+		return &p->subs[idx].f;
 	}	
 	
-	if (p->subs[index].needflash) {
+	if (p->subs[idx].needflash) {
 		/* Send answer frame if requested */
-		p->subs[index].needflash = 0;
-		p->subs[index].f.frametype = AST_FRAME_CONTROL;
-		p->subs[index].f.subclass = AST_CONTROL_FLASH;
+		p->subs[idx].needflash = 0;
+		p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+		p->subs[idx].f.subclass = AST_CONTROL_FLASH;
 		ast_mutex_unlock(&p->lock);
-		return &p->subs[index].f;
+		return &p->subs[idx].f;
 	}	
 	
-	if (p->subs[index].needhold) {
+	if (p->subs[idx].needhold) {
 		/* Send answer frame if requested */
-		p->subs[index].needhold = 0;
-		p->subs[index].f.frametype = AST_FRAME_CONTROL;
-		p->subs[index].f.subclass = AST_CONTROL_HOLD;
+		p->subs[idx].needhold = 0;
+		p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+		p->subs[idx].f.subclass = AST_CONTROL_HOLD;
 		ast_mutex_unlock(&p->lock);
 		ast_debug(1, "Sending hold on '%s'\n", ast->name);
-		return &p->subs[index].f;
+		return &p->subs[idx].f;
 	}	
 	
-	if (p->subs[index].needunhold) {
+	if (p->subs[idx].needunhold) {
 		/* Send answer frame if requested */
-		p->subs[index].needunhold = 0;
-		p->subs[index].f.frametype = AST_FRAME_CONTROL;
-		p->subs[index].f.subclass = AST_CONTROL_UNHOLD;
+		p->subs[idx].needunhold = 0;
+		p->subs[idx].f.frametype = AST_FRAME_CONTROL;
+		p->subs[idx].f.subclass = AST_CONTROL_UNHOLD;
 		ast_mutex_unlock(&p->lock);
 		ast_debug(1, "Sending unhold on '%s'\n", ast->name);
-		return &p->subs[index].f;
+		return &p->subs[idx].f;
 	}	
 	
 	if (ast->rawreadformat == AST_FORMAT_SLINEAR) {
-		if (!p->subs[index].linear) {
-			p->subs[index].linear = 1;
-			res = dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
+		if (!p->subs[idx].linear) {
+			p->subs[idx].linear = 1;
+			res = dahdi_setlinear(p->subs[idx].zfd, p->subs[idx].linear);
 			if (res) 
-				ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to linear mode.\n", p->channel, index);
+				ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to linear mode.\n", p->channel, idx);
 		}
 	} else if ((ast->rawreadformat == AST_FORMAT_ULAW) ||
 		   (ast->rawreadformat == AST_FORMAT_ALAW)) {
-		if (p->subs[index].linear) {
-			p->subs[index].linear = 0;
-			res = dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
+		if (p->subs[idx].linear) {
+			p->subs[idx].linear = 0;
+			res = dahdi_setlinear(p->subs[idx].zfd, p->subs[idx].linear);
 			if (res) 
-				ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to companded mode.\n", p->channel, index);
+				ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to companded mode.\n", p->channel, idx);
 		}
 	} else {
 		ast_log(LOG_WARNING, "Don't know how to read frames in format %s\n", ast_getformatname(ast->rawreadformat));
 		ast_mutex_unlock(&p->lock);
 		return NULL;
 	}
-	readbuf = ((unsigned char *)p->subs[index].buffer) + AST_FRIENDLY_OFFSET;
+	readbuf = ((unsigned char *)p->subs[idx].buffer) + AST_FRIENDLY_OFFSET;
 	CHECK_BLOCKING(ast);
-	res = read(p->subs[index].zfd, readbuf, p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE);
+	res = read(p->subs[idx].zfd, readbuf, p->subs[idx].linear ? READ_SIZE * 2 : READ_SIZE);
 	ast_clear_flag(ast, AST_FLAG_BLOCKING);
 	/* Check for hangup */
 	if (res < 0) {
@@ -5357,7 +5357,7 @@
 			if (errno == EAGAIN) {
 				/* Return "NULL" frame if there is nobody there */
 				ast_mutex_unlock(&p->lock);
-				return &p->subs[index].f;
+				return &p->subs[idx].f;
 			} else if (errno == ELAST) {
 				f = __dahdi_exception(ast);
 			} else
@@ -5366,8 +5366,8 @@
 		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);
+	if (res != (p->subs[idx].linear ? READ_SIZE * 2 : READ_SIZE)) {
+		ast_debug(1, "Short read (%d/%d), must be an event...\n", res, p->subs[idx].linear ? READ_SIZE * 2 : READ_SIZE);
 		f = __dahdi_exception(ast);
 		ast_mutex_unlock(&p->lock);
 		return f;
@@ -5382,15 +5382,15 @@
 			return NULL;
 		}
 		if (c) { /* if a char to return */
-			p->subs[index].f.subclass = 0;
-			p->subs[index].f.frametype = AST_FRAME_TEXT;
-			p->subs[index].f.mallocd = 0;
-			p->subs[index].f.offset = AST_FRIENDLY_OFFSET;
-			p->subs[index].f.data.ptr = p->subs[index].buffer + AST_FRIENDLY_OFFSET;
-			p->subs[index].f.datalen = 1;
-			*((char *) p->subs[index].f.data.ptr) = c;
+			p->subs[idx].f.subclass = 0;
+			p->subs[idx].f.frametype = AST_FRAME_TEXT;
+			p->subs[idx].f.mallocd = 0;
+			p->subs[idx].f.offset = AST_FRIENDLY_OFFSET;
+			p->subs[idx].f.data.ptr = p->subs[idx].buffer + AST_FRIENDLY_OFFSET;
+			p->subs[idx].f.datalen = 1;
+			*((char *) p->subs[idx].f.data.ptr) = c;
 			ast_mutex_unlock(&p->lock);
-			return &p->subs[index].f;
+			return &p->subs[idx].f;
 		}
 	}
 	/* Ensure the CW timer decrements only on a single subchannel */
@@ -5409,44 +5409,44 @@
 		ast_verb(3, "CPE does not support Call Waiting Caller*ID.\n");
 		restore_conference(p);
 	}
-	if (p->subs[index].linear) {
-		p->subs[index].f.datalen = READ_SIZE * 2;
+	if (p->subs[idx].linear) {
+		p->subs[idx].f.datalen = READ_SIZE * 2;
 	} else 
-		p->subs[index].f.datalen = READ_SIZE;
+		p->subs[idx].f.datalen = READ_SIZE;
 
 	/* Handle CallerID Transmission */
 	if ((p->owner == ast) && p->cidspill &&((ast->_state == AST_STATE_UP) || (ast->rings == p->cidrings))) {
 		send_callerid(p);
 	}
 
-	p->subs[index].f.frametype = AST_FRAME_VOICE;
-	p->subs[index].f.subclass = ast->rawreadformat;
-	p->subs[index].f.samples = READ_SIZE;
-	p->subs[index].f.mallocd = 0;
-	p->subs[index].f.offset = AST_FRIENDLY_OFFSET;
-	p->subs[index].f.data.ptr = p->subs[index].buffer + AST_FRIENDLY_OFFSET / sizeof(p->subs[index].buffer[0]);
+	p->subs[idx].f.frametype = AST_FRAME_VOICE;
+	p->subs[idx].f.subclass = ast->rawreadformat;
+	p->subs[idx].f.samples = READ_SIZE;
+	p->subs[idx].f.mallocd = 0;
+	p->subs[idx].f.offset = AST_FRIENDLY_OFFSET;
+	p->subs[idx].f.data.ptr = p->subs[idx].buffer + AST_FRIENDLY_OFFSET / sizeof(p->subs[idx].buffer[0]);
 #if 0
-	ast_debug(1, "Read %d of voice on %s\n", p->subs[index].f.datalen, ast->name);
+	ast_debug(1, "Read %d of voice on %s\n", p->subs[idx].f.datalen, ast->name);
 #endif	
 	if (p->dialing || /* Transmitting something */
-	   (index && (ast->_state != AST_STATE_UP)) || /* Three-way or callwait that isn't up */
-	   ((index == SUB_CALLWAIT) && !p->subs[SUB_CALLWAIT].inthreeway) /* Inactive and non-confed call-wait */
+	   (idx && (ast->_state != AST_STATE_UP)) || /* Three-way or callwait that isn't up */
+	   ((idx == SUB_CALLWAIT) && !p->subs[SUB_CALLWAIT].inthreeway) /* Inactive and non-confed call-wait */
 	   ) {
 		/* Whoops, we're still dialing, or in a state where we shouldn't transmit....
 		   don't send anything */
-		p->subs[index].f.frametype = AST_FRAME_NULL;
-		p->subs[index].f.subclass = 0;
-		p->subs[index].f.samples = 0;
-		p->subs[index].f.mallocd = 0;
-		p->subs[index].f.offset = 0;
-		p->subs[index].f.data.ptr = NULL;
-		p->subs[index].f.datalen= 0;
-	}
-	if (p->dsp && (!p->ignoredtmf || p->callwaitcas || p->busydetect  || p->callprogress) && !index) {
+		p->subs[idx].f.frametype = AST_FRAME_NULL;
+		p->subs[idx].f.subclass = 0;
+		p->subs[idx].f.samples = 0;
+		p->subs[idx].f.mallocd = 0;
+		p->subs[idx].f.offset = 0;
+		p->subs[idx].f.data.ptr = NULL;
+		p->subs[idx].f.datalen= 0;
+	}
+	if (p->dsp && (!p->ignoredtmf || p->callwaitcas || p->busydetect  || p->callprogress) && !idx) {
 		/* Perform busy detection. etc on the dahdi line */
 		int mute;
 
-		f = ast_dsp_process(ast, p->dsp, &p->subs[index].f);
+		f = ast_dsp_process(ast, p->dsp, &p->subs[idx].f);
 
 		/* Check if DSP code thinks we should be muting this frame and mute the conference if so */
 		mute = ast_dsp_was_muted(p->dsp);
@@ -5477,10 +5477,10 @@
 			}
 		}
 	} else 
-		f = &p->subs[index].f; 
+		f = &p->subs[idx].f; 
 
 	if (f && (f->frametype == AST_FRAME_DTMF))
-		dahdi_handle_dtmfup(ast, index, &f);
+		dahdi_handle_dtmfup(ast, idx, &f);
 
 	/* If we have a fake_event, trigger exception to handle it */
 	if (p->fake_event)
@@ -5490,13 +5490,13 @@
 	return f;
 }
 
-static int my_dahdi_write(struct dahdi_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 idx, int linear)
 {
 	int sent=0;
 	int size;
 	int res;
 	int fd;
-	fd = p->subs[index].zfd;
+	fd = p->subs[idx].zfd;
 	while (len) {
 		size = len;
 		if (size > (linear ? READ_SIZE * 2 : READ_SIZE))
@@ -5516,9 +5516,9 @@
 {
 	struct dahdi_pvt *p = ast->tech_pvt;
 	int res;
-	int index;
-	index = dahdi_get_index(ast, p, 0);
-	if (index < 0) {
+	int idx;
+	idx = dahdi_get_index(ast, p, 0);
+	if (idx < 0) {
 		ast_log(LOG_WARNING, "%s doesn't really exist?\n", ast->name);
 		return -1;
 	}
@@ -5568,22 +5568,22 @@
 		return 0;
 
 	if (frame->subclass == AST_FORMAT_SLINEAR) {
-		if (!p->subs[index].linear) {
-			p->subs[index].linear = 1;
-			res = dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
+		if (!p->subs[idx].linear) {
+			p->subs[idx].linear = 1;
+			res = dahdi_setlinear(p->subs[idx].zfd, p->subs[idx].linear);
 			if (res)
 				ast_log(LOG_WARNING, "Unable to set linear mode on channel %d\n", p->channel);
 		}
-		res = my_dahdi_write(p, (unsigned char *)frame->data.ptr, frame->datalen, index, 1);
+		res = my_dahdi_write(p, (unsigned char *)frame->data.ptr, frame->datalen, idx, 1);
 	} else {
 		/* x-law already */
-		if (p->subs[index].linear) {
-			p->subs[index].linear = 0;
-			res = dahdi_setlinear(p->subs[index].zfd, p->subs[index].linear);
+		if (p->subs[idx].linear) {
+			p->subs[idx].linear = 0;
+			res = dahdi_setlinear(p->subs[idx].zfd, p->subs[idx].linear);
 			if (res)
 				ast_log(LOG_WARNING, "Unable to set companded mode on channel %d\n", p->channel);
 		}
-		res = my_dahdi_write(p, (unsigned char *)frame->data.ptr, frame->datalen, index, 0);
+		res = my_dahdi_write(p, (unsigned char *)frame->data.ptr, frame->datalen, idx, 0);
 	}
 	if (res < 0) {
 		ast_log(LOG_WARNING, "write failed: %s\n", strerror(errno));
@@ -5596,12 +5596,12 @@
 {
 	struct dahdi_pvt *p = chan->tech_pvt;
 	int res=-1;
-	int index;
+	int idx;
 	int func = DAHDI_FLASH;
 	ast_mutex_lock(&p->lock);
-	index = dahdi_get_index(chan, p, 0);
+	idx = dahdi_get_index(chan, p, 0);

[... 854 lines stripped ...]



More information about the svn-commits mailing list