On forum :<br><a href="http://forums.asterisk.org/viewtopic.php?f=1&amp;t=83716&amp;p=176695">http://forums.asterisk.org/viewtopic.php?f=1&amp;t=83716&amp;p=176695</a><br><br>Don&#39;t stop Record after silence and/or don&#39;t exit from ChanSpy after call hangup.<br>
<br>My dialplan :<br><dl class="codebox"><dt>Code: <a href="http://forums.asterisk.org/viewtopic.php?f=1&amp;t=83716&amp;p=176695#"></a></dt><dd><code>[check-for-lost-call]<br>exten =&gt; connect,1,Noop(Connect to channel &quot;${check_channel}&quot;)<br>
exten =&gt; connect,n,ChanSpy(${check_channel},qoE)<br>exten =&gt; connect,n,Hangup<br>exten =&gt; check,1,Noop(Check channel ${check_channel})<br>exten =&gt; check,n,Record(${file}:wav,120,,q)<br>exten =&gt; check,n,System(/usr/local/scripts/asterisk/check_for_lost_call.php disconnect &quot;${check_channel}&quot; &quot;${file}.wav&quot;)<br>
exten =&gt; check,n,Hangup<br><br>[from-gag-to-pes]<br>exten =&gt; _X.,1,Noop(Call from &quot;${CALLERID(all)}&quot; to &quot;${EXTEN}&quot;)<br>exten =&gt; _X.,n,Set(GROUP()=${CALLERID(num)})<br>exten =&gt; _X.,n,System(/usr/local/scripts/asterisk/check_for_lost_call.php connect &quot;${CHANNEL}&quot;)<br>
exten =&gt; _X.,n,Set(route=${FILTER(0123456789,${EXTEN})})<br>exten =&gt; _X.,n,Dial(${ASTBOX}/${route})<br>exten =&gt; _X.,n,Hangup</code></dd></dl><br><br>check_for_lost_call.php<br><dl class="codebox"><dt>Code: </dt><dd>
<code>#!/usr/bin/php -q<br>&lt;?php<br>$dir_call=&quot;/var/spool/asterisk/outgoing/&quot;;<br>$dir_tmp=&quot;/var/spool/asterisk/tmp/&quot;;<br><br>if ($argv[1]==&#39;connect&#39;) {<br>   $fn=$dir_tmp.str_replace(&quot;/&quot;,&quot;_&quot;,$argv[2]);<br>
   $f = fopen($fn, &quot;w&quot;);<br><br>   fwrite($f, &quot;CallerID: AsteriskPBX\n&quot;);<br>   fwrite($f, &quot;Channel: LOCAL/connect@check-for-lost-call\n&quot;);<br>   fwrite($f, &quot;Context: check-for-lost-call\nExtension: check\nPriority: 1\n&quot;);<br>
   fwrite($f, &quot;Set: CHANNEL(language)=ru\n&quot;);<br>   fwrite($f, &quot;Set: check_channel=$argv[2]\n&quot;);<br>   fwrite($f, &quot;Set: file=$dir_tmp&quot;.time().&quot;_&quot;.str_replace(&quot;/&quot;,&quot;_&quot;,$argv[2]).&quot;\n&quot;);<br>
   fclose($f);<br><br>   rename($fn, $dir_call);<br>} elseif ($argv[1]==&#39;disconnect&#39;) {<br>   exec(&quot;asterisk -rx \&quot;channel request hangup $argv[2]\&quot;&quot;,$a);<br>   }<br>?&gt;</code></dd></dl><br>My action :<br>
1) Make call into &quot;from-gag-to-pes&quot;<br>2)
 &quot;check_for_lost_call.php&quot; make callfile and dial to 
&quot;LOCAL/connect@check-for-lost-call&quot; and connect with 
&quot;check-for-lost-call,check,1&quot;<br>3) End call<br><br>In some cases call form &quot;check_for_lost_call.php&quot; not ended after I hangup and in console I see :<br><dl class="codebox"><dt>Code:<a href="http://forums.asterisk.org/viewtopic.php?f=1&amp;t=83716&amp;p=176695#"><br>
</a></dt><dd><code>CLI&gt; core show channels concise<br>Local/connect@check-for-lost-call-6777;1!check-for-lost-call!check!2!Up!Record!/var/spool/asterisk/tmp/1343889635_SIP_office-gag-0000064f:wav,120,,q!!!!3!16207!(None)!1343889635.5470<br>
Local/connect@check-for-lost-call-6777;2!check-for-lost-call!connect!2!Up!ChanSpy!SIP/office-gag-0000064f,qoS!!!!3!16207!(None)!1343889635.5471</code></dd></dl><br><br>I have two question :<br>1) Why Record don&#39;t stop after 120 seconds of silence ?<br>
2) Why ChanSpy don&#39;t stop after call hangup ?<br>