summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-06-05 07:01:23 +0000
committerMark Spencer <markster@digium.com>2004-06-05 07:01:23 +0000
commit746d2e7f678ddecf3a2ccae0e627abaf015353be (patch)
tree5de84ef80d21a5395986ba454f42c2a362b0d303 /channels
parent27578642b86b8bfa603a1b21a257ccac5729cd88 (diff)
Minor cleanups
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3147 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_zap.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 9b7fe3664..b2ce299f3 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -1893,8 +1893,10 @@ static int zt_hangup(struct ast_channel *ast)
p->faxhandled = 0;
p->pulsedial = 0;
p->onhooktime = time(NULL);
+#ifdef ZAPATA_PRI
p->proceeding = 0;
p->setup_ack = 0;
+#endif
if (p->dsp) {
ast_dsp_free(p->dsp);
p->dsp = NULL;
@@ -5146,7 +5148,11 @@ static void *do_monitor(void *data)
count = 0;
i = iflist;
while(i) {
- if ((i->subs[SUB_REAL].zfd > -1) && i->sig && (!i->radio) && !i->pri) {
+ if ((i->subs[SUB_REAL].zfd > -1) && i->sig && (!i->radio)
+#ifdef ZAPATA_PRI
+ && !i->pri
+#endif
+ ) {
if (!i->owner && !i->subs[SUB_REAL].owner) {
/* This needs to be watched, as it lacks an owner */
pfds[count].fd = i->subs[SUB_REAL].zfd;
@@ -6156,7 +6162,7 @@ static int pri_find_principle(struct zt_pri *pri, int channel)
span = PRI_SPAN(channel);
channel = PRI_CHANNEL(channel);
- for (x=1;x<=pri->numchans;x++) {
+ for (x=1;x<pri->numchans;x++) {
if (pri->pvts[x] && (pri->pvts[x]->prioffset == channel) && (pri->logicalspan == span)) {
principle = x;
break;
@@ -6175,11 +6181,11 @@ static int pri_fixup_principle(struct zt_pri *pri, int principle, q931_call *c)
return principle;
}
if ((principle > -1) &&
- (principle <= pri->numchans) &&
+ (principle < pri->numchans) &&
(pri->pvts[principle]) &&
(pri->pvts[principle]->call == c))
return principle;
- for (x=1;x<=pri->numchans;x++) {
+ for (x=1;x<pri->numchans;x++) {
if (!pri->pvts[x]) continue;
if (pri->pvts[x]->call == c) {
/* Found our call */
@@ -6282,11 +6288,11 @@ static int pri_check_restart(struct zt_pri *pri)
{
do {
pri->resetpos++;
- } while((pri->resetpos <= pri->numchans) &&
+ } while((pri->resetpos < pri->numchans) &&
(!pri->pvts[pri->resetpos] ||
pri->pvts[pri->resetpos]->call ||
pri->pvts[pri->resetpos]->resetting));
- if (pri->resetpos <= pri->numchans) {
+ if (pri->resetpos < pri->numchans) {
/* Mark the channel as resetting and restart it */
pri->pvts[pri->resetpos]->resetting = 1;
pri_reset(pri->pri, PVT_TO_CHANNEL(pri->pvts[pri->resetpos]));
@@ -6480,7 +6486,7 @@ static void *pri_dchannel(void *vpri)
pri->lastreset += 5;
pri->resetting = 0;
/* Take the channels from inalarm condition */
- for (i=0; i<=pri->numchans; i++)
+ for (i=0; i<pri->numchans; i++)
if (pri->pvts[i]) {
pri->pvts[i]->inalarm = 0;
}
@@ -6491,7 +6497,7 @@ static void *pri_dchannel(void *vpri)
pri->up = 0;
pri->resetting = 0;
/* Hangup active channels and put them in alarm mode */
- for (i=0; i<=pri->numchans; i++) {
+ for (i=0; i<pri->numchans; i++) {
struct zt_pvt *p = pri->pvts[i];
if (p) {
if (p->call) {
@@ -6531,7 +6537,7 @@ static void *pri_dchannel(void *vpri)
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_2 "Restart on requested on entire span %d\n", pri->span);
- for (x=1;x <= pri->numchans;x++)
+ for (x=1;x < pri->numchans;x++)
if (pri->pvts[x]) {
ast_mutex_lock(&pri->pvts[x]->lock);
if (pri->pvts[x]->call) {