Basically you are building a Dialer and based on your requirements it must be “smart”. What you want to do is possible but you will need a deep understanding of asterisk and dialers. My two cents:
- Don´t use Elastix for that, you will end with a messed up configuration files and includes.
- Try to switch to asterisk 13 and take a deep deep look into ARI and Stasis.
If none of the above works for you and you decide to keep current version then try to achieve someting with the next logic:
Dialer trigger the call(send it to a local channel), evaluate the type of answer(human or machine, try to tune the AMD command), If it is a machine execute an AGI to retreive the channel(you have already the number so you can use core show channels from AMI or CLI to grep/get the channel), with the channel name pass the DTMF(try to inject it with playdtmf or chanspy as a workaround).
If it was a human then continue the flow as expected, in both cases you can send it to a QUEUE or to another channel. Take a look into the bridge command.
And also take a look into the Elastix´s Call center Dialer(/opt/elastix/dialer) that will help you to build yor dialer.