How to detect call pick up over DAHDI channels

I have to create a dial plan for dialing several numbers over DAHDI and play a recorded file for them using call files.
The problem is that as soon as DAHDI dials the last digit, the dialplan continues and the playback stars although no one has picked up the call and it is still ringing. Is there a solution for this problem?
I’m using Sangome analog card with asterisk 11 and DAHDI 2.6

This should work for all but analogue.

For analogue, make sure that your PSTN operator provides line reversal answer supervision, then enable it in your configuration. (Look for polarity.) If they don’t, the call will never complete if you enable it on the Asterisk side.

Does this problem exist with E1 links too?

It doesn’t exist for ISDN over E1. I wouldn’t expect it to exist for channel associated signalling, but so few people use that it my be difficult to say.