[Asterisk-Dev] Problems with ring debounce on TDM400P FXO channel

Ron Frederick frederick at timeheart.net
Thu Jun 10 21:24:47 MST 2004


Hello...

I'm a new Asterisk user. I just got my TDM11B developer's kit this week and
I have it up and running. My config has a single phone connected on channel 1
of the card (FXS port) and a phone line connected on channel 4 (FXO port).
I also have some other devices directly connected to that same phone line,
in parallel with the TDM11B. I immediately noticed a problem in this
configuration when one of the other devices went back on-hook after using
the line. The wcfxs driver for the card recognized this as a "ring" event.

I read through the Asterisk-dev archives and I found older postings which
seemed to be about a similar problem that suggested changing the PEGCOUNT
in wcfxo.c from 5 to 10. This was for the X100P card, though. I found a
similar line in wcfxs.c for my card, and I initially tried changing it, but
it had no effect. After taking a closer look at the source, I realized why.
PEGCOUNT is only used in the current CVS version of wcfxs.c when the symbol
AUDIO_RINGCHECK is defined, and this is disabled by default.

I dug around a little more in the sources, and I found the ring recognition
code that is used when AUDIO_RINGCHECK is not defined, and it seemed to have
a concept of ring debounce. However, the debounce level was hardcoded. There
was even a symbol called RING_DEBOUNCE in the file, but nothing seems to be
using it at the moment. To make an equivalent change to the PEGCOUNT change,
though, I tried changing the following:

--- wcfxs.c     31 May 2004 22:58:37 -0000      1.69
+++ wcfxs.c     11 Jun 2004 03:48:48 -0000
@@ -1241,14 +1241,14 @@
                res = wcfxs_getreg(wc, card, 5);
                if ((res & 0x60) && wc->mod.fxo.battery[card]) {
                        wc->mod.fxo.ringdebounce[card] += (ZT_CHUNKSIZE * 4);
-                       if (wc->mod.fxo.ringdebounce[card] >= ZT_CHUNKSIZE * 
32) {
+                       if (wc->mod.fxo.ringdebounce[card] >= ZT_CHUNKSIZE * 
64) {
                                if (!wc->mod.fxo.wasringing[card]) {
                                        wc->mod.fxo.wasringing[card] = 1;
                                        zt_hooksig(&wc->chans[card], 
ZT_RXSIG_RING);
                                        if (debug)
                                                printk("RING on %d/%d!\n", wc->
span.spanno, card + 1);
                                }
-                               wc->mod.fxo.ringdebounce[card] = ZT_CHUNKSIZE 
* 32;
+                               wc->mod.fxo.ringdebounce[card] = ZT_CHUNKSIZE 
* 64;
                        }
                } else {
                        wc->mod.fxo.ringdebounce[card] -= ZT_CHUNKSIZE;

Basically, I changed the "ZT_CHUNKSIZE * 32" to "ZT_CHUNKSIZE * 64" in two
places, making it wait longer before deciding that something is a real ring.
This seems to have solved my problem. Since making the change yesterday, I
haven't gotten any false ring indications when other devices directly use
the line. Since others had previously complained about this problem on the
X100P, I thought someone might find the new version of this fix useful.

I'm not sure if it would be safe to roll this change into the main tree, or
if the longer debounce time might cause problems in some other cases. However,
if a single value won't work for everyone here, it might be nice to make this
configurable somehow, much like some of the timings are configurable for the
T1/E1 lines. Has anyone considered doing this?

As an aside, I'm _really_ impressed with asterisk so far -- it is an amazing
piece of work, and I'm really enjoying going through the various config files
and trying to see what I can make it do. Thanks very much to everyone out
there who has contributed to it!
--
Ron Frederick
frederick at timeheart.net





More information about the asterisk-dev mailing list