diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-08-10 03:40:10 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-08-10 03:40:10 +0000 |
commit | 8ae3e727e66af804179311c50f8662f510f90271 (patch) | |
tree | ac0d6f50106c998a21533550fff67863713163cf /xpp/card_fxo.c | |
parent | 6129c183f561d9d82ada2940cf18f4ff3b4b105a (diff) |
Fix ring detection logic in FXO:
Detect ring stop only when register 0x05 shows no ring voltage for
enough samples. This is done via noring_thresh[].
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1291 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/card_fxo.c')
-rw-r--r-- | xpp/card_fxo.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/xpp/card_fxo.c b/xpp/card_fxo.c index f88a1dc..c46ba32 100644 --- a/xpp/card_fxo.c +++ b/xpp/card_fxo.c @@ -72,7 +72,8 @@ static int process_slic_cmdline(xpd_t *xpd, char *cmdline); #ifdef SOFT_RING #define POLL_RING_INTERVAL 1 -#define RING_THRESHOLD 5 +#define RING_THRESHOLD 3 +#define NORING_THRESHOLD 50 #define DAA_RING_REGISTER 0x05 #endif @@ -87,6 +88,7 @@ struct FXO_priv_data { int blinking[NUM_LEDS][CHANNELS_PERXPD]; #ifdef SOFT_RING ushort ring_thresh[CHANNELS_PERXPD]; + ushort noring_thresh[CHANNELS_PERXPD]; #endif }; @@ -722,13 +724,17 @@ HANDLER_DEF(FXO, DAA_REPLY) int i; for_each_line(xpd, i) { - if(IS_SET(lines, i)) { - if(ringit) { - if(priv->ring_thresh[i]++ > RING_THRESHOLD) { - mark_ring(xpd, i, 1); - } - } else { + if(!IS_SET(lines, i)) + continue; + if(ringit) { + if(priv->ring_thresh[i]++ > RING_THRESHOLD) { + mark_ring(xpd, i, 1); + priv->noring_thresh[i] = 0; + } + } else { + if(priv->noring_thresh[i]++ > NORING_THRESHOLD) { mark_ring(xpd, i, 0); + priv->ring_thresh[i] = 0; } } } |