Caller ID does not always work

I am having a Caller ID problem on my FreePBX 2.4 and Asterisk 1.4.18.1. I am using a TDM800 card with 8 FXO ports (only 5 are in use) and an echo cancellation card. Caller ID is only received by asterisk 50% of the time. If i plug in a standard phone to the POTS lines it always receives correct Caller ID, so the problem exists in the asterisk box. I have tried several different configuration file changes restarting zaptel and amportal each time. I have searched for fixes online but none of them resolve my problem. Thanks in advance.

Here is a console log when caller id is received correctly:
– Starting simple switch on ‘Zap/1-1’
– Executing [[email protected]:1] NoOp(“Zap/1-1”, "Entering from-zaptel with DID == “) in new stack
– Executing [[email protected]:2] Ringing(“Zap/1-1”, “”) in new stack
– Executing [[email protected]:3] Set(“Zap/1-1”, “DID=s”) in new stack
– Executing [[email protected]:4] NoOp(“Zap/1-1”, “DID is now s”) in new stack
– Executing [[email protected]:5] GotoIf(“Zap/1-1”, “1?zapok:notzap”) in new stack
– Goto (from-zaptel,s,8)
– Executing [[email protected]:8] NoOp(“Zap/1-1”, “Is a Zaptel Channel”) in new stack
– Executing [[email protected]:9] Set(“Zap/1-1”, “CHAN=1-1”) in new stack
– Executing [[email protected]:10] Set(“Zap/1-1”, “CHAN=1”) in new stack
– Executing [[email protected]:11] Macro(“Zap/1-1”, “from-zaptel-1|s|1”) in new stack
– Executing [[email protected]:12] NoOp(“Zap/1-1”, “Returned from Macro from-zaptel-1”) in new stack
– Executing [[email protected]:13] Goto(“Zap/1-1”, “from-pstn|s|1”) in new stack
– Goto (from-pstn,s,1)
– Executing [[email protected]:1] Set(“Zap/1-1”, “__FROM_DID=s”) in new stack
– Executing [[email protected]:2] GotoIf(“Zap/1-1”, “1 ?cidok”) in new stack
– Goto (from-pstn,s,4)
– Executing [[email protected]:4] NoOp(“Zap/1-1”, “CallerID is “PCS Phone LA” <2257736349>”) in new stack
– Executing [[email protected]:5] Set(“Zap/1-1”, “FAX_RX=system”) in new stack
– Executing [[email protected]:6] Set(“Zap/1-1”, "[email protected]”) in new stack
– Executing [[email protected]:7] Answer(“Zap/1-1”, “”) in new stack
– Executing [[email protected]:8] Wait(“Zap/1-1”, “0”) in new stack
– Executing [[email protected]:9] Goto(“Zap/1-1”, “ivr-2|s|1”) in new stack
– Goto (ivr-2,s,1)
– Executing [[email protected]:1] Set(“Zap/1-1”, “LOOPCOUNT=0”) in new stack
– Executing [[email protected]:2] Set(“Zap/1-1”, “__DIR-CONTEXT=default”) in new stack
– Executing [[email protected]:3] Set(“Zap/1-1”, “_IVR_CONTEXT_ivr-2=”) in new stack
– Executing [[email protected]:4] Set(“Zap/1-1”, “_IVR_CONTEXT=ivr-2”) in new stack
– Executing [[email protected]:5] GotoIf(“Zap/1-1”, “1?begin”) in new stack
– Goto (ivr-2,s,8)
– Executing [[email protected]:8] Set(“Zap/1-1”, “TIMEOUT(digit)=3”) in new stack
– Digit timeout set to 3
– Executing [[email protected]:9] Set(“Zap/1-1”, “TIMEOUT(response)=10”) in new stack
– Response timeout set to 10
– Executing [[email protected]:10] BackGround(“Zap/1-1”, “custom/Default”) in new stack
– <Zap/1-1> Playing ‘custom/Default’ (language ‘en’)
== Spawn extension (ivr-2, s, 10) exited non-zero on ‘Zap/1-1’
– Executing [[email protected]:1] Hangup(“Zap/1-1”, “”) in new stack
== Spawn extension (ivr-2, h, 1) exited non-zero on ‘Zap/1-1’
– Hungup ‘Zap/1-1’

Here is a console log when caller id is NOT received correctly:
– Starting simple switch on ‘Zap/1-1’
– Executing [[email protected]:1] NoOp(“Zap/1-1”, "Entering from-zaptel with DID == “) in new stack
– Executing [[email protected]:2] Ringing(“Zap/1-1”, “”) in new stack
– Executing [[email protected]:3] Set(“Zap/1-1”, “DID=s”) in new stack
– Executing [[email protected]:4] NoOp(“Zap/1-1”, “DID is now s”) in new stack
– Executing [[email protected]:5] GotoIf(“Zap/1-1”, “1?zapok:notzap”) in new stack
– Goto (from-zaptel,s,8)
– Executing [[email protected]:8] NoOp(“Zap/1-1”, “Is a Zaptel Channel”) in new stack
– Executing [[email protected]:9] Set(“Zap/1-1”, “CHAN=1-1”) in new stack
– Executing [[email protected]:10] Set(“Zap/1-1”, “CHAN=1”) in new stack
– Executing [[email protected]:11] Macro(“Zap/1-1”, “from-zaptel-1|s|1”) in new stack
– Executing [[email protected]:12] NoOp(“Zap/1-1”, “Returned from Macro from-zaptel-1”) in new stack
– Executing [[email protected]:13] Goto(“Zap/1-1”, “from-pstn|s|1”) in new stack
– Goto (from-pstn,s,1)
– Executing [[email protected]:1] Set(“Zap/1-1”, “__FROM_DID=s”) in new stack
– Executing [[email protected]:2] GotoIf(“Zap/1-1”, “0 ?cidok”) in new stack
– Executing [[email protected]:3] Set(“Zap/1-1”, “CALLERID(name)=”) in new stack
– Executing [[email protected]:4] NoOp(“Zap/1-1”, “CallerID is “” <>”) in new stack
– Executing [[email protected]:5] Set(“Zap/1-1”, “FAX_RX=system”) in new stack
– Executing [[email protected]:6] Set(“Zap/1-1”, "[email protected]”) in new stack
– Executing [[email protected]:7] Answer(“Zap/1-1”, “”) in new stack
– Executing [[email protected]:8] Wait(“Zap/1-1”, “0”) in new stack
– Executing [[email protected]:9] Goto(“Zap/1-1”, “ivr-2|s|1”) in new stack
– Goto (ivr-2,s,1)
– Executing [[email protected]:1] Set(“Zap/1-1”, “LOOPCOUNT=0”) in new stack
– Executing [[email protected]:2] Set(“Zap/1-1”, “__DIR-CONTEXT=default”) in new stack
– Executing [[email protected]:3] Set(“Zap/1-1”, “_IVR_CONTEXT_ivr-2=”) in new stack
– Executing [[email protected]:4] Set(“Zap/1-1”, “_IVR_CONTEXT=ivr-2”) in new stack
– Executing [[email protected]:5] GotoIf(“Zap/1-1”, “1?begin”) in new stack
– Goto (ivr-2,s,8)
– Executing [[email protected]:8] Set(“Zap/1-1”, “TIMEOUT(digit)=3”) in new stack
– Digit timeout set to 3
– Executing [[email protected]:9] Set(“Zap/1-1”, “TIMEOUT(response)=10”) in new stack
– Response timeout set to 10
– Executing [[email protected]:10] BackGround(“Zap/1-1”, “custom/Default”) in new stack
– <Zap/1-1> Playing ‘custom/Default’ (language ‘en’)
== Spawn extension (ivr-2, s, 10) exited non-zero on ‘Zap/1-1’
– Executing [[email protected]:1] Hangup(“Zap/1-1”, “”) in new stack
== Spawn extension (ivr-2, h, 1) exited non-zero on ‘Zap/1-1’
– Hungup ‘Zap/1-1’

Here is my current zapata.conf:
[email protected]:/etc/asterisk $ cat zapata.conf
;
; Zapata telephony interface
;
; Configuration file

[trunkgroups]

[channels]
;answeronpolarityswitch=yes
usecallerid=yes
callerid=asreceived
;cidsignalling=bell
sendcalleridafter=3
hidecallerid=no
;callwaiting=yes
;usecallingpres=no
;callwaitingcallerid=yes
;threewaycalling=yes
;transfer=yes
;cancallforward=yes
;callreturn=yes
echocancel=yes
echocancelwhenbridged=no
echotraining=128
rxgain=0.0
txgain=0.0
group=0
callgroup=1
pickupgroup=1
immediate=no
;useincomingcalleridonzaptransfer=yes
;restrictcid=no
busydetect=yes
busycount=3

language=en
context=from-zaptel
signalling=fxo_ks
rxwink=300 ; Atlas seems to use long (250ms) winks
;
; Whether or not to do distinctive ring detection on FXO lines
;
;usedistinctiveringdetection=yes

;faxdetect=both
;faxdetect=incoming
;faxdetect=outgoing
faxdetect=no

;Include genzaptelconf configs
#include zapata-auto.conf

;Include AMP configs
#include zapata_additional.conf

You need to provide a bit more information for people to give you a exact reason. I’m going to Guess here. Realize that by default the config files are setup for US phone systems. So if you are NOT in the US you need to configure your system to the proper country, etc. UK is known to have issues for example. Ring detection voltages change, ring patterns change, etc. Also depending on your country and/or telco provider they might not be sending full caller ID info until after the second ring instead of the first, so changing the timing at which the phone system picks up the line (which will stop callid info from being sent after that point) will also impact the problem, increase the delay timing by 10 seconds.

If you are in a different country please search for tdm400 and callid issues (tdm800 is same card but has additional ports added so reads exact same config file settings). Also contact your telco provider to confirm exactly when the caller ID is tranmitted so that you can make adjust ments if needed.

Either way please post all the other zap*.conf config files so we can see if there is anything else that is not set properly.