diff -u zaptel-1.2.19-origin/zaptel-base.c zaptel-1.2.19-pc/zaptel-base.c --- zaptel-1.2.19-origin/zaptel-base.c 2007-07-19 20:23:30.000000000 +0400 +++ zaptel-1.2.19-pc/zaptel-base.c 2007-07-20 10:36:48.000000000 +0400 @@ -1978,7 +1978,7 @@ set_txtone(chan,0,0,0); } } - chan->otimer = timeout * ZT_CHUNKSIZE; /* Otimer is timer in samples */ + chan->otimer = timeout; /* Otimer is timer in ms */ return; } if (chan->span->hooksig) { @@ -1986,7 +1986,7 @@ chan->txhooksig = txsig; chan->span->hooksig(chan, txsig); } - chan->otimer = timeout * ZT_CHUNKSIZE; /* Otimer is timer in samples */ + chan->otimer = timeout; /* Otimer is timer in ms */ return; } else { for (x=0;xtxhooksig = txsig; chan->txsig = outs[x][txsig+1]; chan->span->rbsbits(chan, chan->txsig); - chan->otimer = timeout * ZT_CHUNKSIZE; /* Otimer is timer in samples */ + chan->otimer = timeout; /* Otimer is timer in ms */ return; } } @@ -3501,7 +3501,7 @@ break; case ZT_MAINT_LOOPUP: case ZT_MAINT_LOOPDOWN: - spans[maint.spanno]->mainttimer = ZT_LOOPCODE_TIME * ZT_CHUNKSIZE; + spans[maint.spanno]->mainttimer = ZT_LOOPCODE_TIME; /* in ms */ rv = spans[maint.spanno]->maint(spans[maint.spanno], maint.command); spin_unlock_irqrestore(&spans[maint.spanno]->lock, flags); if (rv) return rv; @@ -5320,7 +5320,7 @@ zt_rbs_sethook(chan, ZT_TXSIG_OFFHOOK, ZT_TXSTATE_OFFHOOK, 0); /* See if we've gone back on hook */ if ((chan->rxhooksig == ZT_RXSIG_ONHOOK) && (chan->rxflashtime > 2)) - chan->itimerset = chan->itimer = chan->rxflashtime * ZT_CHUNKSIZE; + chan->itimerset = chan->itimer = chan->rxflashtime; /* in ms */ wake_up_interruptible(&chan->txstateq); break; @@ -5362,7 +5362,7 @@ break; } chan->txstate = ZT_TXSTATE_PULSEAFTER; - chan->otimer = chan->pulseaftertime * ZT_CHUNKSIZE; + chan->otimer = chan->pulseaftertime; /* in ms */ wake_up_interruptible(&chan->txstateq); break; @@ -5408,7 +5408,7 @@ } #endif /* set wink timer */ - chan->itimerset = chan->itimer = chan->rxwinktime * ZT_CHUNKSIZE; + chan->itimerset = chan->itimer = chan->rxwinktime; /* in ms */ break; case ZT_RXSIG_ONHOOK: /* went on hook */ /* This interface is now going on hook. @@ -5417,7 +5417,7 @@ __qevent(chan,ZT_EVENT_WINKFLASH); #ifdef EMFLASH else { - chan->itimerset = chan->itimer = chan->rxflashtime * ZT_CHUNKSIZE; + chan->itimerset = chan->itimer = chan->rxflashtime; /* in ms */ chan->gotgs = 0; break; } @@ -5438,12 +5438,12 @@ if (chan->txstate != ZT_TXSTATE_OFFHOOK) break; #ifdef FXSFLASH if (rxsig == ZT_RXSIG_ONHOOK) { - chan->itimer = ZT_FXSFLASHMAXTIME * ZT_CHUNKSIZE; + chan->itimer = ZT_FXSFLASHMAXTIME; /* in ms */ break; } else if (rxsig == ZT_RXSIG_OFFHOOK) { if (chan->itimer) { /* did the offhook occur in the window? if not, ignore both events */ - if (chan->itimer <= ((ZT_FXSFLASHMAXTIME - ZT_FXSFLASHMINTIME) * ZT_CHUNKSIZE)) + if (chan->itimer <= (ZT_FXSFLASHMAXTIME - ZT_FXSFLASHMINTIME)) /* in ms */ __qevent(chan, ZT_EVENT_WINKFLASH); } chan->itimer = 0; @@ -5512,7 +5512,7 @@ if ((chan->txstate != ZT_TXSTATE_DEBOUNCE) && (chan->txstate != ZT_TXSTATE_KEWL) && (chan->txstate != ZT_TXSTATE_AFTERKEWL)) { - chan->itimerset = chan->itimer = chan->rxflashtime * ZT_CHUNKSIZE; + chan->itimerset = chan->itimer = chan->rxflashtime; /* in ms */ } if (chan->txstate == ZT_TXSTATE_KEWL) chan->kewlonhook = 1; @@ -5616,7 +5616,8 @@ rxlin = ZT_XLAW(rxchunk[x], ss); txlin = ZT_XLAW(txchunk[x], ss); if (ss->echostate == ECHO_STATE_PRETRAINING) { - if (--ss->echotimer <= 0) { + ss->echotimer -= ZT_CHUNKTIME; + if (ss->echotimer <= 0) { ss->echotimer = 0; ss->echostate = ECHO_STATE_STARTTRAINING; } @@ -5734,7 +5735,7 @@ int x,r; if (ms->dialing) ms->afterdialingtimer = 50; - else if (ms->afterdialingtimer) ms->afterdialingtimer--; + else if (ms->afterdialingtimer) ms->afterdialingtimer -= ZT_CHUNKTIME; if (ms->afterdialingtimer && (!(ms->flags & ZT_FLAG_PSEUDO))) { /* Be careful since memset is likely a macro */ rxb[0] = ZT_LIN2X(0, ms); @@ -6473,7 +6474,7 @@ spin_lock_irqsave(&span->chans[x].lock, flags); if (&span->chans[x] == span->chans[x].master) { if (span->chans[x].otimer) { - span->chans[x].otimer -= ZT_CHUNKSIZE; + span->chans[x].otimer -= ZT_CHUNKTIME; if (span->chans[x].otimer <= 0) { __rbs_otimer_expire(&span->chans[x]); } @@ -6517,7 +6518,7 @@ spin_unlock_irqrestore(&span->chans[x].lock, flags); } if (span->mainttimer) { - span->mainttimer -= ZT_CHUNKSIZE; + span->mainttimer -= ZT_CHUNKTIME; if (span->mainttimer <= 0) { span->mainttimer = 0; if (span->maint) @@ -6563,18 +6564,18 @@ __zt_real_receive(&span->chans[x]); } if (span->chans[x].itimer) { - span->chans[x].itimer -= ZT_CHUNKSIZE; + span->chans[x].itimer -= ZT_CHUNKTIME; if (span->chans[x].itimer <= 0) { rbs_itimer_expire(&span->chans[x]); } } if (span->chans[x].ringdebtimer) - span->chans[x].ringdebtimer--; + span->chans[x].ringdebtimer -= ZT_CHUNKTIME; if (span->chans[x].sig & __ZT_SIG_FXS) { if (span->chans[x].rxhooksig == ZT_RXSIG_RING) span->chans[x].ringtrailer = ZT_RINGTRAILER; else if (span->chans[x].ringtrailer) { - span->chans[x].ringtrailer-= ZT_CHUNKSIZE; + span->chans[x].ringtrailer -= ZT_CHUNKTIME; /* See if RING trailer is expired */ if (!span->chans[x].ringtrailer && !span->chans[x].ringdebtimer) __qevent(&span->chans[x],ZT_EVENT_RINGOFFHOOK); @@ -6582,7 +6583,7 @@ } if (span->chans[x].pulsetimer) { - span->chans[x].pulsetimer--; + span->chans[x].pulsetimer -= ZT_CHUNKTIME; if (span->chans[x].pulsetimer <= 0) { if (span->chans[x].pulsecount) diff -u zaptel-1.2.19-origin/zaptel.h zaptel-1.2.19-pc/zaptel.h --- zaptel-1.2.19-origin/zaptel.h 2007-07-19 20:23:30.000000000 +0400 +++ zaptel-1.2.19-pc/zaptel.h 2007-07-20 10:29:28.000000000 +0400 @@ -146,10 +146,11 @@ #define ZT_CODE 'J' -/* Default chunk size for conferences and such -- static right now, might make - variable sometime. 8 samples = 1 ms = most frequent service interval possible - for a USB device */ -#define ZT_CHUNKSIZE 8 +/* Default chunk size for conferences and such. + * 8 samples = 1 ms = most frequent service interval possible for a USB device + */ +#define ZT_CHUNKSIZE 80 +#define ZT_CHUNKTIME 10 #define ZT_MIN_CHUNKSIZE ZT_CHUNKSIZE #define ZT_DEFAULT_CHUNKSIZE ZT_CHUNKSIZE #define ZT_MAX_CHUNKSIZE ZT_CHUNKSIZE @@ -946,11 +947,11 @@ #define ZT_DEFAULT_PULSEBREAKTIME 50 /* 50 ms of line open when dial pulsing */ #define ZT_DEFAULT_PULSEAFTERTIME 750 /* 750ms between dial pulse digits */ -#define ZT_MINPULSETIME (15 * 8) /* 15 ms minimum */ -#define ZT_MAXPULSETIME (200 * 8) /* 200 ms maximum */ -#define ZT_PULSETIMEOUT ((ZT_MAXPULSETIME / 8) + 50) +#define ZT_MINPULSETIME 15 /* 15 ms minimum */ +#define ZT_MAXPULSETIME 200 /* 200 ms maximum */ +#define ZT_PULSETIMEOUT (ZT_MAXPULSETIME + 50) /* in ms */ -#define ZT_RINGTRAILER (50 * 8) /* Don't consider a ring "over" until it's been gone at least this +#define ZT_RINGTRAILER 50 /* in ms, don't consider a ring "over" until it's been gone at least this much time */ #define ZT_LOOPCODE_TIME 10000 /* send loop codes for 10 secs */