diff options
Diffstat (limited to 'zaptel.c')
-rw-r--r-- | zaptel.c | 32 |
1 files changed, 29 insertions, 3 deletions
@@ -713,6 +713,7 @@ static void zt_check_conf(int x) /* enqueue an event on a channel */ static void __qevent(struct zt_chan *chan, int event) { + /* if full, ignore */ if ((chan->eventoutidx == 0) && (chan->eventinidx == (ZT_MAX_EVENTSIZE - 1))) return; @@ -5078,7 +5079,7 @@ static inline void rbs_itimer_expire(struct zt_chan *chan) __qevent(chan,ZT_EVENT_ONHOOK); chan->gotgs = 0; break; -#ifdef EMFLASH +#if defined(EMFLASH) || defined(EMPULSE) case ZT_SIG_EM: case ZT_SIG_EM_E1: if (chan->rxhooksig == ZT_RXSIG_ONHOOK) { @@ -5264,6 +5265,25 @@ static void __zt_hooksig_pvt(struct zt_chan *chan, zt_rxsig_t rxsig) break; } #endif +#ifdef EMPULSE + if (chan->itimer) /* if timer still running */ + { + int plen = chan->itimerset - chan->itimer; + if (plen <= ZT_MAXPULSETIME) + { + if (plen >= ZT_MINPULSETIME) + { + chan->pulsecount++; + + chan->pulsetimer = ZT_PULSETIMEOUT; + chan->itimerset = chan->itimer = 0; + if (chan->pulsecount == 1) + __qevent(chan,ZT_EVENT_PULSE_START); + } + } + break; + } +#endif /* set wink timer */ chan->itimerset = chan->itimer = chan->rxwinktime * ZT_CHUNKSIZE; break; @@ -5272,13 +5292,19 @@ static void __zt_hooksig_pvt(struct zt_chan *chan, zt_rxsig_t rxsig) Check for WINK, etc */ if (chan->itimer) __qevent(chan,ZT_EVENT_WINKFLASH); -#ifdef EMFLASH +#if defined(EMFLASH) || defined(EMPULSE) else { +#ifdef EMFLASH chan->itimerset = chan->itimer = chan->rxflashtime * ZT_CHUNKSIZE; + +#else /* EMFLASH */ + chan->itimerset = chan->itimer = chan->rxwinktime * ZT_CHUNKSIZE; + +#endif /* EMFLASH */ chan->gotgs = 0; break; } -#else +#else /* EMFLASH || EMPULSE */ else { __qevent(chan,ZT_EVENT_ONHOOK); chan->gotgs = 0; |