summaryrefslogtreecommitdiff
path: root/wcfxs.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-05-25 15:07:52 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-05-25 15:07:52 +0000
commit13e607262480c596ffaddbe713219a9a2f6f351e (patch)
treee39d886789263af472129d6ea1338e155c736cc2 /wcfxs.c
parentb4278508035f2518afb6f00fdac0aa6e11a2e20e (diff)
Add Audio based RING detection
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@400 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wcfxs.c')
-rwxr-xr-xwcfxs.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/wcfxs.c b/wcfxs.c
index 37f01ea..f297469 100755
--- a/wcfxs.c
+++ b/wcfxs.c
@@ -34,7 +34,11 @@
#include "proslic.h"
#include "wcfxs.h"
-
+/*
+ * Define for audio vs. register based ring detection
+ *
+ */
+#define AUDIO_RINGCHECK
static alpha indirect_regs[] =
{
{0,"DTMF_ROW_0_PEAK",0x55C2},
@@ -270,18 +274,19 @@ static inline void ring_check(struct wcfxs *wc, int card)
short sample;
if (wc->modtype[card] != MOD_TYPE_FXO)
return;
+ wc->mod.fxo.pegtimer[card] += ZT_CHUNKSIZE;
for (x=0;x<ZT_CHUNKSIZE;x++) {
/* Look for pegging to indicate ringing */
sample = ZT_XLAW(wc->chans[card].readchunk[x], (&(wc->chans[card])));
- if ((sample > 32000) && (wc->mod.fxo.peg[card] != 1)) {
- printk("High peg!\n");
+ if ((sample > 10000) && (wc->mod.fxo.peg[card] != 1)) {
+ if (debug > 1) printk("High peg!\n");
if ((wc->mod.fxo.pegtimer[card] < PEGTIME) && (wc->mod.fxo.pegtimer[card] > MINPEGTIME))
wc->mod.fxo.pegcount[card]++;
wc->mod.fxo.pegtimer[card] = 0;
wc->mod.fxo.peg[card] = 1;
- } else if ((sample < -32000) && (wc->mod.fxo.peg[card] != -1)) {
- printk("Low peg!\n");
- if ((wc->mod.fxo.pegtimer[card] < PEGTIME) && (wc->mod.fxo.pegtimer[card] > MINPEGTIME))
+ } else if ((sample < -10000) && (wc->mod.fxo.peg[card] != -1)) {
+ if (debug > 1) printk("Low peg!\n");
+ if ((wc->mod.fxo.pegtimer[card] < (PEGTIME >> 2)) && (wc->mod.fxo.pegtimer[card] > (MINPEGTIME >> 2)))
wc->mod.fxo.pegcount[card]++;
wc->mod.fxo.pegtimer[card] = 0;
wc->mod.fxo.peg[card] = -1;
@@ -299,7 +304,8 @@ static inline void ring_check(struct wcfxs *wc, int card)
/* It's ringing */
if (debug)
printk("RING on %d/%d!\n", wc->span.spanno, card + 1);
- zt_hooksig(&wc->chans[card], ZT_RXSIG_RING);
+ if (!wc->mod.fxo.offhook[card])
+ zt_hooksig(&wc->chans[card], ZT_RXSIG_RING);
wc->mod.fxo.ring[card] = 1;
}
if (wc->mod.fxo.ring[card] && !wc->mod.fxo.pegcount[card]) {
@@ -1206,12 +1212,16 @@ static inline void wcfxs_proslic_recheck_sanity(struct wcfxs *wc, int card)
static inline void wcfxs_voicedaa_check_hook(struct wcfxs *wc, int card)
{
+#ifndef AUDIO_RINGCHECK
unsigned char res;
+#endif
signed char b;
/* Try to track issues that plague slot one FXO's */
b = wcfxs_getreg(wc, card, 5);
if ((b & 0x2) || !(b & 0x8)) {
/* Not good -- don't look at anything else */
+ if (debug)
+ printk("Poopy (%02x) on card %d!\n", b, card + 1);
return;
}
b &= 0x9;