Execute survey module in h extension

Hi friends.
I have a survey module but I cant execute it correctly in h extension.
when i use the survey module like that and directly:


exten => survey,1,Noop()
exten => survey,n,Dial(local/1000@ext-queues,g)
exten => survey,n,agi(senarios/survey.php)

it works correctly.

but when i use it in h extension:

exten => 6000,1,Set(flag=0)
exten => 6000,n,AGI(exp.php)
exten => 6000,n,ExecIf($[“${flag}” = “1”]?Goto(ivr-3,s,1):Goto(ivr-2,s,1))
exten => 6000,n,Hangup()

exten => 6001,1,Noop()
exten => 6001,n,AGI(exp2.php)
exten => 6001,n,Hangup()

; Handle call hangup
exten => h,1,Noop(Call ended, executing post-call scripts)
exten => h,n,AGI(senarios/survey.php)
exten => h,n,AGI(senarios/sms.php)
exten => h,n,Hangup()

it dose not work.

based on the logs it execute:
– Executing [h@netyek:2] AGI(“SIP/TEST-IN-00000014”, “senarios/survey.php”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/senarios/survey.php
– <SIP/TEST-IN-00000014>AGI Script senarios/survey.php completed, returning 0

but actually after the call ended, the call hangs up immediatly and nothing gonna happen and the caller dosnt hear any thing and cant enter its point.

the sms agi executes correctly when caller has direct call to a operator but when the call follows to the queue, the sms agi dose not execute too.

what should i do?

This is a duplicate of My agi code dose not execute in h extension - Asterisk APIs - Asterisk Community which has a reply explaining the, obvious, reasons why this is not a meaningful thing to do.