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


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


<p style="color: grey;"><i>Updated Aug. 26, 2011, 6:27 a.m.</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;">Removed need to update each channel driver&#39;s p-&gt;owner-&gt;parent.
Only chan_local that invokes another call needs to have the p-&gt;chan-&gt;parent updated.
</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description  (updated)</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 ast_can_pickup() can pickup the target channel, it also needs to check that the originating parent channel isn&#39;t being picked up from one of the other spawned the calls.

Example dialplan below causes a segfault as ast-hangup removes the same channel as is being picked up.

How to crash it!
  dial 801 from 1 phone.
  from 2 phones simultaneously dial 800.
  result = segfault!

or segfault with 2 dahdi channels:
  dial 803 from 1 phone.
  from 2 phones simultaneously dial *8
  result = segfault!

or NULL objects and orpaned channel
  dial 801 or 802 from 1 phone.
  from 2 phones simultaneously dial *8
  result = an orphaned channel!

exten =&gt; 800,1,NoOp(Local pickup: Pickup through Localchan call)
exten =&gt; 800,n,Dial(Local/824@en-pickup&amp;Local/823@en-pickup)

exten =&gt; 801,1,NoOp(Local pickup debug: Ring Phones) 
exten =&gt; 801,n,Dial(Local/823@en-phone&amp;Local/824@en-phone)

exten =&gt; 802,1,Dial(SIP/gxp-823&amp;SIP/gxp-824)

exten =&gt; 803,1,Dial(DAHDI/33&amp;DAHDI/35)

[en-pickup]
exten =&gt; _[0-9*#]!, 1, PickupChan(Local/${EXTEN}@en-phone)

[en-phone]
exten =&gt; _[0-9*#]!, 1, Dial(SIP/gxp-${EXTEN},20,rwt)</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;">Confirmed no orphaned channels, and no NULL object messages with DAHDI, SIP and LOCALCHAN calls

Example below where parent is updated sucessfully to head caller

    -- Executing [801@phones:1] NoOp(&quot;SIP/snom8929-0000000b&quot;, &quot;Debug Localchan Pickup, Ring Phones&quot;) in new stack
    -- Executing [801@phones:2] Dial(&quot;SIP/snom8929-0000000b&quot;, &quot;Local/823@en_phone&amp;Local/824@en_phone&quot;) in new stack
[2011-08-26 22:09:26.246139] NOTICE[21577]: channel.c:5712 ast_call: ALEC parent=SIP/snom8929-0000000b
    -- Called Local/823@en_phone
    -- Executing [823@en_phone:1] Dial(&quot;Local/823@en_phone-9edc;2&quot;, &quot;SIP/gxp-823,20,rwt&quot;) in new stack
  == Using UDPTL CoS mark 5
  == Using SIP RTP CoS mark 5
[2011-08-26 22:09:26.252722] NOTICE[21577]: channel.c:5712 ast_call: ALEC parent=SIP/snom8929-0000000b
    -- Called Local/824@en_phone
    -- Executing [824@en_phone:1] Dial(&quot;Local/824@en_phone-41b8;2&quot;, &quot;SIP/gxp-824,20,rwt&quot;) in new stack
  == Using UDPTL CoS mark 5
  == Extension Changed 823[phones] new state Ringing for Notify User gxp-823
  == Extension Changed 823[phones] new state Ringing for Notify User gxp-824
  == Extension Changed 823[phones] new state Ringing for Notify User snom8929
  == Using SIP RTP CoS mark 5
[2011-08-26 22:09:26.265837] NOTICE[21578]: channel.c:5712 ast_call: ALEC parent=SIP/snom8929-0000000b
    -- Called SIP/gxp-823
    -- Local/823@en_phone-9edc;1 is ringing
    -- Local/823@en_phone-9edc;1 connected line has changed. Saving it until answer for SIP/snom8929-0000000b
    -- Local/823@en_phone-9edc;1 connected line has changed. Saving it until answer for SIP/snom8929-0000000b
  == Extension Changed 824[phones] new state Ringing for Notify User gxp-823
  == Extension Changed 824[phones] new state Ringing for Notify User gxp-824
  == Extension Changed 824[phones] new state Ringing for Notify User snom8929
[2011-08-26 22:09:26.277966] NOTICE[21579]: channel.c:5712 ast_call: ALEC parent=SIP/snom8929-0000000b
    -- Called SIP/gxp-824
    -- Local/824@en_phone-41b8;1 is ringing
    -- Local/824@en_phone-41b8;1 connected line has changed. Saving it until answer for SIP/snom8929-0000000b
    -- Local/824@en_phone-41b8;1 connected line has changed. Saving it until answer for SIP/snom8929-0000000b
    -- SIP/gxp-823-0000000c is ringing


    -- Executing [800@phones:1] NoOp(&quot;SIP/gxp-824-00000013&quot;, &quot;Debug Localchan pickup&quot;) in new stack
    -- Executing [800@phones:2] Dial(&quot;SIP/gxp-824-00000013&quot;, &quot;Local/824@en_pickup&amp;Local/823@en_pickup&quot;) in new stack
  == Using SIP RTP CoS mark 5
[2011-08-26 22:11:19.238111] NOTICE[21592]: channel.c:5712 ast_call: ALEC parent=SIP/gxp-824-00000013
    -- Called Local/824@en_pickup
  == Extension Changed 823[phones] new state InUse&amp;Ringing for Notify User gxp-823
  == Extension Changed 823[phones] new state InUse&amp;Ringing for Notify User gxp-824
  == Extension Changed 823[phones] new state InUse&amp;Ringing for Notify User snom8929
    -- Executing [824@en_pickup:1] PickupChan(&quot;Local/824@en_pickup-c63b;2&quot;, &quot;Local/824@en_phone&quot;) in new stack
[2011-08-26 22:11:19.248294] NOTICE[21592]: channel.c:5712 ast_call: ALEC parent=SIP/gxp-824-00000013
    -- Called Local/823@en_pickup
    -- Local/824@en_pickup-c63b;1 connected line has changed. Saving it until answer for SIP/gxp-824-00000013
    -- Executing [823@en_pickup:1] PickupChan(&quot;Local/823@en_pickup-7a9f;2&quot;, &quot;Local/823@en_phone&quot;) in new stack
    -- Local/824@en_pickup-c63b;1 answered SIP/gxp-824-00000013
[2011-08-26 22:11:19.250604] NOTICE[21595]: app_directed_pickup.c:375 pickupchan_exec: No target channel found for Local/823@en_phone.
    -- Executing [800@phones:1] NoOp(&quot;SIP/gxp-823-00000014&quot;, &quot;Debug Localchan pickup&quot;) in new stack
    -- Executing [800@phones:2] Dial(&quot;SIP/gxp-823-00000014&quot;, &quot;Local/824@en_pickup&amp;Local/823@en_pickup&quot;) in new stack
    -- Auto fallthrough, channel &#39;Local/823@en_pickup-7a9f;2&#39; status is &#39;UNKNOWN&#39;
[2011-08-26 22:11:19.267860] NOTICE[21594]: channel.c:5712 ast_call: ALEC parent=SIP/gxp-823-00000014
    -- Called Local/824@en_pickup
    -- Executing [824@en_pickup:1] PickupChan(&quot;Local/824@en_pickup-c8ca;2&quot;, &quot;Local/824@en_phone&quot;) in new stack
[2011-08-26 22:11:19.272006] NOTICE[21594]: channel.c:5712 ast_call: ALEC parent=SIP/gxp-823-00000014
    -- Called Local/823@en_pickup
[2011-08-26 22:11:19.274014] NOTICE[21596]: app_directed_pickup.c:375 pickupchan_exec: No target channel found for Local/824@en_phone.
    -- Auto fallthrough, channel &#39;Local/824@en_pickup-c8ca;2&#39; status is &#39;UNKNOWN&#39;
    -- Executing [823@en_pickup:1] PickupChan(&quot;Local/823@en_pickup-dc84;2&quot;, &quot;Local/823@en_phone&quot;) in new stack
[2011-08-26 22:11:19.276514] NOTICE[21597]: app_directed_pickup.c:375 pickupchan_exec: No target channel found for Local/823@en_phone.
    -- Auto fallthrough, channel &#39;Local/823@en_pickup-dc84;2&#39; status is &#39;UNKNOWN&#39;
  == Everyone is busy/congested at this time (2:0/0/2)
    -- Auto fallthrough, channel &#39;SIP/gxp-823-00000014&#39; status is &#39;CHANUNAVAIL&#39;

asterix*CLI&gt; core show channels
Channel              Location             State   Application(Data)
SIP/gxp-824-00000013 800@phones:2         Up      Dial(Local/824@en_pickup&amp;Local
SIP/snom8929-0000001 (None)               Up      AppDial((Outgoing Line))
2 active channels
1 active call
</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/ASTERISK-18222">ASTERISK-18222</a>, 

 <a href="https://issues.asterisk.org/jira/browse/ASTERISK-18273">ASTERISK-18273</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/channels/chan_local.c <span style="color: grey">(333199)</span></li>

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

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

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

</ul>

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




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




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