summaryrefslogtreecommitdiff
path: root/zaptel.c
diff options
context:
space:
mode:
authorjdixon <jdixon@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-12-26 17:40:37 +0000
committerjdixon <jdixon@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-12-26 17:40:37 +0000
commit8fd2621c32a2a20a93298eab436f91ae5c55073e (patch)
tree4016efded7b092e46040dc9e34853ef5803ef239 /zaptel.c
parent625f93307a45b94899b12a47d0fb01edeb8aceb1 (diff)
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
Diffstat (limited to 'zaptel.c')
-rw-r--r--zaptel.c32
1 files changed, 29 insertions, 3 deletions
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) {
@@ -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;