Asterisk Not Waiting for Answer, Continuing with Dialplan

I have recently installed and configured a Wildcard TDM400P with 2 FXS and 2 FXO modules. I am using Call files to connect to a dial plan. Previously I was using the call files to call a SIP soft phone. Everything worked fine. The dial plan would wait until I answered the soft phone and would then continue on with the dialplan.

After installing and configuring the card and modifying the call file to call an actual phone (I used my cell phone for testing), I received the call but it was already half way through the dialplan. I missed a few playbacks and backgrounds before I actually picked up my phone. Using the CLI, I can monitor what Asterisk is doing. When I used the SIP soft phone, Asterisk would wait until I answered the softphone, then proceed with the first application in the dial plan. But when I was calling to my cell phone, I could see the dial plan being executed before I ever answered the phone. If I don’t answer the phone the dial plan would continue until a timeout occurred.

How do I get Asterisk to wait until I answer a “hard” phone? I assume there is something missconfigured in one of the zaptel.conf or zapata.conf files.

Here is the call file with the actual phone number removed for privacy reasons:

Channel: ZAP/g2/18005551212

MaxRetries: 2
RetryTime: 20
WaitTime: 300

Context: lead_context
Extension: s
Priority: 1

CallerID: Asterisk Digium

SetVar: number=123456
SetVar: leadName=Danny
SetVar: leadPhone=900-555-1212
SetVar: leadMessage=I am interested in ...

Here is my zaptel.conf file:

# Configuration for FXS channel: connects to phone

# Configuration for FXO channel: connects to PSTN

loadzone = us

Here is my zapata.conf file:


;; Configuration Supplied from Digium

channel => 1-2

channel=> 4

channel=> 3

Please help.

Any help will be much appreciated.


This problem with digium card when befall that you want connect POTS line(Plain Old Telephone System) to digium card such as TDM400 ,explain this problem in voip-info at … o-dial+out
" If you are using POTS (Plain Old Telephone System) lines attached to a channel bank with FXO cards …"

but my solutions :

1-you can use a sip gateway ( such as cisco routers) and send your calls from asterisk to sip gateway by SIP protocol and cisco router send your call to PSTN network. ASTERISK <====>SIP gateway <====> PSTN

2- if you dont have SIP gateway , you can use NVlinedetect application code for this problem :


After tearing my hair out for several weeks, I ran into the same issue, finally posting for some help (which never came - See the post “Transfer on Dial Answer, Not on Dial Connect”). I was under the mistaken impression that I was doing something wrong.

I know, I know, I need to stop whining and change the code myself if I don’t like it. And “what do you expect for free?” But short of that, it is quite surprising that anyone would find the system behavior of Asterisk described in this post as anywhere near acceptable. The current code base renders a large class of applications useless.

The bottom line is that Asterisk sports a built-in race condition which makes dial plans practically useless when using POTS lines. What it does is it answers the call immediately rather than when the call is actually answered by someone. This is very strange and bad behavior for which there is no practical solution (other than the ones posted here, which are appreciated, but are impractical for my use).

Is anyone working of fixing this anytime soon?


i think it’s generally accepted that Zaptel is “less than it should be” … (oh, so i can be polite :smiley:)

saw this recently too … … will be watching with interest.

There are 1 thing called REVERCEPOLARITY.
When you are using SIP or whatever else phone, Asterisk can perfectly well to distinguish offhook/onhook states.
When you are using Zaptel - then Asterisk needs some mechanism to understand when other party open line.
There are basicly two meckanisms - one of them is Reverse polarity. But it depends from provider. If your provider supports reverse polarity - you can add lines:
in your zapata.conf - before descripton of channels and groups.


When you try to call through Zap channel - asterisk assumes answer when hardware is accepting call.
If your provider supports reverse polarity and if you will add those lines, then asterisk will start assume begining of call only when other party will answer. There are no go around of this problem.
And this is not a problem only for Asterisk - all apllications and products which are using PSTN are dependant on reverse polarity or some simmilar mechanism, which is in hands of PSTN provider

i m using a ATA gateway,which has one fxo and one fxs. when i have a call to fxo,the fxo will answer immediately.but i have a PSTN line connect with fxo.the pstn number will not be sent. but if you make the fxo answers and wait for a mement,then extensions number.that will be ok!

Can someone send me the NVLineDetect code (