[asterisk-bugs] [Asterisk 0014940]: Background application executed in post-Dial Application Macro terminates call

Asterisk Bug Tracker noreply at bugs.digium.com
Mon Jan 4 12:30:37 CST 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=14940 
====================================================================== 
Reported By:                p_lindheimer
Assigned To:                tilghman
====================================================================== 
Project:                    Asterisk
Issue ID:                   14940
Category:                   Applications/General
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     closed
Asterisk Version:           1.4.24 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!): 177786 
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             2009-04-20 11:37 CDT
Last Modified:              2010-01-04 12:30 CST
====================================================================== 
Summary:                    Background application executed in post-Dial
Application Macro terminates call
Description: 
Note: I have not had access to a system to further isolate and run some
further tests yet but am providing some details of this issue as requested
on #asterisk-bugs channel. As a result, I can not conclusively say if this
is reproducible on a regular basis or if there are specific circumstances
that must be presented to create the problem.

This dialplan is from FreePBX 2.5 base.

This issue appears to have started at about Asterisk 1.4.24 where it was
first reported on the following two thread and then observed on a
customer's system who was running SVN r177786:

http://freepbx.org/forum/freepbx/users/call-confirmation-fails-after-asterisk-1-4-24-upgrade
http://freepbx.org/forum/freepbx/users/confirm-calls-hang-up

The crux of the issue is that macro-confirm is executed as a post dial
macro in a dialplan that would look something as follows:

Dial(Local/7365924 at from-internal/n,30,M(confirm^^^222)tTwWr))

The macro-confirm code is as follows:

[macro-confirm]
include => macro-confirm-custom
exten => s,1,Set(LOOPCOUNT=0)
exten => s,n,Set(__MACRO_RESULT=ABORT)
exten => s,n,Set(MSG1=${IF($["foo${ARG1}" !=
"foo"]?${ARG1}:"incoming-call-1-accept-2-decline")})
exten =>
s,n(start),Background(${MSG1},m,${CHANNEL(language)},macro-confirm)
exten => s,n,Read(INPUT,,1,,,4)
exten => s,n,GotoIf($[${LEN(${INPUT})} > 0]?${INPUT},1:t,1)
exten => 1,1,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" =
"0"]?toolate,1)
exten => 1,n,dbDel(RG/${ARG3}/${UNIQCHAN})
exten => 1,n,dbDel(${BLKVM_OVERRIDE})
exten => 1,n,Set(__MACRO_RESULT=)
exten => 1,n(exitopt1),MacroExit()
exten => 2,1,Goto(noanswer,1)
exten => 3,1,SayDigits(${CALLCONFIRMCID})
exten => 3,n,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" =
"0"]?toolate,1:s,start)
exten => t,1,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" =
"0"]?toolate,1)
exten => t,n,Set(LOOPCOUNT=$[ ${LOOPCOUNT} + 1 ])
exten => t,n,GotoIf($[ ${LOOPCOUNT} < 5 ]?s,start:noanswer,1)
exten => _X,1,Background(invalid,m,${CHANNEL(language)},macro-confirm)
exten => _X,n,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" =
"0"]?toolate,1)
exten => _X,n,Set(LOOPCOUNT=$[ ${LOOPCOUNT} + 1 ])
exten => _X,n,GotoIf($[ ${LOOPCOUNT} < 5 ]?s,start:noanswer,1)
exten => noanswer,1,Set(__MACRO_RESULT=ABORT)
exten => noanswer,n(exitnoanswer),MacroExit()
exten => toolate,1,Set(MSG2=${IF($["foo${ARG2}" !=
"foo"]?${ARG2}:"incoming-call-no-longer-avail")})
exten => toolate,n,Playback(${MSG2})
exten => toolate,n,Set(__MACRO_RESULT=ABORT)
exten => toolate,n(exittoolate),MacroExit()
exten => h,1,Macro(hangupcall,)

If the user presses a DTMF digit while the message is playing (typically
"1" to confirm and accept the call) then the call is failing with a log
file entry as shown below.

If they allow the message to play to completion, thus allowing the
dialplan to progress to the subsequent Read() application, then the
dialplan works as expected.

In one reported instance the log file reported the following:

[Apr 2 21:30:21] WARNING[12523] file.c: Unexpected control subclass '-1'
[Apr 2 21:30:27] DEBUG[12523] app_macro.c: Oooh, got something to jump out
with ('1')!
[Apr 2 21:30:27] DEBUG[12523] app_dial.c: Macro exited with status 49
[Apr 2 21:30:27] VERBOSE[12527] logger.c: -- Executing
[h at macro-dialout-trunk:1] Macro("Local/xxxxxxx at from-internal-182b,2",
"hangupcall|") in new stack

In another instance the following was reported:

[Apr 3 10:34:59] DEBUG[17927] app_macro.c: Oooh, got something to jump out
with ('1')!
[Apr 3 10:34:59] DEBUG[17927] app_dial.c: Macro exited with status 49
[Apr 3 10:34:59] DEBUG[17927] channel.c: Hanging up channel
'Local/xxxxxxx at from-internal-d163;1'
[Apr 3 10:34:59] DEBUG[17931] channel.c: Didn't get a frame from channel:
Local/xxxxxxx at from-internal-d163;2
[Apr 3 10:34:59] DEBUG[17931] channel.c: Bridge stops bridging channels
Local/xxxxxxx at from-internal-d163;2 and SIP/vitel-outbound-08632ed8

As can be seen for the dialplan, the background command is properly
directing back to the macro-confirm context. This dialplan has been working
flawlessly for 1-2 years on Asterisk 1.4 and it's variant on Asterisk 1.2
(the variant adjusting for Channel(language) that changed on 1.4).


======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0014011 [patch] Incorrect jump to extension
related to          0015091 [patch] digit timeout problem with 1.4 ...
related to          0016434 [patch] Background() when called from A...
====================================================================== 

---------------------------------------------------------------------- 
 (0115961) svnbot (reporter) - 2010-01-04 12:30
 https://issues.asterisk.org/view.php?id=14940#c115961 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 237407

_U  branches/1.6.0/
U   branches/1.6.0/include/asterisk/channel.h
U   branches/1.6.0/main/pbx.c
U   branches/1.6.0/res/res_agi.c

------------------------------------------------------------------------
r237407 | tilghman | 2010-01-04 12:30:36 -0600 (Mon, 04 Jan 2010) | 30
lines

Merged revisions 237406 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r237406 | tilghman | 2010-01-04 12:28:28 -0600 (Mon, 04 Jan 2010) | 23
lines
  
  Merged revisions 237405 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r237405 | tilghman | 2010-01-04 12:19:00 -0600 (Mon, 04 Jan 2010) | 16
lines
    
    Add a flag to disable the Background behavior, for AGI users.
    This is in a section of code that relates to two other issues, namely
    issue https://issues.asterisk.org/view.php?id=14011 and issue
https://issues.asterisk.org/view.php?id=14940), one of which was the behavior of
    Background when called with a context argument that matched the
current
    context.  This fix broke FreePBX, however, in a post-Dial situation.
    Needless to say, this is an extremely difficult collision of several
    different issues.  While the use of an exception flag is ugly, fixing
all
    of the issues linked is rather difficult (although if someone would
like
    to propose a better solution, we're happy to entertain that
suggestion).
    (closes issue https://issues.asterisk.org/view.php?id=16434)
     Reported by: rickead2000
     Patches: 
           20091217__issue16434.diff.txt uploaded by tilghman (license 14)
           20091222__issue16434__1.6.1.diff.txt uploaded by tilghman
(license 14)
     Tested by: rickead2000
  ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=237407 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-01-04 12:30 svnbot         Checkin                                      
2010-01-04 12:30 svnbot         Note Added: 0115961                          
======================================================================




More information about the asterisk-bugs mailing list