UK Caller ID - Dahdi

Hi Guys,
I’ve been using asterisk for several years on 3 servers each with their own Digium TDM400. the setup of each is just a single line in from BT. Caller ID is active on each line. A few years ago I spent days trying to get caller ID working reliably rather than randomly working on about 1 in 4 calls. After quite some searching I found the following patch
cat chan_dahdi.patch-1629[code]
— channels/chan_dahdi.c 2010-06-19 13:46:31.139948106 +0100
+++ channels/chan_dahdi.c.NEW 2010-06-19 13:47:18.509931693 +0100
@@ -8455,20 +8455,25 @@
}
if (i & DAHDI_IOMUX_SIGEVENT) {
res = dahdi_get_event(p->subs[idx].dfd);

  •                                                   ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
                                                      if (res == DAHDI_EVENT_NOALARM) {
                                                              p->inalarm = 0;
                                                      }
    
  •                                                   if (p->cid_signalling == CID_SIG_V23_JP) {
    
  •                                                           if (res == DAHDI_EVENT_RINGBEGIN) {
    
  •                                                                   res = dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
    
  •                                                                   usleep(1);
    
  •                                                           }
    
  •                                                   } else {
    
  •                                                    /* Ignore ring before end of cid 'slot' (955ms = 7640 @ 8K samples/sec) */
    
  •                                                    if (res == 2 && samples < 7640) {
    
  •                                                        ast_log(LOG_NOTICE, "Ignoring event %d (%s) due to waiting for CID, samples=%d\n", res, event2str(res), samples);
    
  •                                                    } else {
    
  •                                                       ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
    
  •                                                       if (p->cid_signalling == CID_SIG_V23_JP) {
    
  •                                                               if (res == DAHDI_EVENT_RINGBEGIN) {
    
  •                                                                       res = dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
    
  •                                                                       usleep(1);
    
  •                                                               }
    
  •                                                       } else {
                                                              res = 0;
                                                              break;
    
  •                                                   }
    
  •                                                       }
    
  •                                                    }
                                              } else if (i & DAHDI_IOMUX_READ) {
                                                      res = read(p->subs[idx].dfd, buf, sizeof(buf));
                                                      if (res < 0) {
    

[/code]

as soon as I used this patch caller ID worked 100%, so I used the same method for the other 2 servers and again 100% caller ID.

As Asterisk has been updated I’ve just manually applied the patch to chan_dahdi and compiled, it’s fixed the caller ID each time.

Recently I’ve had to rebuild one of the 3 servers. so I’ve installed Ubuntu 12.04.1, dahdi-linux-complete-2.6.1+2.6.1 and thought I’d go for the newest asterisk-11.0.1. I thought I’d test the caller ID without the patch just incase things have moved on and it’s no longer needed. But no luck, it’s back to randomly getting the caller ID. So I manually applied the above patch again. However this time it hasn’t fixed the caller ID problems.

My question is, does anyone have any idea what the above patch does? from my limited ability to read it, it seems to slow down the processing.

Incase anyone has any ideas to get caller ID working, here’s snippets of my config
chan_dahdi.conf[code]
usedistinctiveringdetection=no
distinctiveringaftercid=no
usecallerid=yes
cidsignalling=v23
cidstart=polarity
callprogress=yes
progzone=uk

[phone-line]
signalling=fxs_ks
context=dahdi-incoming
callerid=asreceived
cidsignalling=v23
cidstart=polarity
;echocancel=yes
rxgain=3.0
txgain=0.0
group=1
dahdichan=1
[/code]

dahdi/system.conf[code]
loadzone=uk
defaultzone=uk

Span 1: WCTDM/4 “Wildcard TDM400P REV I Board 5” (MASTER)

fxsks=1
echocanceller=mg2,1
fxoks=2
echocanceller=mg2,2
fxoks=3
echocanceller=mg2,3
fxoks=4
echocanceller=mg2,4[/code]

As I said the same patch works 100% on Asterisk 1.8.6.0 on 2 others servers, including this one until rebuild. Just not on 11.0.1. Any thoughts would be greatly appreciated as I need to upgrade the others servers but can’t have caller ID being unreliable on the other 2. I haven’t yet tried installing an earlier version of asterisk on server 3 as I’m attempting to keep it relatively clean.

Thanks.

It appears to be trying to ignore a false detection of ringing current during the caller-ID data burst.

Note that patches, like this, outside the official issue tracking system are problematic. Digium will only incorporate code submitted directly by its copyright owner, with permission to use it in their commercial products.

If you want to submit this as an issue, first make sure you are using genuine Digium hardware, and, if so, get low level traces indicating a false ring detection. Don’t submit the existing patch, as the maintainer will not be able to look at it.

Thanks for the very quick reply. That would make sense, BT use a polarity reverse indicating a caller ID burst before the ring (from what I know). I know at least 1 of the servers (the one with the problem) is using a genuine digium card, I’m unsure on the other 2 as I didn’t install the cards.
How would I go about getting a low-level trace? I did notice earlier when a call came in asterisk run through some distinctive ring processing even though it’s off in the config file, this was either the line above or below where it should have grabbed the CLI and left it blank. I doubt it’s related, and I’m waiting for another call to go through on both systems to compare.

Do you know any way of finding out who wrote chan_dahdi.patch-1629? I presume they must have had the same problem I’m encountering to need to write the patch (google search brings up asterisk.voipsimple.co.uk so going to fire a mail incase someone there wrote it).

Thanks.

I had this problem about 2 years ago, spent months trying to understand why caller-id didn’t pop 100% of the time (best I could get was about 85%).
UK lines seem to send a “fake ring” sometimes, DAHDI then seems to wait for caller-id on the fake ring, but then the real ringing starts and that call will go through, but not the caller-id, as that’s still busy with the fake one.

*That’s a very simple way of describing it, and just from my observations

What I did was try gateways instead, most don’t work…but luckily a good cheap one by Grandstream, the GXW-4104 works great (doing an impedence test on the line configured it for me).
Also a Sangoma Vega 50 (formally Vegastream) works pretty good, but the config is a lot harder.

Of course what you could do to save some money is build an asterisk box on a previous version that works with the patch, then configure that to pass calls on to your new one over SIP (your own gateway), that way you get the latest version of asterisk and can use your existing hardware.

BT style caller ID should not send any ringing until after the caller ID is complete. BT style caller ID starts with a polarity reversal, and you need so specify that in chan_dahdi.conf.

I’m guessing that some line cards falsely recognize the modem tones as being ringing current, and that was the purpose of the patch.

I had the same issue on my BT lines, and applied the patch and spent hours playing with settings to get Caller ID working some of the time. I eventually replaced my Openvox TDM400 clone with a Sangoma A200 card and Caller ID has worked perfectly since.