summaryrefslogtreecommitdiff
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
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
-rw-r--r--zaptel.c32
-rw-r--r--zconfig.h15
2 files changed, 44 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;
diff --git a/zconfig.h b/zconfig.h
index 952c2a5..8df1dc8 100644
--- a/zconfig.h
+++ b/zconfig.h
@@ -136,10 +136,25 @@
/*
* Uncomment the following if you want to support E&M trunks being
* able to "flash" after going off-hook (dont ask why, just nod :-) ).
+ *
+ * NOTE: *DO NOT* Enable "EMFLASH" and "EMPULSE" at the same time!!
+ *
*/
/* #define EMFLASH */
/*
+ * Uncomment the following if you want to support E&M trunks being
+ * able to recognize Dial Pulse digits. This can validly be enabled
+ * so that either Dial Pulse or DTMF/MF tones will be recognized, but
+ * the drawback is that the ONHOOK will take an extra {rxwinktime}
+ * to be recognized.
+ *
+ * NOTE: *DO NOT* Enable "EMFLASH" and "EMPULSE" at the same time!!
+ *
+ */
+/* #define EMPULSE */
+
+/*
* Comment out the following if you dont want events to indicate the
* beginning of an incoming ring. Most non-Asterisk applications will
* want this commented out.