[asterisk-bugs] [Asterisk 0015623]: 'h' extension never reach in a macro

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Jul 31 08:35:43 CDT 2009


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15623 
====================================================================== 
Reported By:                sberney
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   15623
Category:                   Applications/app_macro
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
Asterisk Version:           1.6.0.10 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-07-31 07:05 CDT
Last Modified:              2009-07-31 08:35 CDT
====================================================================== 
Summary:                    'h' extension never reach in a macro
Description: 
Same than issue 14122 but on version 1.6.0.10, we are unable to reach "h"
extension in a macro.

Sample dialplan :

[testing]
exten => 100, 1, Answer
exten => 100, n, Macro(test)

[macro-test]
exten => s, 1, Wait(2)
exten => s, n, Hangup
exten => h, 1, NoOp("Finish !")

Result in CLI is :

    -- Executing [100 at testing:1] Answer("SIP/test-b786f960", "") in new
stack
    -- Executing [100 at testing:2] Macro("SIP/test-b786f960", "test") in new
stack
    -- Executing [s at macro-test:1] Wait("SIP/test-b786f960", "2") in new
stack
    -- Executing [s at macro-test:2] Hangup("SIP/test-b786f960", "") in new
stack
  == Spawn extension (macro-test, s, 2) exited non-zero on
'SIP/test-b786f960' in macro 'test'
  == Spawn extension (testing, 100, 2) exited non-zero on
'SIP/test-b786f960'

And never reach "h" extension.
====================================================================== 

---------------------------------------------------------------------- 
 (0108458) sberney (reporter) - 2009-07-31 08:35
 https://issues.asterisk.org/view.php?id=15623#c108458 
---------------------------------------------------------------------- 
I copy code from v 1.4.24-rc5 sources and that's now working.

Here's the modifications :

On apps/app_macro.c, line 457, add :

	if (ast_check_hangup(chan) || res < 0) {
		/* Don't need to lock the channel, as we aren't dereferencing emc.
		 * The intent here is to grab the deepest context, without overwriting
		 * in any above context. */
		const char *emc = pbx_builtin_getvar_helper(chan,
"EXIT_MACRO_CONTEXT");
		if (!emc) {
			pbx_builtin_setvar_helper(chan, "EXIT_MACRO_CONTEXT", fullmacro);
		}
	}

On file "main/pbx.c", line 3664, add :
	const char *emc;

line 3859, add : 
	if ((emc = pbx_builtin_getvar_helper(c, "EXIT_MACRO_CONTEXT"))) {
		emc = ast_strdupa(emc);
	}

And modify "if" condition on line 3860..3862 to :
	if ((!args || !args->no_hangup_chan) &&
			!ast_test_flag(c, AST_FLAG_BRIDGE_HANGUP_RUN) && 
			((emc && ast_exists_extension(c, emc, "h", 1, c->cid.cid_num)) ||
			 (ast_exists_extension(c, c->context, "h", 1, c->cid.cid_num) && (emc =
c->context)))
			) {

And add a line before line 3863 :
	ast_copy_string(c->context, emc, sizeof(c->context)); 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-07-31 08:35 sberney        Note Added: 0108458                          
======================================================================




More information about the asterisk-bugs mailing list