[Asterisk-cvs] zaptel zaptel.c,1.94,1.95 zaptel.h,1.37,1.38
markster at lists.digium.com
markster at lists.digium.com
Mon Sep 27 15:47:30 CDT 2004
Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv2336
Modified Files:
zaptel.c zaptel.h
Log Message:
Fix negative cadences
Index: zaptel.c
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- zaptel.c 11 Sep 2004 15:48:45 -0000 1.94
+++ zaptel.c 27 Sep 2004 19:50:03 -0000 1.95
@@ -1989,7 +1989,8 @@
chan->afterdialingtimer = 0;
chan->cadencepos = 0;
-
+ chan->firstcadencepos = 0; /* By default loop back to first cadence position */
+
/* HDLC & FCS stuff */
fasthdlc_init(&chan->rxhdlc);
fasthdlc_init(&chan->txhdlc);
@@ -3782,10 +3783,28 @@
if (copy_from_user(&stack.cad, (struct zt_ring_cadence *)data, sizeof(stack.cad)))
return -EIO;
memcpy(chan->ringcadence, &stack.cad, sizeof(chan->ringcadence));
+ chan->firstcadencepos = 0;
+ /* Looking for negative ringing time indicating where to loop back into ringcadence */
+ for (i=0; i<ZT_MAX_CADENCE; i+=2 ) {
+ if (chan->ringcadence[i]<0) {
+ chan->ringcadence[i] *= -1;
+ chan->firstcadencepos = i;
+ break;
+ }
+ }
} else {
/* Reset to default */
+ chan->firstcadencepos = 0;
if (chan->curzone) {
memcpy(chan->ringcadence, chan->curzone->ringcadence, sizeof(chan->ringcadence));
+ /* Looking for negative ringing time indicating where to loop back into ringcadence */
+ for (i=0; i<ZT_MAX_CADENCE; i+=2 ) {
+ if (chan->ringcadence[i]<0) {
+ chan->ringcadence[i] *= -1;
+ chan->firstcadencepos = i;
+ break;
+ }
+ }
} else {
memset(chan->ringcadence, 0, sizeof(chan->ringcadence));
chan->ringcadence[0] = chan->starttime;
@@ -4888,11 +4907,11 @@
/* Turn on the ringer now that the silent time has passed */
++chan->cadencepos;
if (chan->cadencepos >= ZT_MAX_CADENCE)
- chan->cadencepos = 0;
+ chan->cadencepos = chan->firstcadencepos;
len = chan->ringcadence[chan->cadencepos];
if (!len) {
- chan->cadencepos = 0;
+ chan->cadencepos = chan->firstcadencepos;
len = chan->ringcadence[chan->cadencepos];
}
Index: zaptel.h
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- zaptel.h 11 Sep 2004 15:48:45 -0000 1.37
+++ zaptel.h 27 Sep 2004 19:50:03 -0000 1.38
@@ -1021,6 +1021,7 @@
/* Ring cadence */
int ringcadence[ZT_MAX_CADENCE];
+ int firstcadencepos; /* Where to restart ring cadence */
/* Digit string dialing stuff */
int digitmode; /* What kind of tones are we sending? */
More information about the svn-commits
mailing list