> On July 29, 2014, 2:32 p.m., Joshua Colp wrote:
> > /branches/1.8/main/manager.c, line 207
> > <https://reviewboard.asterisk.org/r/3854/diff/1/?file=65275#file65275line207>
> >
> >     This confuses me, even after reading a few times. Specifically what 
> > you've added: "directly or via function". Dialplan functions usually don't 
> > set variables.
> >     
> >     "Set a channel variable or execute a dialplan function." is clearer
> >     
> >     Same applies for the other modifications.
> >     
> >     Thoughts?
> 
> rnewton wrote:
>     That makes sense to me. I believe I was thinking of using CHANNEL(blah) 
> with Setvar as setting a channel variable via a function, but I'm betting 
> those arguments are not considered channel variables.
>     
>     Could you use Setvar to just "execute a dialplan function" without 
> assigning a value to the function? That is, can you really use Setvar to 
> execute *any* dialplan function?
>     
>     Also, would it make sense to just use the help text description from the 
> Set application for the description of the Setvar manager command? Albeit 
> with a few changes:
>     
>     "This command can be used to set the value of channel variables or 
> dialplan
>     functions. When setting variables, if the variable name is prefixed with
>     '_', the variable will be inherited into channels created from the current
>     channel. If the variable name is prefixed with '__', the variable will be
>     inherited into channels created from the current channel and all children
>     channels."

"Could you use Setvar to just "execute a dialplan function" without assigning a 
value to the function? That is, can you really use Setvar to execute *any* 
dialplan function?"

No. Dialplan functions can be used in two modes, reading or writing.
Reading: exten => 100,n,Set(SOMEVAR=${CALLERID(name)})
Writing: exten => 100,n,Set(CALLERID(name)=alice)

As you can see from the example above, CALLERID() can be used in read mode or 
write mode. However, not all functions work this way. For instance, the example 
dialplan function CUT can only be used in read mode, not write mode. You can't 
do the following:
exten => 100,n,Set(CUT(SPAGHETTI,-)=cheese)

To give a counterexample, the JITTERBUFFER function can be used in write mode 
but not in read mode.

So how does this translate to Getvar and Setvar? Dialplan functions that can be 
called in write mode can be used with SetVar. Dialplan functions that can be 
called in read mode can be used with Getvar.

Also, using the help text for Set makes a lot of sense.


- Mark


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


On July 25, 2014, 2:20 p.m., rnewton wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3854/
> -----------------------------------------------------------
> 
> (Updated July 25, 2014, 2:20 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-21178
>     https://issues.asterisk.org/jira/browse/ASTERISK-21178
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> The documentation wasn't clear that AMI Getvar and Setvar could accept 
> function calls.
> 
> This is a slight modification to improve clarity.
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/main/manager.c 419562 
> 
> Diff: https://reviewboard.asterisk.org/r/3854/diff/
> 
> 
> Testing
> -------
> 
> Once finalized I'll build in dev-mode with it to make sure I didn't screw up 
> any tags.
> 
> 
> Thanks,
> 
> rnewton
> 
>

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to