Dial outbound, then extension before executing AGI

I am developing an application using RAGI (Ruby/AGI) and Asterisk that dials number XXX-XXX-XXXX, then plays a custom sound file (and offers a few other options like replay, etc.) The app works presently as described, but I have a new requirement that, in some cases, the application must support dialing a XXX-XXX-XXXX, waiting for answer, then dialing an known extension XXX before executing the AGI that plays the sound file(s) and does the other stuff.

I imagine this is something that is going to need to happen in the dialplan rather than in via AGI, so following is the current relevant code from my extensions.conf:


exten => outbound-handler,1,Dial(SIP/${CallInitiate_phonenumber}@telx-outbound|50|gM(outbound-connect^${AGI_SERVER}${AGI_URL}^${CallInitiate_hashdata}^${MACHINE_STATUS_UNKNOWN}))
exten => outbound-handler,2,GotoIf($["${DIALSTATUS}" = "ANSWER"]?104)
exten => outbound-handler,3,NoOp(status=${DIALSTATUS}, DIALEDTIME=${DIALEDTIME},
exten => outbound-handler,4,SetVar(CallInitiate_hashdata=${CallInitiate_hashdata})
exten => outbound-handler,5,deadagi(agi://${AGI_SERVER}${AGI_URL}) ;DIAL_STATUS is busy, etc.
exten => outbound-handler,6,Goto(104)
exten => outbound-handler,102,SetVar(CallInitiate_hashdata=${CallInitiate_hashdata})
exten => outbound-handler,103,deadagi(agi://${AGI_SERVER}${AGI_URL}) ;DIAL_STATUS is busy, etc.
exten => outbound-handler,104,Hangup()

Calls are being initiated via .call files, if that is important to know.

I would greatly appreciate any advice folks can offer on how to do this. This seems like it should be simple, but I am a Asterisk Noob, and I have hit a wall with this one. :-/

Thanks in advance.