[asterisk-bugs] [Asterisk 0012172]: redirect through AMI not working reliable in 1.4
noreply at bugs.digium.com
noreply at bugs.digium.com
Fri Apr 11 16:30:32 CDT 2008
The following issue has been ASSIGNED.
======================================================================
http://bugs.digium.com/view.php?id=12172
======================================================================
Reported By: mneuhauser
Assigned To: qwell
======================================================================
Project: Asterisk
Issue ID: 12172
Category: Core/PBX
Reproducibility: sometimes
Severity: minor
Priority: normal
Status: assigned
Asterisk Version: 1.4.19
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Disclaimer on File?: N/A
Request Review:
======================================================================
Date Submitted: 03-09-2008 11:21 CDT
Last Modified: 04-11-2008 16:30 CDT
======================================================================
Summary: redirect through AMI not working reliable in 1.4
Description:
I'm developing an AMI application
that dispatches calls with redirect while they wait in the dialplan,
something like this (in AEL syntax):
UserEvent(DispatchMe);
Wait(5);
Log(ERROR|AMI did not dispatch call);
// fallback to dialplan-only based call routing
When doing an automated redirect over AMI (triggered by the UserEvent),
then the call is sometimes hung up:
DEBUG[17160]: pbx.c:1831 pbx_extension_helper: Launching 'UserEvent'
DEBUG[17117]: manager.c:2107 process_message: Manager received command
'Redirect'
DEBUG[17117]: channel.c:1378 ast_softhangup_nolock: Soft-Hanging up
channel 'SIP/10.0.0.30-008b0570'
DEBUG[17160]: pbx.c:2454 __ast_pbx_run: Extension park-call, priority 0
returned normally even though call was hung up
DEBUG[17160]: channel.c:1378 ast_softhangup_nolock: Soft-Hanging up
channel 'SIP/10.0.0.30-008b0570'
DEBUG[17160]: channel.c:1477 ast_hangup: Hanging up channel
'SIP/10.0.0.30-008b0570'
The redirect works reliable (without hang ups) when the AMI application
performs the redirect delayed by 100 ms and not right after the user event
is received (parameters like logging level, system load etc. were kept
constant).
Looking at __ast_pbx_run() one can see that the AST_SOFTHANGUP_ASYNCGOTO
case is only handled if the spawned application returned non-zero. In the
other case, i.e., when zero is returned, any different _softhangup value
than AST_SOFTHANGUP_TIMEOUT leads to a hangup of the channel:
if ((res = ast_spawn_extension(...) {
...
if (c->_softhangup == AST_SOFTHANGUP_ASYNCGOTO) {
c->_softhangup =0;
} else ...
}
/* *** no check for AST_SOFTHANGUP_ASYNCGOTO *** */
if (c->_softhangup == AST_SOFTHANGUP_TIMEOUT ...) {
} else if (c->_softhangup) {
ast_log(LOG_DEBUG...returned normally even though call was hung
up").
error = 1;
This explains why delaying the redirect makes my application work: then
the Wait() application in my dialplan is always running and return a
non-zero value. While without the delay, there is a race between my AMI
application and Asterisk and the other code branch could be taken.
======================================================================
----------------------------------------------------------------------
svnbot - 04-11-08 16:30
----------------------------------------------------------------------
Repository: asterisk
Revision: 114072
U branches/1.4/main/pbx.c
------------------------------------------------------------------------
r114072 | qwell | 2008-04-11 16:30:28 -0500 (Fri, 11 Apr 2008) | 4 lines
It's possible that a channel can have an async goto on the successful
execution of an application as well.
Closes issue http://bugs.digium.com/view.php?id=12172.
------------------------------------------------------------------------
http://svn.digium.com/view/asterisk?view=rev&revision=114072
Issue History
Date Modified Username Field Change
======================================================================
04-11-08 16:30 svnbot Note Added: 0085379
04-11-08 16:30 svnbot Status new => assigned
04-11-08 16:30 svnbot Assigned To => qwell
======================================================================
More information about the asterisk-bugs
mailing list