Dial plan settings in Asterisk

I send an outgoing call to a SIP extension (xlite softphone), I use the agi and cepstral for the text to speech delivered to the receiver. I could call to the extension and deliver the message. But the message starts playing before i pick the call.

Once i pick the call only then the message should start playing. I know its a small bit of change in the extensions.conf file dial plan. Here is my dialplan context which i use:

[color=green][dialout]
exten => outbound,1,Answer ; switches to outbound-handler
exten => outbound,2,Wait(20)
exten => outbound,3,AGI(agi://10.7.1.67/ivr/speak) ; text to speech url which uses agi
exten => outbound,4,Hangup

exten => outbound-handler,1,Dial(SIP/${CallInitiate_phonenumber})[/color]

This is the output i get in the asterisk cli prompt after estalishing the call:

[color=green]Attempting call on Local/outbound@dialout for outbound-handler@dialout:1 (Retry 1)
– Executing [outbound@dialout:1] Answer(“Local/outbound@dialout-a45b,2”, “”) in new stack
– Executing [outbound-handler@dialout:1] Dial(“Local/outbound@dialout-a45b,1”, “SIP/102”) in new stack
– Executing [outbound@dialout:2] Wait(“Local/outbound@dialout-a45b,2”, “10”) in new stack
– Called 102
– SIP/102-090401e0 is ringing
– Executing [outbound@dialout:3] AGI(“Local/outbound@dialout-a45b,2”, “agi://10.7.1.67/ivr/speak”) in new stack
– AGI Script Executing Application: (AGI) Options: (swift.agi|Hi Becker, This is a reminder on your appointment with Dr. John on wednesday 23rd of August, Please PRESS 1 to confirm your appointment, If you want to have this appointment rescheduled PRESS 2)
– Launched AGI Script /var/lib/asterisk/agi-bin/swift.agi
/var/lib/asterisk/agi-bin/swift.agi: eval: line 10: unexpected EOF while looking for matching `"’
/var/lib/asterisk/agi-bin/swift.agi: eval: line 11: syntax error: unexpected end of file
– Playing ‘/tmp/1187682994.116’ (escape_digits=#) (sample_offset 0)
– AGI Script swift.agi completed, returning 0
– <Local/outbound@dialout-a45b,2> Playing ‘beep’ (language ‘en’)
– AGI Script agi://10.7.1.67/ivr/speak completed, returning 0
– Executing [outbound@dialout:4] Hangup(“Local/outbound@dialout-a45b,2”, “”) in new stack
== Spawn extension (dialout, outbound, 4) exited non-zero on ‘Local/outbound@dialout-a45b,2’
== Spawn extension (dialout, outbound-handler, 1) exited non-zero on ‘Local/outbound@dialout-a45b,1’
[Aug 21 13:27:09] NOTICE[4620]: pbx_spool.c:351 attempt_thread: Call completed to Local/outbound@dialout
[/color]

The line “exten => outbound,3,AGI(agi://10.7.1.67/ivr/speak)” is the place where the text to speech url is called.

Kindly do let me know what can i use in the dialplan, so that the outbound priority 3 is called after i answer the call in the xlite softphone.

Thanks.