How can outbound call to post dial extension wait for onAnswer?

I want to automatically call a user who is behind an extension.  This is easy enough to do with a post dial:


The problem is that I now need to wait until the party (or their voice mail) answers the call that is technically being transferred via the 3rd party system I just called.  

I want to add:

$tropo->say("Here is the automated message you requested...");

but, this event is triggered as soon as the 3rd party system answers the initial call (while I'm still pausing to enter my post-dial values.)

I can add a wait() function that blocks the say() event from happening for several seconds while the call is being forwarded but that has unpredictable results. If the party picks up quickly, they have silence until the wait() finishes.  If they let it ring to long, the wait() finishes, the say() begins and they miss most of the message.

Is there any way to detect that a call has been answered a second time?


Please sign in to leave a comment.