[prev in list] [next in list] [prev in thread] [next in thread] 

List:       asterisk-dev
Subject:    Re: [asterisk-dev] [Code Review]: app_queue log membername when
From:       "jamuel" <reviewboard () asterisk ! org>
Date:       2011-07-29 20:04:52
Message-ID: 20110729200452.21431.57673 () hotblack ! digium ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On July 27, 2011, 9:30 a.m., David Vossel wrote:
> > 

I've reworked this function to take advantage of Russell's recent change to ao2_find \
(TRUNK-330273) so there is no longer an ao2_ref for mem to deal with.  I've also \
moved he queue_t_unref per Richard's suggestion


> On July 27, 2011, 9:30 a.m., David Vossel wrote:
> > http://svn.asterisk.org/svn/asterisk/trunk/apps/app_queue.c, lines 8632-8649
> > <https://reviewboard.asterisk.org/r/1286/diff/8/?file=17664#file17664line8632>
> > 
> > This is not safe.  When you find a member and grab a reference to it, you hold \
> > that reference until the member is no longer being used by that thread.  This \
> > function finds the member, unrefs it, and then returns a pointer to the unrefed \
> > memory. 
> > Also, it looks like the queue should be unrefed after unlocking it after finding \
> > it by load_realtime_queue().
> 
> rmudgett wrote:
> Reference leak of q and also use of q after you have unrefed it.
> Put the unref q after the unlock of q.
> 
> The first if curly brace is in the wrong place per coding guidelines.

Done.


- jamuel


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


On July 26, 2011, 7 p.m., jamuel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1286/
> -----------------------------------------------------------
> 
> (Updated July 26, 2011, 7 p.m.)
> 
> 
> Review request for Asterisk Developers, Tilghman Lesher, leifmadsen, opticron, and \
> irroot. 
> 
> Summary
> -------
> 
> app_queue logs the events ADDMEMBER and REMOVEMEMBER with the agent field set to \
> the interface value rather than the membername value when a member is added with a \
> state_interface value set.  However all other member related queue events are \
> logged with the membername when a state_interface is set. It would seem that these \
> ADD/REMOVE MEMBER events should log the agent field in the same manner.  
> This patch addresses the original issue reported in \
> https://issues.asterisk.org/jira/browse/ASTERISK-14769 by providing a queues.conf \
> general configuration option log_membername_as-agent. Setting \
> log_membername_as_agent = yes will cause the membername to be logged in the agent \
> field for ADDMEMBER and REMOVEMEMBER queue events if a state_interface has been \
> set. 
> The default value (log_membername_as_agent = no) does not alter the existing \
> logging for the ADDMEMBER and REMOVEMEMBER events to maintain existing (buggy) \
> behavior for the sake of backwards compatibility.  
> 
> This addresses bug https://issues.asterisk.org/jira/browse/ASTERISK-14769.
> https://issues.asterisk.org/jira/browse/https://issues.asterisk.org/jira/browse/ASTERISK-14769
>  
> 
> Diffs
> -----
> 
> http://svn.asterisk.org/svn/asterisk/trunk/configs/queues.conf.sample 329611 
> http://svn.asterisk.org/svn/asterisk/trunk/apps/app_queue.c 329611 
> 
> Diff: https://reviewboard.asterisk.org/r/1286/diff
> 
> 
> Testing
> -------
> 
> Tested add, remove, pause, unpause via AMI, CLI, and Dialplan apps and see the \
> correct log output to queue_log.  Also tested with log_membername_as_agent omitted \
> to insure backward compatibility for those queues.conf that might not be updated \
> for this new option.  
> Sample test plan (add and remove)
> ---------------------------------
> 
> set log_membername_as_agent = yes in queues.conf
> 
> AMI:
> ====
> Action: QueueAdd
> Queue: 4152000400
> Interface: Local/4152000501@from-internal/n
> Penalty: 0
> Paused: 0
> MemberName: Edward Frank
> 
> Action: QueueRemove
> Queue: 4152000400
> Interface: Local/4152000501@from-internal/n
> 
> 
> Action: QueueAdd
> Queue: 4152000400
> Interface: Local/4152000501@from-internal/n
> 
> Action: QueueRemove
> Queue: 4152000400
> Interface: Local/4152000501@from-internal/n
> 
> 
> CLI:
> ====
> > queue add member Local/4152000501@from-internal/n to 4152000400 penalty 0 as \
> > "Edward Frank" state_interface Sip/SOFTJPS queue remove member \
> > Local/4152000501@from-internal/n from 4152000400
> 
> > queue add member Local/4152000501@from-internal/n to 4152000400
> > queue remove member Local/4152000501@from-internal/n from 4152000400
> 
> Dialplan:
> =========
> 
> [from-test]
> exten => 1234,1,AddQueueMember(4152000400,Local/4152000501@from-internal/n,0,,Edward \
> Davis,Sip/SOFTJPS) exten => \
> 1234,n,RemoveQueueMember(4152000400,Local/4152000501@from-internal/n) exten => \
> 1234,n,Hangup() 
> exten => 5678,1,AddQueueMember(4152000400,Local/4152000501@from-internal/n,0)
> exten => 5678,n,RemoveQueueMember(4152000400,Local/4152000501@from-internal/n)
> exten => 5678,n,Hangup()
> 
> 
> Rinse and repeat with log_membername_as_agent = no
> Repeat with log_membername_as_agent omitted.
> 
> 
> Thanks,
> 
> jamuel
> 
> 


[Attachment #5 (text/html)]

<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/1286/">https://reviewboard.asterisk.org/r/1286/</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;">I&#39;ve reworked this \
function to take advantage of Russell&#39;s recent change to ao2_find (TRUNK-330273) \
so there is no longer an ao2_ref for mem to deal with.  I&#39;ve also moved he \
queue_t_unref per Richard&#39;s suggestion</pre> <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On July 27th, 2011, 9:30 a.m., <b>David Vossel</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/1286/diff/8/?file=17664#file17664line8632" \
style="color: black; font-weight: bold; text-decoration: \
underline;">http://svn.asterisk.org/svn/asterisk/trunk/apps/app_queue.c</a>  <span \
style="font-weight: normal;">

     (Diff revision 8)

    </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; ">static \
int reload(void)</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">8632</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="k">static</span> <span class="k">struct</span> <span class="n">member</span> \
<span class="o">*</span><span \
class="nf">find_member_by_queuename_and_interface</span><span class="p">(</span><span \
class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span \
class="n">queuename</span><span class="p">,</span> <span class="k">const</span> <span \
class="kt">char</span> <span class="o">*</span><span class="n">interface</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">8633</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><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">8634</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">	<span \
class="k">struct</span> <span class="n">member</span> <span \
class="n">tmpmem</span><span class="p">,</span> <span class="o">*</span><span \
class="n">mem</span> <span class="o">=</span> <span class="nb">NULL</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">8635</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">	<span \
class="k">struct</span> <span class="n">call_queue</span> <span \
class="o">*</span><span class="n">q</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">8636</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></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">8637</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">	<span \
class="n">ast_copy_string</span><span class="p">(</span><span \
class="n">tmpmem</span><span class="p">.</span><span class="n">interface</span><span \
class="p">,</span> <span class="n">interface</span><span class="p">,</span> <span \
class="k">sizeof</span><span class="p">(</span><span class="n">tmpmem</span><span \
class="p">.</span><span class="n">interface</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">8638</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">	<span \
class="k">if</span> <span class="p">((</span><span class="n">q</span> <span \
class="o">=</span> <span class="n">load_realtime_queue</span><span \
class="p">(</span><span class="n">queuename</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">8639</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">	<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">8640</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">		<span \
class="n">ao2_lock</span><span class="p">(</span><span class="n">q</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">8641</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">		<span \
class="k">if</span> <span class="p">((</span><span class="n">mem</span> <span \
class="o">=</span> <span class="n">ao2_find</span><span class="p">(</span><span \
class="n">q</span><span class="o">-&gt;</span><span class="n">members</span><span \
class="p">,</span> <span class="o">&amp;</span><span class="n">tmpmem</span><span \
class="p">,</span> <span class="n">OBJ_POINTER</span><span class="p">)))</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">8642</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">			<span \
class="n">ao2_ref</span><span class="p">(</span><span class="n">mem</span><span \
class="p">,</span> <span class="o">-</span><span class="mi">1</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">8643</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">			<span \
class="n">queue_t_unref</span><span class="p">(</span><span class="n">q</span><span \
class="p">,</span> <span class="s">&quot;Expiring temporary \
reference.&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">8644</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">		<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">8645</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">		<span \
class="n">ao2_unlock</span><span class="p">(</span><span class="n">q</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">8646</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">	<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">8647</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">	<span \
class="k">return</span> <span class="n">mem</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">8648</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><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">8649</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></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 is not safe.  When \
you find a member and grab a reference to it, you hold that reference until the \
member is no longer being used by that thread.  This function finds the member, \
unrefs it, and then returns a pointer to the unrefed memory.

Also, it looks like the queue should be unrefed after unlocking it after finding it \
by load_realtime_queue().</pre>  </blockquote>



 <p>On July 27th, 2011, 11:58 a.m., <b>rmudgett</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;">Reference leak of q and \
also use of q after you have unrefed it. Put the unref q after the unlock of q.

The first if curly brace is in the wrong place per coding guidelines.</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;">Done.</pre> \
<br />




<p>- jamuel</p>


<br />
<p>On July 26th, 2011, 7 p.m., jamuel wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('https://reviewboard.asterisk.org/media/rb/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, Tilghman Lesher, leifmadsen, opticron, \
and irroot.</div> <div>By jamuel.</div>


<p style="color: grey;"><i>Updated July 26, 2011, 7 p.m.</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;">app_queue logs the events ADDMEMBER and REMOVEMEMBER with the agent \
field set to the interface value rather than the membername value when a member is \
added with a state_interface value set.  However all other member related queue \
events are logged with the membername when a state_interface is set. It would seem \
that these ADD/REMOVE MEMBER events should log the agent field in the same manner. 

This patch addresses the original issue reported in \
https://issues.asterisk.org/jira/browse/ASTERISK-14769 by providing a queues.conf \
general configuration option log_membername_as-agent. Setting log_membername_as_agent \
= yes will cause the membername to be logged in the agent field for ADDMEMBER and \
REMOVEMEMBER queue events if a state_interface has been set.

The default value (log_membername_as_agent = no) does not alter the existing logging \
for the ADDMEMBER and REMOVEMEMBER events to maintain existing (buggy) behavior for \
the sake of backwards compatibility. </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;">Tested add, remove, pause, unpause via AMI, CLI, and Dialplan apps and \
see the correct log output to queue_log.  Also tested with log_membername_as_agent \
omitted to insure backward compatibility for those queues.conf that might not be \
updated for this new option. 

Sample test plan (add and remove)
---------------------------------

set log_membername_as_agent = yes in queues.conf

AMI:
====
Action: QueueAdd
Queue: 4152000400
Interface: Local/4152000501@from-internal/n
Penalty: 0
Paused: 0
MemberName: Edward Frank

Action: QueueRemove
Queue: 4152000400
Interface: Local/4152000501@from-internal/n


Action: QueueAdd
Queue: 4152000400
Interface: Local/4152000501@from-internal/n

Action: QueueRemove
Queue: 4152000400
Interface: Local/4152000501@from-internal/n


CLI:
====
&gt; queue add member Local/4152000501@from-internal/n to 4152000400 penalty 0 as \
&quot;Edward Frank&quot; state_interface Sip/SOFTJPS &gt; queue remove member \
Local/4152000501@from-internal/n from 4152000400

&gt; queue add member Local/4152000501@from-internal/n to 4152000400
&gt; queue remove member Local/4152000501@from-internal/n from 4152000400

Dialplan:
=========

[from-test]
exten =&gt; 1234,1,AddQueueMember(4152000400,Local/4152000501@from-internal/n,0,,Edward \
Davis,Sip/SOFTJPS) exten =&gt; \
1234,n,RemoveQueueMember(4152000400,Local/4152000501@from-internal/n) exten =&gt; \
1234,n,Hangup()

exten =&gt; 5678,1,AddQueueMember(4152000400,Local/4152000501@from-internal/n,0)
exten =&gt; 5678,n,RemoveQueueMember(4152000400,Local/4152000501@from-internal/n)
exten =&gt; 5678,n,Hangup()


Rinse and repeat with log_membername_as_agent = no
Repeat with log_membername_as_agent omitted.
</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/jira/browse/https://issues.asterisk.org/jira/browse/ASTERISK-14769">https://issues.asterisk.org/jira/browse/ASTERISK-14769</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>http://svn.asterisk.org/svn/asterisk/trunk/configs/queues.conf.sample <span \
style="color: grey">(329611)</span></li>

 <li>http://svn.asterisk.org/svn/asterisk/trunk/apps/app_queue.c <span style="color: \
grey">(329611)</span></li>

</ul>

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




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








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



--
_____________________________________________________________________
-- 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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic