[asterisk-users] TDM400P UK CID ISSUE

Matt Brown matt at mbrown.co.uk
Sat Apr 5 10:34:04 CDT 2008


Hi,

I know this issue has raised its head so many times before, and I have  
been over so many threads, bug reports, mantis and other resources and  
still unable to resolve.

I was using Asterisk 1.4.13 and have upgraded to 1.4.19 and was using  
Zaptel 1.4.5.1 and now using 1.4.9.2

I found a bug tracking issue where someone has posted a UK CID fix  
which appeared to work under 1.4.5.1 which was:

Index: wctdm.c
===================================================================
--- wctdm.c     (revision 2300)
+++ wctdm.c     (working copy)

@@ -315,6 +315,7 @@
  #else
                         int wasringing;
  #endif
+                       int lastrdtx;
                         int ringdebounce;
                         int offhook;
                         int battdebounce;
@@ -859,30 +860,29 @@
                 return;
  #ifndef AUDIO_RINGCHECK
         if (!wc->mod[card].fxo.offhook) {
-               res = wc->reg0shadow[card];
-               if ((res & 0x60) && wc->mod[card].fxo.battery) {
-                       wc->mod[card].fxo.ringdebounce +=  
(ZT_CHUNKSIZE * 16);
-                       if (wc->mod[card].fxo.ringdebounce >=  
ZT_CHUNKSIZE * 64) {
+               res = wc->reg0shadow[card] & 0x60;
+               if (wc->mod[card].fxo.ringdebounce) {
+                       wc->mod[card].fxo.ringdebounce--;
+                       if (res && res != wc->mod[card].fxo.lastrdtx  
&& wc->mod[card].fxo.battery) {
                                 if (!wc->mod[card].fxo.wasringing) {
                                         wc->mod[card].fxo.wasringing  
= 1;
-                                       zt_hooksig(&wc->chans[card],  
ZT_RXSIG_RING);
                                         if (debug)
                                                 printk("RING on %d/%d! 
\n", wc->span.spanno, card + 1);
+                                       zt_hooksig(&wc->chans[card],  
ZT_RXSIG_RING);
                                 }
-                               wc->mod[card].fxo.ringdebounce =  
ZT_CHUNKSIZE * 64;
-                       }
-               } else {
-                       wc->mod[card].fxo.ringdebounce -= ZT_CHUNKSIZE  
* 4;
-                       if (wc->mod[card].fxo.ringdebounce <= 0) {
-                               if (wc->mod[card].fxo.wasringing) {
+                               wc->mod[card].fxo.lastrdtx = res;
+                               wc->mod[card].fxo.ringdebounce = 10;
+                       } else if (!res) {
+                               if (wc->mod[card].fxo.ringdebounce ==  
0 && wc->mod[card].fxo.wasringing) {
                                         wc->mod[card].fxo.wasringing  
= 0;
-                                       zt_hooksig(&wc->chans[card],  
ZT_RXSIG_OFFHOOK);
                                         if (debug)
                                                 printk("NO RING on %d/ 
%d!\n", wc->span.spanno, card + 1);
+                                       zt_hooksig(&wc->chans[card],  
ZT_RXSIG_OFFHOOK);
                                 }
-                               wc->mod[card].fxo.ringdebounce = 0;
                         }
-
+               } else if (res && wc->mod[card].fxo.battery) {
+                       wc->mod[card].fxo.lastrdtx = res;
+                       wc->mod[card].fxo.ringdebounce = 10;
                 }
         }
  #endif
@@ -1462,6 +1462,10 @@
         reg16 |= (fxo_modes[_opermode].rz << 1);
         reg16 |= (fxo_modes[_opermode].rt);
         wctdm_setreg(wc, card, 16, reg16);
+
+       /* Enable ring detector full-wave rectifier mode */
+       wctdm_setreg(wc, card, 18, 2);
+       wctdm_setreg(wc, card, 24, 0);

         /* Set DC Termination:
            Tip/Ring voltage adjust, minimum operational current,  
current limitation */

With this patch I was able to get fairly reliable CID from my TDM400P  
card (Wildcard TDM400P REV I (4 modules)) ,  however this now fails to  
patch against the latest Zaptel 1.4.9.2 and I am unable to get CID  
working reliably - some calls do show the CID correctly !!!!.

This is what appears in the output more often than not:

[Apr  5 16:21:13] NOTICE[12685]: chan_zap.c:6191 ss_thread: Got event  
2 (Ring/Answered)...
[Apr  5 16:21:15] WARNING[12685]: chan_zap.c:6254 ss_thread: CID timed  
out waiting for ring. Exiting simple switch

So for some calls we get it, other times the CID is empty. When  
plugging the DECT unit into the BT line I get CID perfectly every  
time, so I am sure this is a driver/card issue.

So has anyone found a reliable way in the UK using one of these cards  
on BT to show UK CID ?

I think I have all the right settings in the zapata.conf i.e
usecallerid => yes
cidsignalling => v23
cidstart => polarity
immediate => no

So where am I going wrong ? Sorry if this has been covered somewhere  
else or a fix .. I am just unable to find it - and I am slowly loosing  
hair !

Regards

Matt Brown





More information about the asterisk-users mailing list