[asterisk-users] ${MACRO_CONTEXT} for Subroutines

Justin Hester jhester at digium.com
Thu Aug 20 12:09:58 CDT 2015


On Thu, Aug 20, 2015 at 10:52 AM, Bastian Schern <ml04 at reventix.de> wrote:

> Hello Everybody,
>
Howdy


>
> in past times I used macros but since a while they are deprecated.
> So I replaced my macros with subroutines. In most cases this is really no
> problem.
>
> But in some rare cases I miss the macro channel variables (e.g.
> ${MACRO_CONTEXT}).
>
> https://wiki.asterisk.org/wiki/display/AST/Dialplan+Macros+Channel+Variables
>
> Is there something similar for subroutines?
>
Due to the nature of GoSub() vs. Macro() there is no built in channel
variable which carries
that information with a GoSub(). Devs keep me honest here.

If the subroutine needs to know what part of dialplan the channel came from
I recommend
sending the information as an ARG in the nested set of parenthesis when
executing the
GoSub() application.

exten => _7XXX,1,GoSub(subDialer,begin,1(${CONTEXT}))


[subDialer]
exten => begin,1,Verbose(0, This subroutine was executed from the ${ARG1}
context.)




>
> Kind regards
> Bastian
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
Justin Hester
Digium, Inc. · Technical Trainer
445 Jan Davis Drive NW · Huntsville, AL 35806 · USA
ph: +1 256 428 6238
Check us out at: https://www.digium.com · http://asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20150820/9fdef5d8/attachment.html>


More information about the asterisk-users mailing list