Call hangup takes time

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


exten =>s,1,Verbose(1, Caller ${CALLERID(all)} has entered the paf IVR)

include => default_cont
exten => ss,1,Background(gud/post)
exten => 1,1,Set(CDR(aa)=136)
exten => 2,1,Set(CDR(aa)=137)

exten => i,1,Playback(invalid)
same=> n,Hangup()
exten => t,1,Playback(timeout)
same=> n,Hangup()
exten => h,1,DeadAGI(

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, section 7.1.2. Even if it is not starting a new call will not speed up the device shutdown process.