jfernandz / pyst2

A fork of the famous python pyst library for Asterisk.
139 stars 105 forks source link

Catch Hangup Events #56

Open tgwaste opened 3 years ago

tgwaste commented 3 years ago

So this project is great and it all makes sense but is there any way I could get an example of how to catch hangup events? I don't quite understand how that would work. When the caller hangs up I need to do a few things before returning to the Dial Plan.

hazard595 commented 3 years ago

Except these two exceptions AGIAppError, AGISIGHUPHangup. Also make sure you set AGISIGUP=no as follows before calling your AGI script from asterisk or else asterisk will kill your script abruptly on hangup.

exten => 123,1,Log(NOTICE, Executing script)
same => n,Set(AGISIGHUP=no)
same => n,AGI(/path/to/agi_script.py)