Deniz B.
Deniz B.

Reputation: 2562

Asterisk IVR After Hangup

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.

Upvotes: 3

Views: 4701

Answers (1)

viktike
viktike

Reputation: 733

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.

Upvotes: 4

Related Questions