asteriskagifastagi

How should AGI handle a HangupRequest


We recently upgraded our version of asterisk from version 1.4.26.1 -> 13.23.1. And of the changes that we noticed was that after the AMI has closed its connection it used to respond to the AGI with a "Hangup" and then closes the tcp connection. This behaviour appears to have changed and it now receives a "HangupRequest" and leaves the connection open. From the Asterisk logs it also appears to be constantly attempting to destroy the channel. Does a HangupRequest expect a specific response from the AGI in order for it to complete the hangup?

The workaround that we are currently using is to add Set(AGIEXITONHANGUP=yes) within the Dial plan this returns the behaviour to the way it used to perform a hangup whereas it feels like their should be a more graceful way of handing the hangup requests that does not need this setting within the dial plan.


Solution

  • The AMI receives a hangup request after asterisk has requested a hangup. https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ManagerEvent_HangupRequest In this case it was requesting the HANGUP of the AGI we found 2 possible ways to work around this. The first was to add Set(AGIEXITONHANGUP=yes) to the dialplan this means that when Asterisk receives a HANGUP it will close its connection to the AGI. The second was to make the AGI when it receives a HANGUP to cleanup its connections to Asterisk thus performing the hangup.