Summary:ASTERISK-13711: DeadAGI() in "h" extension
Reporter:Alistair Cunningham (acunningham)Labels:
Date Opened:2009-03-08 19:22:24Date Closed:2011-06-07 14:07:19
Versions:Frequency of
Description:The following worked correctly on and older:

exten => h, 1, DeadAGI(agi://

but on sometimes gives:

   -- Executing [h@from-external:1] DeadAGI("SIP/", "agi://") in new stack
[Mar  8 20:17:20] WARNING[19208]: res_agi.c:2158 deadagi_exec: Running DeadAGI on a live channel will cause problems, please use AGI

Changing to:

exten => h, 1, AGI(agi://

sometimes gives the converse warning about running AGI on a dead channel. Is Asterisk sometimes calling the DeadAGI before really hanging up the call?
Comments:By: Tilghman Lesher (tilghman) 2009-03-08 20:23:27

If Asterisk hangs up because the end of an extension list is reached, it won't cause an explicit hangup, though it goes to the "h" extension.  If you want to prevent this behavior, simply do an explicit Hangup() at the end of each extension logic.

By: Alistair Cunningham (acunningham) 2009-03-08 20:45:49

Is there a quick way to tell from "exten => h, 1" whether the call is still up? I can then call AGI or DeadAGI as appropriate.

By: Tilghman Lesher (tilghman) 2009-03-09 19:22:36

To my knowledge, there is no such method.  In 1.6, we've solved this by making AGI and DeadAGI detect the channel status and react accordingly.

By: Alistair Cunningham (acunningham) 2009-03-09 19:39:12

Is there any reason that this changed between and

By: Tilghman Lesher (tilghman) 2009-03-09 23:24:35

You are mistaken.  This behavior did not change between those versions.  The last time this behavior was changed was between 1.4.7 and 1.4.8, whereupon a warning was added to DeadAGI, when run on a live channel.  The converse, the warning of using AGI on a hungup channel, was added between 1.0.0-rc1 and 1.0.0-rc2.

By: Alistair Cunningham (acunningham) 2009-03-09 23:44:23

Looking deeper in the logs on a machine, you're right - it's happening there too.

Is it possible to have the update done that was done for 1.6 back-ported to 1.4? We are not able to guarantee that the call will have been hung up by other means before reaching the "h" extension as this is not always in our control. At present we're damned if we do use DeadAGI and damned if we don't.

By: Tilghman Lesher (tilghman) 2009-03-10 00:12:26

You're welcome to backport it yourself, but the 1.4 version will never receive that change -- it's a fairly significant update, which changes one aspect of how AGI has worked since the very first version; on the other hand, I believe it will correct one of the main issues with using AGI, that of AGI ceasing to interact upon a Hangup event, and an AGI thus far being unable to make the transition from a live channel to a dead channel without completely respawning the process.

By: Alistair Cunningham (acunningham) 2009-03-10 00:30:10

Thank you for your help.