Call hangup takes time

I wrote dialplan for my Asterisk system. The extension.conf is :

extensions.conf

[code][from-pstn]
exten =>s,1,Verbose(1, Caller ${CALLERID(all)} has entered the paf IVR)
same=>n,Answer()
same=>n,Wait(3)
same=>n,Playback(welcome)
same=>n,GoSub(post,ss,1)
same=>n,Playback(thanks)
same=>n,Hangup()

[post]
include => default_cont
exten => ss,1,Background(gud/post)
same=>n,WaitExten(5)
exten => 1,1,Set(CDR(aa)=136)
same=>n,Return()
exten => 2,1,Set(CDR(aa)=137)
same=>n,Return()

[default_cont]
exten => i,1,Playback(invalid)
same=> n,Hangup()
exten => t,1,Playback(timeout)
same=> n,Hangup()
exten => h,1,DeadAGI(convert_recordings.sh)
same=>n,DeadAGI(my_uploader.php,${var1},${CALLERID(num)},${CDR(var2)},${CDR(aa)})[/code]

When i call to my asterisk system. it takes time to hangup after playing thanks audio file. Actually, call hangup after all AGI execution are completed and my_uploader.php execution takes time. But i need instant hangup after playing thanks message. System only executes AGI files after the call is completely hangup. How can i solve this problem ?

What channel technology is this?

If analogue PSTN, are you sure that the delay is not the network’s called party CLEAR to network RELEASE delay. (Basically your requirement is impossible on analogue lines.)

If the device technology hangup is being delayed (you will need quite low level debugging to prove this) you will need to run your hangup processing in a detached sub-process of the script, or use originate to run it on a new call on a dummy local channel.

i use analog pstn. The call is terminated after my_uploader.php executed successfully but it takes time.
If i generate new call through the same channel, will previous call be terminated ?

That still sounds like the network release delay, e.g. see http://www.sinet.bt.com/sinet/SINs/pdf/351v4p6.pdf, section 7.1.2. Even if it is not starting a new call will not speed up the device shutdown process.