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


<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 Alec Davis.</div>


<p style="color: grey;"><i>Updated 2011-04-28 07:03:44.720736</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</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;">if 2 channels concurrently attempted to pickup the same channel, the code would fail at masquerade in ast_do_pickup.
Now after target lock is acquired, recheck that the target is still ringing etc.

Using the *8 pickup feature, with the debug logging the result can be seen. 1 wins, the 2nd gets an error beep.

[2011-04-29 00:00:51.328201] NOTICE[927]: features.c:5730 ast_pickup_call: SIP/gxp823-00000024, pickup attempt by SIP/gxp824-00000025
    -- &lt;SIP/gxp824-00000025&gt; Playing &#39;beep.gsm&#39; (language &#39;en&#39;)
[2011-04-29 00:00:51.414847] NOTICE[1023]: features.c:5730 ast_pickup_call: SIP/gxp823-00000024, pickup attempt by DAHDI/33-1
[2011-04-29 00:00:51.848314] NOTICE[927]: features.c:5771 ast_do_pickup: Call pickup on &#39;SIP/gxp823-00000024&#39; by &#39;SIP/gxp824-00000025&#39;
[2011-04-29 00:00:51.848746] NOTICE[927]: features.c:5794 ast_do_pickup: answered &#39;SIP/gxp824-00000025&#39;
[2011-04-29 00:00:51.848942] NOTICE[927]: features.c:5801 ast_do_pickup: queue answer to &#39;SIP/gxp823-00000024&#39;
[2011-04-29 00:00:51.849294] NOTICE[927]: features.c:5808 ast_do_pickup: masquerade &#39;SIP/gxp824-00000025&#39; into &#39;SIP/gxp823-00000024&#39;
[2011-04-29 00:00:51.849626] NOTICE[927]: features.c:5822 ast_do_pickup: return with 0 on &#39;SIP/gxp824-00000025&#39;
[2011-04-29 00:00:51.853989] WARNING[1023]: features.c:5740 ast_pickup_call: target has gone, or not ringing anymore for DAHDI/33-1
    -- &lt;DAHDI/33-1&gt; Playing &#39;beeperr.gsm&#39; (language &#39;en&#39;)

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


<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;">debugging mantis 18654, found common code, of which 1 set was wrong, the ast_pickup_call() code in features.c
The actual fault was ast_pickup_call where the target chan was unlocked too early - see bug18654.diff2.txt

Moved app_directed:pickup_do() to features:ast_do_pickup().

Now functions below all now use the new ast_do_pickup()
app_directed_pickup.c:
   pickup_by_channel()
   pickup_by_exten()
   pickup_by_mark()
   pickup_by_part()
features.c:
   ast_pickup_call() </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;">pickup using *8 feature code, with pickup sounds enabled/disabled

exten =&gt; 71,1,Pickup()           ; any ringing extension in same pickupgroup 
exten =&gt; 72,1,Pickup(85@phones)  ; dahdi extension
exten =&gt; 73,1,Pickup(823@phones) ; sip extension
</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=18654">18654</a>


</div>


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

 <li>trunk/apps/app_directed_pickup.c <span style="color: grey">(316037)</span></li>

 <li>trunk/channels/chan_sip.c <span style="color: grey">(316037)</span></li>

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

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

 <li>trunk/res/res_features.exports.in <span style="color: grey">(316037)</span></li>

</ul>

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




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




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