[Home]

Summary:ASTERISK-12092: [patch] Compatibilty wrapper for Macro to use GoSub
Reporter:Atis Lezdins (atis)Labels:
Date Opened:2008-05-28 04:13:48Date Closed:2011-06-07 14:08:16
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_macro_wrapper.c
Description:This is replacement for app_macro and enables compatibility with AEL parser in 1.6. AEL parser is internally changing "macro" declarations and usage to GoSub, but this is not compatible with realtime dialplan.

This simple wrapper doesn't in any way implements full functionality of Macro, but allows simple calls from realtime dialplan to Macro work as they were calls to macro from AEL.

Therefore app_macro can be disabled in default menuselect as it's usage is discouraged and this enabled for compatibility.


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

Here's sample log of app_macro_wrapper working:

<pre>
May 28 01:16:34] DEBUG[7567] res_config_mysql.c: MySQL RealTime: Connection okay.
[May 28 01:16:34] DEBUG[7567] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM extensions_table WHERE exten = 'ivr---786' AND context = 'db_ivr' AND priority = '5'
[May 28 01:16:34] DEBUG[7567] res_config_mysql.c: MySQL RealTime: Connection okay.
[May 28 01:16:34] DEBUG[7567] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM extensions_table WHERE exten = 'ivr---786' AND context = 'db_ivr' AND priority = '5'
[May 28 01:16:34] VERBOSE[7567] logger.c:     -- Executing Macro("SIP/112233-082318b8", "cdr_block_start,ivr,488")
[May 28 01:16:34] NOTICE[7567] app_macro_wrapper.c: Executing GoSub(cdr_block_start,s,1(ivr,488))
[May 28 01:16:34] DEBUG[7567] app_stack.c: Setting 'ARG1' to 'ivr'
[May 28 01:16:34] DEBUG[7567] app_stack.c: Setting 'ARG2' to '488'
[May 28 01:16:34] DEBUG[7567] pbx.c: Launching 'Set'
[May 28 01:16:34] VERBOSE[7567] logger.c:     -- Executing [s@cdr_block_start:1] Set("SIP/112233-082318b8", "LOCAL(type)=ivr") in new stack
[May 28 01:16:34] DEBUG[7567] pbx.c: Launching 'Set'
[May 28 01:16:34] VERBOSE[7567] logger.c:     -- Executing [s@cdr_block_start:2] Set("SIP/112233-082318b8", "LOCAL(number)=488") in new stack
[May 28 01:16:34] DEBUG[7567] pbx.c: Launching 'NoOp'
[May 28 01:16:34] VERBOSE[7567] logger.c:     -- Executing [s@cdr_block_start:3] NoOp("SIP/112233-082318b8", "-(B)------------------------------------- macro cdr_block_start(ivr,488) -----------") in new stack
[May 28 01:16:34] DEBUG[7567] pbx.c: Expression result is '1'
[May 28 01:16:34] DEBUG[7567] pbx.c: Launching 'GotoIf'                                                                                                                            

...

[May 28 01:16:34] VERBOSE[7567] logger.c:     -- Executing [s@cdr_block_start:93] NoOp("SIP/112233-082318b8", "-(E)------------------------------------- macro cdr_block_start(ivr,488) -----------") in new stack
[May 28 01:16:34] DEBUG[7567] pbx.c: Launching 'Return'
[May 28 01:16:34] VERBOSE[7567] logger.c:     -- Executing [s@cdr_block_start:94] Return("SIP/112233-082318b8", "") in new stack
[May 28 01:16:34] DEBUG[7567] res_config_mysql.c: MySQL RealTime: Connection okay.
[May 28 01:16:34] DEBUG[7567] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM extensions_table WHERE exten = 'ivr---786' AND context = 'db_ivr' AND priority = '6'
[May 28 01:16:34] DEBUG[7567] res_config_mysql.c: MySQL RealTime: Connection okay.
[May 28 01:16:34] DEBUG[7567] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM extensions_table WHERE exten = 'ivr---786' AND context = 'db_ivr' AND priority = '6'
[May 28 01:16:34] VERBOSE[7567] logger.c:     -- Executing NoOp("SIP/112233-082318b8", "ivr---786\, action=wait\, p1=1\, p2=3")                                                    

</pre>
Comments:By: Tilghman Lesher (tilghman) 2008-05-28 08:24:22

1) The formatting is incorrect.  Please see the CODING GUIDELINES.
2) You're using strsep, instead of using the standard argument parsing macros.  Please see app_skel.c for an example.
3) This needs a big warning in the application help that says that it does NOT emulate the functionality of Macro; it is just a wrapper to make interfacing to AEL easier.

Frankly, given how it does not even come close to addressing the full functionality of Macro, I don't see how I could even set this as the default Macro application.  I'm not even sure if I want the confusion that it may generate of adding it to the Asterisk core.

By: Tilghman Lesher (tilghman) 2008-06-08 21:25:39

Since you have not addressed any of the noted problems, I am suspending this issue.