[asterisk-bugs] [Asterisk 0011943]: Feature to write variables to existing channels other than your own (func chanvar)

noreply at bugs.digium.com noreply at bugs.digium.com
Thu Feb 7 11:12:29 CST 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=11943 
====================================================================== 
Reported By:                ramonpeek
Assigned To:                russell
====================================================================== 
Project:                    Asterisk
Issue ID:                   11943
Category:                   Functions/func_logic
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     assigned
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             02-06-2008 15:08 CST
Last Modified:              02-07-2008 11:12 CST
====================================================================== 
Summary:                    Feature to write variables to existing channels
other than your own (func chanvar)
Description: 
Many, many times I ran into a dialplan issue where I wanted to set a
variable in the called channel whilst the dialplan was running in the
calling channel.
To my frustration an application like ImportVar() existed but something
like ExportVar() did not.

After bumping into the issue a bit too often I deciced to write it myself
:-)
It probably took me less time writing the patch than it took finding out
ways to realize this feature with the current set of applications &
functions :-(

Anyway...
I started out writing the patch for 1.4.17 and called it 'ExportVar'.
But after finding out it was deprecated in the svn-trunk and talking to
Digium (Qwell) about it,
I decided to create a new logical function in func_logic called
'CHANVAR'.
This feature includes read & write making function 'ImportVar' & 'IMPORT'
both obsolete.
Since function 'IMPORT' is only in teh svn-trunk perhaps it should be
removed or deprecated if this patch gets submitted. 

This is how the new feature works;

To read a variable from another channel;
- Set(CHANVAR(channel,variable)=value)

To write a variable to another channel;
- Set(varname=${CHANVAR(channel,variable)})


PS:
For everyone that wants to add this feature (themselves) to Asterisk
1.4.17 a path to backport to 1.4.17 is also uploaded.
====================================================================== 

---------------------------------------------------------------------- 
 jmls - 02-07-08 11:12  
---------------------------------------------------------------------- 
I was one of the people that originally wanted this, but Corydon convinced
me that this was a bad idea.

However, a thought has just struck me: What if some "incompetent" decided
to update the UNIQUEID variable, or some other variable that meant
something to the channel ? Surely that is as bad as setting a variable in
another channel.

One way round this would be to have "readonly" variables. So, any variable
created within a channel is readonly from any other channel IOW you would
not be able to overwrite or change an existing variable from another
channel but you would be able to create one.

This could also be extended to the "system" variables so that they cannot
be changed from within the dialplan ... 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
02-07-08 11:12  jmls           Note Added: 0081850                          
======================================================================




More information about the asterisk-bugs mailing list