Summary:ASTERISK-25307: Hangup on channel using FastAGI does not hang up child channels
Reporter:David Cunningham (dcunningham)Labels:
Date Opened:2015-08-06 23:51:53Date Closed:2016-09-23 14:22:26
Versions:11.4.0 Frequency of
Environment:CentOS 6.6, 64 bitAttachments:( 0) hangup1.txt.gz
( 1) jira_asterisk_25307_v11_test.patch
Description:We have the following scenario:

1. Call comes in to [from-internal] context in Asterisk, FastAGI is called.
2. While AGI is processing call the caller hangs up. In Asterisk trace we see the CANCEL and a HANGUP received on the channel.
3. AGI implements a hunt group by doing Dial() on multiple Local channels, one for each destination.
4. Asterisk calls FastAGI for each hunt group destination.
5. AGI for each destination does a Dial() to a SIP destination to call telephone.
6. Telephones all ring.
7. When one telephone answers it's call immediately drops, and the other telephones stop ringing.

Our question is why the Dial() at step 3, or even at step 5, does not immediately exit (presumably with a DIALSTATUS of CANCEL).

We do try to detect the hangup within the AGI and exit before doing the Dial(), but however close we get it there's always a chance of a CANCEL being received between our check and the Dial(). But why does the Dial() run instead of immediately exiting?

Thank you.
Comments:By: Asterisk Team (asteriskteam) 2015-08-06 23:51:53.968-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: David Cunningham (dcunningham) 2015-08-06 23:52:35.606-0500

Trace is attached. You can see the CANCEL at line 1020 and the Dial() to the local channels at line 1118.

By: Rusty Newton (rnewton) 2015-08-07 09:29:57.795-0500

Thanks. You don't have to compress traces. It is actually easier if they are simply attached as .txt so that we can view them in the browser without downloading.

By: David Cunningham (dcunningham) 2015-09-08 07:31:24.355-0500

Noted about the compression.

Would you have an estimate as to when this will be looked at? Thanks.

By: Joshua C. Colp (jcolp) 2015-09-08 07:42:01.557-0500

There is no estimate, but it would likely be in the future as we do not yet have a time travel module.

By: Rusty Newton (rnewton) 2015-09-08 09:12:28.869-0500

I should be able to look into this more today from a triage perspective at least.

By: David Cunningham (dcunningham) 2015-09-08 18:36:40.106-0500

Thank you Rusty.

If the future Digium with time travel could bring it back to now, that would be very helpful.

By: Rusty Newton (rnewton) 2015-09-08 19:36:00.941-0500

"should" - I got derailed into other things. I'll do my best to look at this tomorrow David. Thanks.

I'm pretty sure competing projects send back the other issue reporters from the future to side-track me. Just a hunch though.

By: Richard Mudgett (rmudgett) 2015-09-09 17:17:42.154-0500

Looks like app_dial needs to check if the channel is hung up before doing anything.

In the log what seems to be happening is the AGI sends the "EXEC Dial" command after the calling channel has hung up.  Dial then proceeds to dial the requested channel on behalf of a hung up channel.  Since the AGI EXEC command is allowed to be executed in DeadAGI mode the dial application needs to prevent use when the channel has hung up.  It makes no sense for Dial to be executed in the "h" exten which is effectively what is happening in DeadAGI mode.

By: Rusty Newton (rnewton) 2015-09-10 16:48:52.819-0500

Opening this based on Richard's analysis above.

By: David Cunningham (dcunningham) 2015-10-21 06:04:07.533-0500

Any news on this please? Being heavy users of AGI it affects us quite a bit. Thank you.

By: David Cunningham (dcunningham) 2015-11-11 18:30:35.961-0600

Since Asterisk 1.8 is now out of support will there ever be a fix for this? Thanks.

By: David Cunningham (dcunningham) 2015-11-13 15:53:54.803-0600

Our client reports the same problem on Asterisk 11.

By: dovid (dovid) 2015-12-04 11:24:30.361-0600


By: Richard Mudgett (rmudgett) 2015-12-04 17:53:11.241-0600

[^jira_asterisk_25307_v11_test.patch] - This patch adds a caller hungup check early in app_dial to abort dialing.  The patch is against the latest v11 branch.

Please test to see if this fixes the reported problem.  You can search the logs for the error message {{BUGBUG Caller hung up before dial.}} to know if the patch aborted a call because the caller hung up before the Dial application executed.

By: dovid (dovid) 2015-12-07 08:41:31.583-0600

Based on the current patch I created one for 1.8 (which we are on) and it looks like it is doing the trick. I will test against 11 shortly.