[Home]

Summary:ASTERISK-15014: Sometimes macro in h extension returns to s extension
Reporter:PHewlett (majorbloodnok)Labels:
Date Opened:2009-10-20 09:14:53Date Closed:2009-10-22 12:19:16
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/app_macro
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:[Incidentally the bug guidelines link on the report and entry pages is a dead link]

Example code:

exten => s,1,Dial(....)
exten => s,2,Noop(macro returns here incorrectly)

exten => h,1,Macro(some-macro)
exten => h,2,Noop(macro shoul return here but does not)

I am unable to reproduce this consistently. Analysis is in Adduitional Information. Version is 1.4.22 but I see (what I think) may be the error is still in subversion trunk


****** ADDITIONAL INFORMATION ******

App_macro.c has the following code :
if (!(chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO)) {
/* Copy the extension, so long as we're not in softhangup, where we could be given an asyncgoto */
const char *offsets;
ast_copy_string(chan->exten, oldexten, sizeof(chan->exten));
if ((offsets = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"))) {
/* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue
  normally if there is any problem */
if (sscanf(offsets, "%d", &offset) == 1) {
if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + offset + 1, chan->cid.cid_num)) {
chan->priority += offset;
}
}
}
}
}

This code snippet is not executed because the chan->_softhangup field has the value 0x1F. Tracing reveals that this is set by the following code in pbx.c:

if (res != AST_PBX_KEEPALIVE)
       ast_softhangup(c, c->hangupcause ? c->hangupcause : AST_CAUSE_NORMAL_CLEARING);

This code snippet was introduced in bug 10290. It seems wrong as the second argument to ast_softhangup() should be a bitmasked type AST_SOFTHANGUP_* and not an absolute value like hangupcause or AST_CAUSE_NORMAL_CLEARING.
Comments:By: Leif Madsen (lmadsen) 2009-10-21 09:41:34

Assigned to Tilghman simply to acknowledge or close the issue, but not to resolve currently. If this is indeed behaviour that is incorrect, please unassign yourself and mark as Acknowledged. Thanks!

By: PHewlett (majorbloodnok) 2009-10-21 10:56:58

My colleague Roman Murar has analysed and made a fix - the diff is:


<inline patch removed by lmadsen>



By: Leif Madsen (lmadsen) 2009-10-21 11:13:15

You need to provide patches as attachments, and if you have not already done so, to sign an online License Agreement (as found at the top).

By: Digium Subversion (svnbot) 2009-10-21 11:21:39

Repository: asterisk
Revision: 225105

U   branches/1.4/apps/app_meetme.c
U   branches/1.4/include/asterisk/channel.h
U   branches/1.4/main/pbx.c

------------------------------------------------------------------------
r225105 | tilghman | 2009-10-21 11:21:39 -0500 (Wed, 21 Oct 2009) | 4 lines

Fix documentation for ast_softhangup() and correct the misuse thereof.
(closes issue ASTERISK-15014)
Reported by: majorbloodnok

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

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

By: Digium Subversion (svnbot) 2009-10-22 12:15:50

Repository: asterisk
Revision: 225360

_U  trunk/
U   trunk/apps/app_meetme.c
U   trunk/include/asterisk/channel.h
U   trunk/main/pbx.c

------------------------------------------------------------------------
r225360 | tilghman | 2009-10-22 12:15:50 -0500 (Thu, 22 Oct 2009) | 11 lines

Merged revisions 225105 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r225105 | tilghman | 2009-10-21 11:02:12 -0500 (Wed, 21 Oct 2009) | 4 lines
 
 Fix documentation for ast_softhangup() and correct the misuse thereof.
 (closes issue ASTERISK-15014)
  Reported by: majorbloodnok
........

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

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

By: Digium Subversion (svnbot) 2009-10-22 12:17:56

Repository: asterisk
Revision: 225361

_U  branches/1.6.0/
U   branches/1.6.0/apps/app_meetme.c
U   branches/1.6.0/include/asterisk/channel.h
U   branches/1.6.0/main/pbx.c

------------------------------------------------------------------------
r225361 | tilghman | 2009-10-22 12:17:55 -0500 (Thu, 22 Oct 2009) | 18 lines

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

................
 r225360 | tilghman | 2009-10-22 12:11:23 -0500 (Thu, 22 Oct 2009) | 11 lines
 
 Merged revisions 225105 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r225105 | tilghman | 2009-10-21 11:02:12 -0500 (Wed, 21 Oct 2009) | 4 lines
   
   Fix documentation for ast_softhangup() and correct the misuse thereof.
   (closes issue ASTERISK-15014)
    Reported by: majorbloodnok
 ........
................

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

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

By: Digium Subversion (svnbot) 2009-10-22 12:19:06

Repository: asterisk
Revision: 225362

_U  branches/1.6.1/
U   branches/1.6.1/apps/app_meetme.c
U   branches/1.6.1/include/asterisk/channel.h
U   branches/1.6.1/main/pbx.c

------------------------------------------------------------------------
r225362 | tilghman | 2009-10-22 12:19:06 -0500 (Thu, 22 Oct 2009) | 18 lines

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

................
 r225360 | tilghman | 2009-10-22 12:11:23 -0500 (Thu, 22 Oct 2009) | 11 lines
 
 Merged revisions 225105 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r225105 | tilghman | 2009-10-21 11:02:12 -0500 (Wed, 21 Oct 2009) | 4 lines
   
   Fix documentation for ast_softhangup() and correct the misuse thereof.
   (closes issue ASTERISK-15014)
    Reported by: majorbloodnok
 ........
................

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

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

By: Digium Subversion (svnbot) 2009-10-22 12:19:15

Repository: asterisk
Revision: 225363

_U  branches/1.6.2/
U   branches/1.6.2/apps/app_meetme.c
U   branches/1.6.2/include/asterisk/channel.h
U   branches/1.6.2/main/pbx.c

------------------------------------------------------------------------
r225363 | tilghman | 2009-10-22 12:19:15 -0500 (Thu, 22 Oct 2009) | 18 lines

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

................
 r225360 | tilghman | 2009-10-22 12:11:23 -0500 (Thu, 22 Oct 2009) | 11 lines
 
 Merged revisions 225105 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r225105 | tilghman | 2009-10-21 11:02:12 -0500 (Wed, 21 Oct 2009) | 4 lines
   
   Fix documentation for ast_softhangup() and correct the misuse thereof.
   (closes issue ASTERISK-15014)
    Reported by: majorbloodnok
 ........
................

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

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