Summary:ASTERISK-08212: The channel is not hanged up in the right time
Reporter:Gaspar Zoltan (gasparz)Labels:
Date Opened:2006-11-29 07:39:26.000-0600Date Closed:2011-06-07 14:07:26
Versions:Frequency of
Description:I have a complex agi script. I call this script using DeadAGI.

The script dials a sip user. Everithing fine. After the call I make a 30 seconds sleep in the program, and then some wrap up instructions. All instructions are executed correctly but:

Case 1:
The call is hanged up by the calling party. Bouth his channel and the called channel are hung up, exactly when the calling party hungs up. This is the expected behaviour.

CR -> A bye
A-> CR 200 ok
No delay
A -> CD bye
CD -> 200 ok

Case 2:
The call is hanged up by the called party: His channel is hung up imediatly. The calling party remains in dead air for the time of the sleep (30 seconds) and only after this time his channel is hunged up. I even put an explicit hungup instruction before the sleep and it didn't help.

CD -> A bye
A-> CD 200 ok
30 seconds
A -> CR bye
CR -> 200 ok

When looking at the sip log, it gave me a correct callflow, except that the BYE message that the asterisk sends out is delayed with the sleep time. Incorrect and unexpected behavoir.

CR - caller party
CD - called party
A  - asterisk

Comments:By: Russell Bryant (russell) 2006-11-29 09:41:07.000-0600

Why are you using DeadAGI for a regular AGI script?  That is not the proper thing to do.  You should only use DeadAGI for running an AGI script on a "dead" channel, that is, after the called channel is hung up.

Try using AGI() and see if you still have this issue.

If the reason you were trying to use DeadAGI is that you didn't want the script to get killed when the call hangs up, then, the proper way to do that is to add a signal handler for SIGHUP in your script.

By: Gaspar Zoltan (gasparz) 2006-11-29 11:02:35.000-0600

Yes the reason why I am using DeadAgi is to be able to handle the hangup event too, so that my script is not killed when the conversation is hanged up, so that I can do a wrap-up in the same script.

As far as I know DeadAgi is exactly for this, so that users don't have to use AGI and SIGHUP handeling.

But either way, the problem is that the AGI implementation doesn't work the same for deadagi and hangup calls. It depeands whow hangs up: the caller or the called. I don't think this is acceptable.

By: Russell Bryant (russell) 2006-11-30 09:00:01.000-0600

If you do a  "show application DeadAGI", the synopsis says "Executes AGI on a hungup channel".  DeadAGI is *not* so you don't have to handle SIGHUP when the channel hangs up.  DeadAGI is not intended to be used on a channel that is still up.

Please switch to using AGI, add a SIGHUP handler if you need to perform some cleanup steps, and then see if you still have a problem.

Just so it is noted here, in Asterisk 1.4, we added the ability to turn off SIGHUP when you're using AGI.

By: Tilghman Lesher (tilghman) 2006-12-11 00:20:53.000-0600

No followup from reporter.  Issue resolved.