<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-05-09 06:11:17.048545</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;">chan_sip:handle_request_invite() cannot afford to call ast_stream_and_wait(pickupsound).
changing features.conf &#39;pickupsound = tt-somethingwrong&#39; highlights the issue.
   during playout period &#39;core show locks, has the following lock, no others waiting. 
   === ---&gt; Lock #0 (chan_sip.c): MUTEX 24533 handle_request_do &amp;netlock 0xb6684ce0 (1)

The fix, spawn a new thread &#39;sip_pickup&#39; from handle_request_invite to do the pickup, and more importantly playout the audio..

The result:
4 SIP phones required. A rings B, C and D (at exactly the same time) use the *8 pickup feature code to pickup B.
Both C and D at the same time, hear the respective &#39;success, or &#39;failure&#39; beep.

Below correct console output.
[2011-05-09 22:43:27.510121] NOTICE[22857]: chan_sip.c:20909 sip_pickup: Group pickup thread started by channel SIP/gxp824-00000011
[2011-05-09 22:43:27.511548] NOTICE[22886]: features.c:5732 ast_pickup_call: pickup SIP/snom8929-00000010 attempt by SIP/gxp824-00000011
  == Using SIP RTP CoS mark 5
[2011-05-09 22:43:27.526062] NOTICE[22857]: chan_sip.c:20909 sip_pickup: Group pickup thread started by channel SIP/gxp822-00000012
    -- &lt;SIP/gxp824-00000011&gt; Playing &#39;tt-somethingwrong.gsm&#39; (language &#39;en&#39;)
    -- &lt;SIP/gxp822-00000012&gt; Playing &#39;beeperr.gsm&#39; (language &#39;en&#39;)
[2011-05-09 22:43:28.020374] NOTICE[22887]: chan_sip.c:20888 sip_pickup_thread: Nothing to pick up for SIP/gxp822-00000012

</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">(317665)</span></li>

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

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

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

 <li>trunk/res/res_features.exports.in <span style="color: grey">(317665)</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>