<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/464/">https://reviewboard.asterisk.org/r/464/</a>
     </td>
    </tr>
   </table>
   <br />





 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">A comment and question :)</pre>
 <br />





<div>




<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/464/diff/3/?file=8060#file8060line368" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/funcs/func_groupcount.c</a>
    <span style="font-weight: normal;">

     (Diff revision 3)

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

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

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static int manager_group_set(struct mansession *s, const struct message *m)</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">368</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">channel</span> <span class="o">=</span> <span class="n">astman_get_header</span><span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="s">&quot;Channel&quot;</span><span class="p">);</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">369</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">group</span> <span class="o">=</span> <span class="n">astman_get_header</span><span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="s">&quot;Group&quot;</span><span class="p">);</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">370</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">category</span> <span class="o">=</span> <span class="n">astman_get_header</span><span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="s">&quot;Category&quot;</span><span class="p">);</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Your lacking an ActionID</pre>
</div>
<br />

<div>




<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/464/diff/3/?file=8060#file8060line380" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/funcs/func_groupcount.c</a>
    <span style="font-weight: normal;">

     (Diff revision 3)

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

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

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static int manager_group_set(struct mansession *s, const struct message *m)</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">380</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="n">chan</span> <span class="o">=</span> <span class="n">ast_channel_get_by_name</span><span class="p">(</span><span class="n">channel</span><span class="p">);</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Is this the correct syntax?

if (!(chan = ast_channel_get_by_name(channel))) {
     astman_send_error(s, m, &quot;Channel not found&quot;);
     return AMI_SUCCESS;
}</pre>
</div>
<br />



<p>- Paul</p>


<br />
<p>On February 9th, 2010, 11:01 a.m., kobaz wrote:</p>






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

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


<p style="color: grey;"><i>Updated 2010-02-09 11:01:51</i></p>




<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;">This patch allows for setting variables on a group of channels.
First a channel is assigned a group via dialplan GROUP() or GroupSet via the ami (new command)
Then, variables can be set on that group with the GROUP_VAR() dialplan function, or GroupVarSet in the manager

This patch also adds manager events for channel group changes, and variable updates

When a group is no longer used (all channels referencing the group are hung up, or all channels referencing the group have their group changed/unset), variables are destroyed

new manager commands:
GroupSet - adds functionality to the manager to be able to set a GROUP() on a channel.
GroupsShowChannels - show each channel and it&#39;s associated groups (a channel will be repeated for each group@category it&#39;s a member of)
GroupsShowVariables - show variables in each group@category, one event per group, all variables are contained in each group@category event
GroupVarSet - set a group variable (the group has to exist)
GroupVarGet - get a group variable

new manager events:
GroupCreate
GroupChannelAdd
GroupChannelRemove
GroupDestroy
GroupVarSet

Example AMI:
Action: GroupVarSet
Group: 1000
Category: ConferenceBridge
Variable: LastUpdateCheck
Value: 1263502512

Example CLI:
demo1*CLI&gt; group show variables
Group    Variables    Category
1000            ConferenceBridge
    LastUpdateCheck=1263502512
1000            ConferenceModerator
2 active groups


Adds support for:
  Group variables
     dialplan access: GROUP_VAR()
     cli access: group show variables
     manager access: GroupVarSet GroupVarGet
  Group information: 
     manager access: GroupSet GroupsShow GroupsShowChannels GroupsShowVariables
  
</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;">dialplan:
    Set(GROUP()=foo);
    Set(GROUP()=foobar@foocat);

    Set(GROUP_VAR(foo,myvar)=123);
    Set(GROUP_VAR(foo,myvar2)=456);
    NoOp(${GROUP_VAR(foo,myvar)});
    NoOp(${GROUP_VAR(foo,myvar2)});

    Set(GROUP_VAR(foobar@foocat,myvar)=123);
    NoOp(${GROUP_VAR(foobar@foocat,myvar)});

    Set(GROUP_VAR(something,myvar)=123);
    NoOp(${GROUP_VAR(something,myvar)});

    Wait(10000);
    Hangup();


CLI:
-------------------
&gt; group show channels
-------------------
channel                    Group                 Category
IAX2/branch-15569          foo                   (default)
IAX2/branch-15569          foobar                foocat
2 active channels

-------------------
&gt; group show variables
-------------------
Group    Variables    Category
foo                   (Default)
     myvar2=456
     myvar=123
foobar                foocat
     myvar=123
2 active groups


AMI:
-------------------
Action: GroupsShow
-------------------
Response: Success
Eventlist: start
Message: Groups will follow

Event: GroupsShow
Group: foo
Category:

Event: GroupsShow
Group: foobar
Category: foocat

Event: GroupsShowComplete
EventList: Complete
ListItems: 2


-------------------
Action: GroupsShowChannels
-------------------
Response: Success
Eventlist: start
Message: Group channels will follow

Event: GroupsShowChannels
Group: foo
Category:
Channel: IAX2/branch-14981

Event: GroupsShowChannels
Group: foobar
Category: foocat
Channel: IAX2/branch-14981

Event: GroupsShowChannelsComplete
EventList: Complete
ListItems: 2




-------------------
Action: GroupsShowVariables
-------------------
Response: Success
Eventlist: start
Message: Group variables will follow

Event: GroupsShowVariables
Group: foo
Category:
VariablesStart: Variables will follow
myvar2: 456
myvar: 123


Event: GroupsShowVariables
Group: foobar
Category: foocat
VariablesStart: Variables will follow
myvar: 123

Event: GroupsShowVariablesComplete
EventList: Complete
ListItems: 2


-------------------
Action: GroupVarGet
Group: foo
Variable: myvar
-------------------
Response: Success
Message: Result will follow

Event: GroupVarGetResponse
Group: foo
Category:
Variable: myvar
Value: 123


-------------------
Action: GroupVarSet
Group: foobar
Category: foocat
Variable: something
Value: 1238091283123
-------------------

Response: Success
Message: Variable Set


-------------------
Action: GroupVarSet
Group: doesntexist
Category: foocat
Variable: something
Value: 1238091283123
-------------------

Response: Error
Message: Variable set failed (group doesn&#39;t exist)
</pre>
  </td>
 </tr>
</table>



<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/view.php?id=16614">16614</a>


</div>


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

 <li>/trunk/funcs/func_groupcount.c <span style="color: grey">(240226)</span></li>

 <li>/trunk/include/asterisk/app.h <span style="color: grey">(240226)</span></li>

 <li>/trunk/include/asterisk/channel.h <span style="color: grey">(240226)</span></li>

 <li>/trunk/main/app.c <span style="color: grey">(240226)</span></li>

 <li>/trunk/main/cli.c <span style="color: grey">(240226)</span></li>

</ul>

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




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








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