Asterisk IVR After Hangup

4.6k Views Asked by At

I want to redirect caller to an IVR after dialed number's hangup. I made research and found something called deadAGI but I couldn't make it work. You can find my extensions_custom.conf file below.

[from-internal-custom]
exten => 80,1,AGI(custom/agi.php)
exten => 80,2,MixMonitor(${FILE}.WAV)
exten => 80,3,Dial(SIP/custom/${NUMBER})
exten => 80,4,Hangup()
exten => h,1,deadAGI(custom/finish)

My AGI files are correct, I'm sure that. I just need to run after hangup command correctly.

Thanks in advance.

1

There are 1 best solutions below

1
On

The "core show application Dial" states:

    g: Proceed with dialplan execution at the next priority in the current
extension if the destination channel hangs up.

So change your code to:

[from-internal-custom]
exten => 80,1,AGI(custom/agi.php)
exten => 80,2,MixMonitor(${FILE}.WAV)
exten => 80,3,Dial(SIP/custom/${NUMBER},,g)
exten => 80,4,deadAGI(custom/finish)
exten => 80,5,Hangup()

If you want to run your script no metter the caller or callee hangs up:

e: Execute the 'h' extension for peer after the call ends

So:

[from-internal-custom]
exten => 80,1,AGI(custom/agi.php)
exten => 80,2,MixMonitor(${FILE}.WAV)
exten => 80,3,Dial(SIP/custom/${NUMBER},,ge)
exten => 80,4,deadAGI(custom/finish)
exten => 80,5,Hangup()
exten => h,1,deadAGI(custom/finish)

Your idea was almost OK. 'h' is an extension, not a priority.