<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/3854/">https://reviewboard.asterisk.org/r/3854/</a>
     </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On July 29th, 2014, 2:32 p.m. UTC, <b>Joshua Colp</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://reviewboard.asterisk.org/r/3854/diff/1/?file=65275#file65275line207" style="color: black; font-weight: bold; text-decoration: underline;">/branches/1.8/main/manager.c</a>
    <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">ASTERISK_FILE_VERSION(__FILE__, "$Revision$")</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">207</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">   </span><span class="tb">  </span><span class="tb">  </span>Set a channel variable.</pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">207</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">   </span><span class="tb">  </span><span class="tb">  </span>Set a channel variable<span class="hl"> directly or via function</span>.</pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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?</pre>
 </blockquote>



 <p>On July 29th, 2014, 7:53 p.m. UTC, <b>rnewton</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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."</pre>
 </blockquote>







</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">"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.</pre>
<br />




<p>- Mark</p>


<br />
<p>On July 25th, 2014, 2:20 p.m. UTC, rnewton wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers.</div>
<div>By rnewton.</div>


<p style="color: grey;"><i>Updated July 25, 2014, 2:20 p.m.</i></p>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://issues.asterisk.org/jira/browse/ASTERISK-21178">ASTERISK-21178</a>


</div>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The documentation wasn't clear that AMI Getvar and Setvar could accept function calls.

This is a slight modification to improve clarity.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Once finalized I'll build in dev-mode with it to make sure I didn't screw up any tags.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/branches/1.8/main/manager.c <span style="color: grey">(419562)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/3854/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>