[asterisk-commits] seanbright: branch seanbright/resolve-shadow-warnings r114307 - in /team/sean...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Apr 19 13:40:14 CDT 2008
Author: seanbright
Date: Sat Apr 19 13:40:13 2008
New Revision: 114307
URL: http://svn.digium.com/view/asterisk?view=rev&rev=114307
Log:
Um. Note to self, never used 'index' as a variable name ever again.
Modified:
team/seanbright/resolve-shadow-warnings/channels/chan_zap.c
team/seanbright/resolve-shadow-warnings/include/asterisk/callerid.h
Modified: team/seanbright/resolve-shadow-warnings/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_zap.c?view=diff&rev=114307&r1=114306&r2=114307
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_zap.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_zap.c Sat Apr 19 13:40:13 2008
@@ -1223,16 +1223,16 @@
static int zt_digit_begin(struct ast_channel *chan, char digit)
{
struct zt_pvt *pvt;
- int index;
+ int idx;
int dtmf = -1;
pvt = chan->tech_pvt;
ast_mutex_lock(&pvt->lock);
- index = zt_get_index(chan, pvt, 0);
-
- if ((index != SUB_REAL) || !pvt->owner)
+ idx = zt_get_index(chan, pvt, 0);
+
+ if ((idx != SUB_REAL) || !pvt->owner)
goto out;
#ifdef HAVE_PRI
@@ -1286,16 +1286,16 @@
{
struct zt_pvt *pvt;
int res = 0;
- int index;
+ int idx;
int x;
pvt = chan->tech_pvt;
ast_mutex_lock(&pvt->lock);
- index = zt_get_index(chan, pvt, 0);
-
- if ((index != SUB_REAL) || !pvt->owner || pvt->pulse)
+ idx = zt_get_index(chan, pvt, 0);
+
+ if ((idx != SUB_REAL) || !pvt->owner || pvt->pulse)
goto out;
#ifdef HAVE_PRI
@@ -1354,14 +1354,14 @@
{ ZT_ALARM_NONE, "None" },
};
-static char *alarm2str(int alarm)
+static char *alarm2str(int alm)
{
int x;
- for (x = 0; x < sizeof(alarms) / sizeof(alarms[0]); x++) {
- if (alarms[x].alarm & alarm)
+ for (x = 0; x < ARRAY_LEN(alarms); x++) {
+ 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)
@@ -1451,7 +1451,7 @@
#define sig2str zap_sig2str
-static int conf_add(struct zt_pvt *p, struct zt_subchannel *c, int index, int slavechannel)
+static int conf_add(struct zt_pvt *p, struct zt_subchannel *c, int idx, int slavechannel)
{
/* If the conference already exists, and we're already in it
don't bother doing anything */
@@ -1465,7 +1465,7 @@
zi.confmode = ZT_CONF_DIGITALMON;
zi.confno = slavechannel;
} else {
- if (!index) {
+ if (!idx) {
/* 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;
@@ -1500,7 +1500,7 @@
return 0;
}
-static int conf_del(struct zt_pvt *p, struct zt_subchannel *c, int index)
+static int conf_del(struct zt_pvt *p, struct zt_subchannel *c, int idx)
{
ZT_CONFINFO zi;
if (/* Can't delete if there's no zfd */
@@ -2096,7 +2096,7 @@
static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
{
struct zt_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;
@@ -2222,9 +2222,9 @@
else
p->lastcid_name[0] = '\0';
ast_setstate(ast, AST_STATE_RINGING);
- index = zt_get_index(ast, p, 0);
- if (index > -1) {
- p->subs[index].needringing = 1;
+ idx = zt_get_index(ast, p, 0);
+ if (idx > -1) {
+ p->subs[idx].needringing = 1;
}
break;
case SIG_FXSLS:
@@ -2976,7 +2976,7 @@
static int zt_hangup(struct ast_channel *ast)
{
int res;
- int index,x, law;
+ int idx, x, law;
/*static int restore_gains(struct zt_pvt *p);*/
struct zt_pvt *p = ast->tech_pvt;
struct zt_pvt *tmp = NULL;
@@ -2991,7 +2991,7 @@
ast_mutex_lock(&p->lock);
- index = zt_get_index(ast, p, 1);
+ idx = zt_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;
@@ -3018,22 +3018,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;
- zt_setlinear(p->subs[index].zfd, 0);
- if (index == SUB_REAL) {
+ zt_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) {
@@ -3084,7 +3084,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
@@ -3100,7 +3100,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 */
@@ -3328,13 +3328,13 @@
{
struct zt_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 = zt_get_index(ast, p, 0);
- if (index < 0)
- index = SUB_REAL;
+ idx = zt_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);
@@ -3370,9 +3370,9 @@
p->polaritydelaytv = ast_tvnow();
}
res = zt_set_hook(p->subs[SUB_REAL].zfd, ZT_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);
@@ -3428,7 +3428,7 @@
char *cp;
signed char *scp;
int x;
- int index;
+ int idx;
struct zt_pvt *p = chan->tech_pvt, *pp;
struct oprmode *oprmode;
@@ -3442,22 +3442,22 @@
switch (option) {
case AST_OPTION_TXGAIN:
scp = (signed char *) data;
- index = zt_get_index(chan, p, 0);
- if (index < 0) {
+ idx = zt_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 = zt_get_index(chan, p, 0);
- if (index < 0) {
+ idx = zt_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;
@@ -3501,12 +3501,12 @@
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);
- if (index < 0) {
+ idx = zt_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;
@@ -4222,7 +4222,7 @@
return ZT_ALARM_NONE;
}
-static void zt_handle_dtmfup(struct ast_channel *ast, int index, struct ast_frame **dest)
+static void zt_handle_dtmfup(struct ast_channel *ast, int idx, struct ast_frame **dest)
{
struct zt_pvt *p = ast->tech_pvt;
struct ast_frame *f = *dest;
@@ -4233,9 +4233,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) {
@@ -4246,9 +4246,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) {
@@ -4269,45 +4269,45 @@
} else
ast_debug(1, "Fax already handled\n");
zt_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 *zt_handle_event(struct ast_channel *ast)
{
int res, x;
- int index, mysig;
+ int idx, mysig;
char *c;
struct zt_pvt *p = ast->tech_pvt;
pthread_t threadid;
struct ast_channel *chan;
struct ast_frame *f;
- index = zt_get_index(ast, p, 0);
+ idx = zt_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 = "zt_handle_event";
- p->subs[index].f.data = 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 = "zt_handle_event";
+ p->subs[idx].f.data = 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 = zt_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 = zt_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 & (ZT_EVENT_PULSEDIGIT | ZT_EVENT_DTMFUP)) {
p->pulsedial = (res & ZT_EVENT_PULSEDIGIT) ? 1 : 0;
@@ -4317,12 +4317,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
- zt_handle_dtmfup(ast, index, &f);
+ zt_handle_dtmfup(ast, idx, &f);
return f;
}
@@ -4330,9 +4330,9 @@
ast_debug(1, "DTMF Down '%c'\n", res & 0xff);
/* Mute conference */
zt_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) {
@@ -4347,12 +4347,12 @@
case ZT_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 ZT_EVENT_DIALCOMPLETE:
if (p->inalarm) break;
if ((p->radio || (p->oprmode < 0))) break;
- if (ioctl(p->subs[index].zfd,ZT_DIALING,&x) == -1) {
+ if (ioctl(p->subs[idx].zfd,ZT_DIALING,&x) == -1) {
ast_debug(1, "ZT_DIALING ioctl failed on %s\n",ast->name);
return NULL;
}
@@ -4370,8 +4370,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 */
@@ -4385,8 +4385,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 {
@@ -4442,8 +4442,8 @@
#endif
case ZT_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)
@@ -4466,7 +4466,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 */
@@ -4474,8 +4474,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;
@@ -4557,7 +4557,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:
@@ -4580,8 +4580,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
@@ -4609,7 +4609,7 @@
return NULL;
}
p->dialing = 1;
- return &p->subs[index].f;
+ return &p->subs[idx].f;
}
switch (p->sig) {
case SIG_FXOLS:
@@ -4619,10 +4619,10 @@
case AST_STATE_RINGING:
zt_enable_ec(p);
zt_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 */
- zt_set_hook(p->subs[index].zfd, ZT_OFFHOOK);
+ zt_set_hook(p->subs[idx].zfd, ZT_OFFHOOK);
ast_debug(1, "channel %d answered\n", p->channel);
if (p->cidspill) {
/* Cancel any running CallerID spill */
@@ -4633,8 +4633,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, ZT_DIAL, &p->dop);
@@ -4644,29 +4644,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 */
- zt_set_hook(p->subs[index].zfd, ZT_OFFHOOK);
+ zt_set_hook(p->subs[idx].zfd, ZT_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 */
@@ -4713,16 +4713,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)
@@ -4755,8 +4755,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 ZT_EVENT_RINGERON:
break;
@@ -4799,11 +4799,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);
+ ast_log(LOG_WARNING, "Got flash hook with index %d on channel %d?!?\n", idx, p->channel);
goto winkflashdone;
}
@@ -5091,7 +5091,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 *__zt_exception(struct ast_channel *ast)
@@ -5099,21 +5099,21 @@
struct zt_pvt *p = ast->tech_pvt;
int res;
int usedindex=-1;
- int index;
+ int idx;
struct ast_frame *f;
- index = zt_get_index(ast, p, 1);
+ idx = zt_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 = "zt_exception";
- p->subs[index].f.data = 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 = "zt_exception";
+ p->subs[idx].f.data = NULL;
if ((!p->owner) && (!(p->radio || (p->oprmode < 0)))) {
@@ -5185,7 +5185,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)))
@@ -5193,7 +5193,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 = zt_handle_event(ast);
@@ -5214,17 +5214,17 @@
{
struct zt_pvt *p = ast->tech_pvt;
int res;
- int index;
+ int idx;
void *readbuf;
struct ast_frame *f;
ast_mutex_lock(&p->lock);
- index = zt_get_index(ast, p, 0);
+ idx = zt_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;
@@ -5232,15 +5232,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 = "zt_read";
- p->subs[index].f.data = 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 = "zt_read";
+ p->subs[idx].f.data = NULL;
/* make sure it sends initial key state as first frame */
if ((p->radio || (p->oprmode < 0)) && (!p->firstradio))
@@ -5253,17 +5253,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);
@@ -5272,103 +5272,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 = zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ if (!p->subs[idx].linear) {
+ p->subs[idx].linear = 1;
+ res = zt_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 = zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+ if (p->subs[idx].linear) {
+ p->subs[idx].linear = 0;
+ res = zt_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) {
@@ -5377,7 +5377,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 = __zt_exception(ast);
} else
@@ -5386,8 +5386,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 = __zt_exception(ast);
ast_mutex_unlock(&p->lock);
return f;
@@ -5402,15 +5402,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 = p->subs[index].buffer + AST_FRIENDLY_OFFSET;
- p->subs[index].f.datalen = 1;
- *((char *) p->subs[index].f.data) = 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 = p->subs[idx].buffer + AST_FRIENDLY_OFFSET;
+ p->subs[idx].f.datalen = 1;
+ *((char *) p->subs[idx].f.data) = c;
ast_mutex_unlock(&p->lock);
- return &p->subs[index].f;
+ return &p->subs[idx].f;
}
}
if (p->callwaitingrepeat)
@@ -5427,44 +5427,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 = 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 = 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 = 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 = 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 zap 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);
@@ -5495,10 +5495,10 @@
}
}
} else
- f = &p->subs[index].f;
+ f = &p->subs[idx].f;
if (f && (f->frametype == AST_FRAME_DTMF))
- zt_handle_dtmfup(ast, index, &f);
+ zt_handle_dtmfup(ast, idx, &f);
/* If we have a fake_event, trigger exception to handle it */
if (p->fake_event)
@@ -5508,13 +5508,13 @@
return f;
}
-static int my_zt_write(struct zt_pvt *p, unsigned char *buf, int len, int index, int linear)
+static int my_zt_write(struct zt_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))
@@ -5534,9 +5534,9 @@
{
struct zt_pvt *p = ast->tech_pvt;
int res;
- int index;
- index = zt_get_index(ast, p, 0);
- if (index < 0) {
+ int idx;
+ idx = zt_get_index(ast, p, 0);
+ if (idx < 0) {
ast_log(LOG_WARNING, "%s doesn't really exist?\n", ast->name);
return -1;
}
@@ -5586,22 +5586,22 @@
return 0;
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);
+ if (!p->subs[idx].linear) {
+ p->subs[idx].linear = 1;
+ res = zt_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_zt_write(p, (unsigned char *)frame->data, frame->datalen, index, 1);
+ res = my_zt_write(p, (unsigned char *)frame->data, frame->datalen, idx, 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);
+ if (p->subs[idx].linear) {
+ p->subs[idx].linear = 0;
+ res = zt_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_zt_write(p, (unsigned char *)frame->data, frame->datalen, index, 0);
+ res = my_zt_write(p, (unsigned char *)frame->data, frame->datalen, idx, 0);
}
if (res < 0) {
ast_log(LOG_WARNING, "write failed: %s\n", strerror(errno));
@@ -5614,10 +5614,10 @@
{
struct zt_pvt *p = chan->tech_pvt;
int res=-1;
- int index;
+ int idx;
int func = ZT_FLASH;
ast_mutex_lock(&p->lock);
- index = zt_get_index(chan, p, 0);
+ idx = zt_get_index(chan, p, 0);
ast_debug(1, "Requested indication %d on channel %s\n", condition, chan->name);
if (index == SUB_REAL) {
switch (condition) {
@@ -5639,10 +5639,10 @@
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[idx].zfd, ZT_TONE_BUSY);
} else
#endif
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_BUSY);
+ res = tone_zone_play_tone(p->subs[idx].zfd, ZT_TONE_BUSY);
break;
case AST_CONTROL_RINGING:
#ifdef HAVE_PRI
@@ -5675,7 +5675,7 @@
}
#endif
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_RINGTONE);
+ res = tone_zone_play_tone(p->subs[idx].zfd, ZT_TONE_RINGTONE);
if (chan->_state != AST_STATE_UP) {
if ((chan->_state != AST_STATE_RING) ||
@@ -5771,10 +5771,10 @@
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[idx].zfd, ZT_TONE_CONGESTION);
} else
#endif
- res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+ res = tone_zone_play_tone(p->subs[idx].zfd, ZT_TONE_CONGESTION);
break;
case AST_CONTROL_HOLD:
#ifdef HAVE_PRI
@@ -5802,12 +5802,12 @@
break;
case AST_CONTROL_RADIO_KEY:
if (p->radio)
- res = zt_set_hook(p->subs[index].zfd, ZT_OFFHOOK);
+ res = zt_set_hook(p->subs[idx].zfd, ZT_OFFHOOK);
res = 0;
break;
case AST_CONTROL_RADIO_UNKEY:
if (p->radio)
- res = zt_set_hook(p->subs[index].zfd, ZT_RINGOFF);
+ res = zt_set_hook(p->subs[idx].zfd, ZT_RINGOFF);
res = 0;
break;
case AST_CONTROL_FLASH:
@@ -5827,7 +5827,7 @@
res = 0;
break;
case -1:
- res = tone_zone_play_tone(p->subs[index].zfd, -1);
+ res = tone_zone_play_tone(p->subs[idx].zfd, -1);
break;
}
} else
@@ -5836,7 +5836,7 @@
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 *zt_new(struct zt_pvt *i, int state, int startpbx, int idx, int law, int transfercapability)
{
struct ast_channel *tmp;
int deflaw;
@@ -5846,8 +5846,8 @@
struct ast_str *chan_name;
struct ast_variable *v;
ZT_PARAMS ps;
- if (i->subs[index].owner) {
- ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[index]);
+ if (i->subs[idx].owner) {
+ ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[idx]);
return NULL;
}
y = 1;
@@ -5863,7 +5863,7 @@
else
ast_str_set(&chan_name, 0, "%d-%d", i->channel, y);
for (x = 0; x < 3; x++) {
- if ((index != x) && i->subs[x].owner && !strcasecmp(chan_name->str, i->subs[x].owner->name))
+ if ((idx != x) && i->subs[x].owner && !strcasecmp(chan_name->str, i->subs[x].owner->name))
break;
}
y++;
@@ -5888,15 +5888,15 @@
else
deflaw = AST_FORMAT_ULAW;
}
- ast_channel_set_fd(tmp, 0, i->subs[index].zfd);
+ ast_channel_set_fd(tmp, 0, i->subs[idx].zfd);
tmp->nativeformats = AST_FORMAT_SLINEAR | deflaw;
/* Start out assuming ulaw since it's smaller :) */
[... 928 lines stripped ...]
More information about the asterisk-commits
mailing list