Incoming CallerID problem in UK

mat_uk2
Joined: Tue 27 of Oct, 2009

Incoming CallerID problem in UK

Posted:Tue 27 of Oct, 2009 (20:03 UTC)
Hi,

I'm having a problem getting incoming CallerID to work in the UK (Telco provider is BT for the line).

Here's my settup:

- Digium TDM410 card with 3 FXO ports in an HP server
- OS=Ubuntu 9.04
- Asterisk 1.6.0.15
- Dahdi 2.2.0.2
- Freepbx 2.5.1

I can use the 3 FXO ports for incoming and outgoing calls, no problems... but I cannot get incoming CallerID to work.  I've tested the BT line
using a DECT handset and it displays CallerID, so I believe that BT are signalling it.

Based on various articles, here's what I'm trying to get CallerID working.

- In /etc/modprobe.d/dahdi:
~~~~~~~~~~~~snip~~~~~~~~~~~~~~~
# You should place any module parameters for your DAHDI modules here
# Example:
#
# options wctdm24xxp latency=6
options wctdm24xxp opermode=UK fwringdetect=1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In /etc/asterisk/chan_dahdi.conf:
~~~~~~~~~~~~~~~~~~~~~
[channels]

#include dahdi-channels.conf

loadzone=uk
defaultzone=uk

usecallerid=yes
ukcallerid=yes
cidsignalling=v23
cidstart=polarity
sendcalleridafter=2
callerid=asreceived
;hanguponpolarityswitch=yes

;
; Default language
~~~~~~~~~~~~~~~~~~~~~~

In /etc/dahdi/system.conf:
~~~~~~~~~~~~~~~~~~~~
# Autogenerated by /usr/sbin/dahdi_genconf on Fri Oct 23 10:58:56 2009
# If you edit this file and execute /usr/sbin/dahdi_genconf again,
# your manual changes will be LOST.
# Dahdi Configuration File
#
# This file is parsed by the Dahdi Configurator, dahdi_cfg
#
# Span 1: WCTDM/0 "Wildcard TDM410P Board 1" (MASTER)
# channel 1, WCTDM/0/0, no module.
fxsks=2
echocanceller=mg2,2
fxsks=3
echocanceller=mg2,3
fxsks=4
echocanceller=mg2,4

# Global data

loadzone        = uk
defaultzone     = uk
~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In /etc/asterisk/dahdi-channels.conf:
; Autogenerated by /usr/sbin/dahdi_genconf on Thu Oct 22 16:26:01 2009
; If you edit this file and execute /usr/sbin/dahdi_genconf again,
; your manual changes will be LOST.
; Dahdi Channels Configurations (chan_dahdi.conf)
;
; This is not intended to be a complete chan_dahdi.conf. Rather, it is intended
; to be #include-d by /etc/chan_dahdi.conf that will include the global settings
;

; Span 1: WCTDM/0 "Wildcard TDM410P Board 1" (MASTER)
;;; line="2 WCTDM/0/1 FXSKS  (SWEC: MG2)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-zaptel
channel => 2
callerid=
group=
context=default

;;; line="3 WCTDM/0/2 FXSKS  (SWEC: MG2)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-zaptel
channel => 3
callerid=
group=
context=default

;;; line="4 WCTDM/0/3 FXSKS  (SWEC: MG2)"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-zaptel
channel => 4
callerid=
group=
context=default


- I've also applied a manual patch to /usr/src/asterisk-1.6.0.15/channels/chan_dahdi.c:
~~~~~~~~~~~~~~~~~~~
                              else
                                        number = NULL;
                        /* If set to use V23 Signalling, launch our FSK gubbins and listen for it */
                        } else if ((p->cid_signalling == CID_SIG_V23) || (p->cid_signalling == CID_SIG_V23_JP)) {
                                cs = callerid_new(p->cid_signalling);
                                if (cs) {
                                        samples = 0;
#if 1
                                        bump_gains(p);
#endif
                                        /* Take out of linear mode for Caller*ID processing */
                                        dahdi_setlinear(p->subs[index].dfd, 0);

                                        /* First we wait and listen for the Caller*ID */
                                        for (;;) {
                                                i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
                                                if ((res = ioctl(p->subs[index].dfd, DAHDI_IOMUX, &i))) {
                                                        ast_log(LOG_WARNING, "I/O MUX failed: %s\n", strerror(errno));
                                                        callerid_free(cs);
                                                        ast_hangup(chan);
                                                        goto quit;
                                                }
                                                if (i & DAHDI_IOMUX_SIGEVENT) {
                                                        res = dahdi_get_event(p->subs[index].dfd);
/* PATCH to ignore ring before end of cid 'slot' */
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[index].dfd, buf, sizeof(buf));
                                                        if (res < 0) {
                                                                if (errno != ELAST) {
                                                                        ast_log(LOG_WARNING, "read returned error: %s\n", strerror(errno));
                                                                        callerid_free(cs);
                                                                        ast_hangup(chan);
                                                                        goto quit;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Any help would be much appreciated!

Thanks,

Mat