Agi - hangup

Hello!
I’m using ASTERISK AGI to perform an ivr.
How can i catch the event HANGUP?
I want to say when the caller disconnect.
I try to use

$agi->get_variable('DIALSTATUS');

but don’t work.
I don’t say what the function return

Thanks!

Hi!
Do you try to process some actions before really hangup when one way of a bridged call did hangup? Can you try the “h” extension to check whether it meets your requirement
exten => h,1,…
Your sincerely!
Duc Viet To Ho

I must use agi script to notify the hangup event, i can’t write instruction into the extension.conf or extension_costum.conf.
My question is: exsist an agi istruction that notify the hangup event?

Thanks…

Hi
you can use the events “agent complete” or “unlink”