[asterisk-users] How to get values of local channels context

Tzafrir Cohen tzafrir.cohen at xorcom.com
Mon Feb 26 21:42:12 MST 2007


On Mon, Feb 26, 2007 at 08:06:40PM -0800, kjcsb wrote:
> The variable ${CONTEXT} stores the value of the current context. However if we are in a macro that will be the name of the macro. How do I access the name of the local channel's context.
> 
> For example:
> [macro-test]
> exten => s,n,NoOp(Context ${CONTEXT})
> 
> CLI shows:
>     -- Executing NoOp("Local/2592 at 1100006-2000-e802,2", "Context macro-test") in new stack
> 
> I want to get 1100006-2000 somehow.
> 
> Any suggestions would be appreciated.

>From the text of 'show application macro':

[Description]
  Macro(macroname|arg1|arg2...): Executes a macro using the context
'macro-<macroname>', jumping to the 's' extension of that context and
executing each step, then returning when the steps end. 
The calling extension, context, and priority are stored in ${MACRO_EXTEN}, 
${MACRO_CONTEXT} and ${MACRO_PRIORITY} respectively.  Arguments become
${ARG1}, ${ARG2}, etc in the macro context.

So use ${MACRO_CONTEXT} .

-- 
               Tzafrir Cohen       
icq#16849755                    jabber:tzafrir at jabber.org
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com       
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir


More information about the asterisk-users mailing list