[Solved] Zap channels. group and missing lines

I have 1 TDM400P with 4 FXS? (not sure) - red small pcbs.
To two of this there are PSTN lines.
I made in zaptel.conf:
loadzone=us
fxsks=1-4
defaultzone=us

and in zapata.conf:

busydetect=yes
busycount=2
answeronpolarityswitch=yes
hanguponpolarityswitch=yes
cidstart=ring
cidsignalling=bell
signalling=fxs_ks
milliseconds
callerid=asreceived
group=1
context=default ; Points to the default context of your extensions.conf
channel => 1-4 ; Again X is the number of FXO modules you have
amaflags=billing

To 2 and 4 there are PSTN lines.
I would like to call group in extensions.conf
exten => 601,1,Dial(ZAP/g1/8221819);
exten => 601,2,Hangup

And if some of lines are dead or missing - then next line to get dialing.
Unfortunatelly some times ago, with Asterisk from CVS (29.07.05) I changed something in one C or may be H file.
But now Asterisk 1.21 has no zapata group of files - lot of staf has been chaged and I can’t remember what I did, neither I am sure where it will work again.
Any sugestions are wellcome.
And I will be charged with couple of beers for every response :smile:)
Unfrotunatelly I am living in Bulgaria - I can pay you if you will come here :smile:))

Solution:
in file /asterisk/channels/chan_zap.c
we must uncomment #define ZAP_CHECK_HOOKSTATE
/*! \note

  • Define if you want to check the hook state for an FXO (FXS signalled) interface
  • before dialing on it. Certain FXO interfaces always think they’re out of
  • service with this method however.
    */
    #define ZAP_CHECK_HOOKSTATE