Cannot tell when other end is picked up on dialout

hello all,
i am using asterisk with a tdm400
i have a python script that runs from agi that places a phone call when a drop file is delivered to /var/spool/asterisk/outgoing

the problem is that when the script begins to run, it does not wait until the receiver is picked up to start playing the message. Now, i have experimented with wait, and sleep ( in the actual python script) but how long it takes someone to answer to kinda ambiquious.

is there a setting in my asterisk.conf, or extensions.conf that will allow me to wait to run the script until someone ( or an answering machine ) picks up the receiver or answers?

even an agi command that i could use from within python would be good.

thanks