Im trying to detect when a user hangs up within a PHP agi script (called using deadAGI) (Correct me if im wrong) I think I can achieve this by using the Event function in phpagi-asmanager.php and then defining an exception (that i can catch) in php. Im fairly new to both asterisk and PHP so any ideas or examples would be greatly appreciated.
you can have in the dialplan
exten => 1,1,deadAGI(dialplan.agi)
… [more extensions]
exten => h,1, [Action to take after hangup]
The ‘h’ extension can be used in the dialplan to be executed after the hangup.
So to summarize you need to have the h extension in the dialplan context that calls
the agi scipt.
You can then take the appropriate action using the extenson.
Hi, thanks for the reply. I hadnt thought of doing it that way, although (for the benifit of other people) I ended up using another php program to trap events from asterisk using the as-manager module and solved a few other problems along the way
How does one use the hangup extension within a given extension only.
exten => h,1, … is kind of generic and does not indicate which exten it can from.
exten => 101,1,Dial(SIP/101)
exten => h,1,Do something.
exten => 102,1,Dial(SIP/102)
exten => h,1,Do something else
How is the first h different from the second ?
too bad there isn’t a ‘h’ priority…
exten => 101,h,do_something
exten => 102,h,do_something_else
the only way i can see getting around this would be to set up individual contexts for each extension or group of extensions you would want to handle in the same way…not pretty, but it would work.