[asterisk-dev] [Code Review] Add EXPORT dialplan function: set variable on another channel

tim.ringenbach at gmail.com tim.ringenbach at gmail.com
Thu Jun 24 10:34:22 CDT 2010



> On 2010-06-24 01:45:31, Tilghman Lesher wrote:
> > We intentionally refused the ExportVar/EXPORT() dialplan function, because altering an execution environment of another channel could occur at very weird times, causing dialplan bugs that are very difficult to diagnose.  As a compromise, we created the SHARED() dialplan function that allows a user to set a variable on another channel ONLY in a "special space" that the channel then has to access in order to retrieve.  This avoids the problem of altering dialplan variables while logic is running within a channel.
> 
> Tilghman Lesher wrote:
>     Additionally, for the direction in your example, we have MASTER_CHANNEL(), for accessing variables in the first channel of a series.

Alright then, SHARED() will do what I wanted EXPORT() for anyway.

Perhaps MASTER_CHANNEL(), and the manager's SetVar should carry the same warning as SHARED?


- tim_ringenbach


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/742/#review2262
-----------------------------------------------------------


On 2010-06-23 18:06:06, tim_ringenbach wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/742/
> -----------------------------------------------------------
> 
> (Updated 2010-06-23 18:06:06)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> Adds a dialplan function named EXPORT that lets you set channel variables on other channels. It is based on IMPORT. Originally it was ExportVar based on ImportVar, but while porting to 1.8 I noticed ImportVar was depreciated.
> 
> You can set either a simple variable or a function.
> Example dialplan that sets a function (you would 'console dial XXXX at test-local'):
> 
> [test]
> exten => _X.,1,NoOp()
> exten => _X.,n,Set(EXPORT(${TEST},CDR(userfield))=blah)
> exten => _X.,n,Dial(SIP/sometrunk/${EXTEN})
> 
> [test-local]
> exten => _X.,1,NoOp()
> exten => _X.,n,Set(__TEST=${CHANNEL})
> exten => _X.,n,Dial(Local/${EXTEN}@test/n)
> 
> 
> Diffs
> -----
> 
>   http://svn.asterisk.org/svn/asterisk/trunk/funcs/func_logic.c 272331 
> 
> Diff: https://reviewboard.asterisk.org/r/742/diff
> 
> 
> Testing
> -------
> 
> I tested it by dialing on the console, using variations of the simple dialplan above, testing setting both variables and functions, and using 'core show channel' to verify everything was set correctly.
> 
> 
> Thanks,
> 
> tim_ringenbach
> 
>




More information about the asterisk-dev mailing list