|Summary:||ASTERISK-09887: rev71656 and rev71065 makes DeadAGI exit after channel hangup|
|Reporter:||Yunlong Liu (lyl)||Labels:|
|Date Opened:||2007-07-17 03:39:23||Date Closed:||2011-06-07 14:02:41|
|Description:|| for Issue 10035, the developer fixed the "silly usages of ast_playstream()", but another problem comes, there's no DeadAGI alive after the channels hangup.|
the newest code follows: (handle_exec in res_agi.c)
return res >= 0 ? RESULT_SUCCESS : RESULT_FAILURE;
but when the channel hangs up, the res is -1, and then return 2(RESULT_FAILURE), and, the result is the DeadAGI also dead.
the solution is, I think, return best cause just in ast_playstream, but not in the caller code, it's not the duty of the caller to identify what's happening in the calling code.
And, for issue 10035, maybe DeadAGI can solve the problem.
****** ADDITIONAL INFORMATION ******
It seems apply to all version, through 1.2 to trunk
|Comments:||By: Tilghman Lesher (tilghman) 2007-07-17 07:46:25|
I don't see the problem. You're not supposed to be able to play a stream to a hungup channel. Could you explain what you're trying to do, not try to explain why you think the code is wrong?
By: Yunlong Liu (lyl) 2007-07-17 19:38:53
I have one agi like the follows
my $agi = new Asterisk::AGI;
the "after dial" is never executed if the other side answered.
By: Tilghman Lesher (tilghman) 2007-07-17 19:52:10
Yeah, but that has never worked. If you want to do something post-hangup, you need to create a DeadAGI script to be run in the 'h' extension.
By: Yunlong Liu (lyl) 2007-07-17 22:11:54
Actually, The script is running stable in an v1.2.15 box, and when I replace "return res >= 0 ? RESULT_SUCCESS : RESULT_FAILURE" with "return res", the script works.
By: Donny Kavanagh (donnyk) 2007-07-17 23:45:04
DeadAGI was *NEVER* intended to run on a live channel and then migrate to one that is dead. The reason it works at all is rather unintended. However i do realize that it has acted this way for sometime.
However, you must realize that once the channel in asterisk is hung up, the agi application terminates and asterisk returns control to the dialplan, the problem was DeadAGI was never intended to detect a hangup and thus when it was run on a line that had an actual call, once the line was hungup it did not return control to the asterisk dialplan until the application was terminated (the agi script ended).
All this being said, using perl you can ignore the instruction from asterisk to terminate your agi script (SIGHUP) you will have no further communication with asterisk but you can clean up gracefully.
All that said it is possible to have a script continue after a dial terminates, but only if the far end hangs up, and you pass the g option into your dial, it is possible to continue processing. Obviously if the dialing channel hangs up the call, the channel is done and dialplan processing goes to the h context.
I would really suggest that you consider an alternative method because this functionality is no longer going to work. I would respectfully suggest you use an asterisk channel variable to keep a state, and once the AGI terminates you can rerun the same agi as a deadagi and it will know where you left off, or the proper way to clean up, etc.
By: Yunlong Liu (lyl) 2007-07-18 01:10:34
oh, I see.
thanx to juggie, and Corydon76