From 8fd2621c32a2a20a93298eab436f91ae5c55073e Mon Sep 17 00:00:00 2001 From: jdixon Date: Mon, 26 Dec 2005 17:40:37 +0000 Subject: Added support for Dial Pulse recognition on E&M trunks git-svn-id: http://svn.digium.com/svn/zaptel/trunk@876 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- zaptel.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'zaptel.c') diff --git a/zaptel.c b/zaptel.c index fa2be5b..4ccd3e8 100644 --- a/zaptel.c +++ b/zaptel.c @@ -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) { @@ -5263,6 +5264,25 @@ static void __zt_hooksig_pvt(struct zt_chan *chan, zt_rxsig_t rxsig) chan->itimerset = chan->itimer = 0; 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; @@ -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; -- cgit v1.2.3