Dial plan for making outgoing call

I have asterisk integrated with RAGI for making outgoing call, which works fine. But i have few constraints in the dial plan.

Below given is my extensions.conf file context where my dialplan works:

[color=brown]exten => outbound,1,Answer ; switches to outbound-handler
exten => outbound,2,Wait(10)
exten => outbound,3,AGI(agi://
exten => outbound,4,Hangup

exten => outbound-handler,1,Dial(SIP/${CallInitiate_phonenumber})
exten => outbound-handler,2,GotoIf($["${DIALSTATUS}" = “ANSWER”]?104)
exten => outbound-handler,4,SetVar(CallInitiate_hashdata=${CallInitiate_hashdata})
exten => outbound-handler,5,AGI(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,AGI(agi://
exten => outbound-handler,105,Hangup() [/color]

Once the call is placed, i get the following in my cli prompt:

[color=blue]*CLI> – Attempting call on Local/outbound@dialout for outbound-handler@dialout:1 (Retry 1)
– Executing [outbound@dialout:1] Answer(“Local/outbound@dialout-50d5,2”, “”) in new stack
– Executing [outbound@dialout:2] Wait(“Local/outbound@dialout-50d5,2”, “10”) in new stack
– Executing [outbound-handler@dialout:1] Dial(“Local/outbound@dialout-50d5,1”, “SIP/102”) in new stack
– Called 102
– SIP/102-097ea6d8 is ringing
– Executing [outbound@dialout:3] AGI(“Local/outbound@dialout-50d5,2”, “agi://”) 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/1187611622.281’ (escape_digits=#) (sample_offset 0)
– SIP/102-097ea6d8 answered Local/outbound@dialout-50d5,1

[Aug 20 17:37:14] WARNING[28614]: file.c:1078 waitstream_core: Unexpected control subclass ‘-1’

[color=blue] – AGI Script swift.agi completed, returning 0
– <Local/outbound@dialout-50d5,2> Playing ‘beep’ (language ‘en’)
– AGI Script agi:// completed, returning 0
– Executing [outbound@dialout:4] Hangup(“Local/outbound@dialout-50d5,2”, “”) in new stack
== Spawn extension (dialout, outbound, 4) exited non-zero on ‘Local/outbound@dialout-50d5,2’
== Spawn extension (dialout, outbound-handler, 1) exited non-zero on ‘Local/outbound@dialout-50d5,1’
[Aug 20 17:37:36] NOTICE[28613]: pbx_spool.c:351 attempt_thread: Call completed to Local/outbound@dialout[/color][/color]

I dont have any problem if i pick up the call immediately, I get the complete text to speech delivered to me. But if i pick the call after 4 or 5 rings, then i don’t get the complete text to speech delivered, the initial 5 secs of speech is cut and delivered.

I think this is some small manipulation with the extensions.conf dial plan. Please suggest a way to get rid of my problem. Thanks.