On forum :<br><a href="http://forums.asterisk.org/viewtopic.php?f=1&t=83716&p=176695">http://forums.asterisk.org/viewtopic.php?f=1&t=83716&p=176695</a><br><br>Don't stop Record after silence and/or don'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&t=83716&p=176695#"></a></dt><dd><code>[check-for-lost-call]<br>exten => connect,1,Noop(Connect to channel "${check_channel}")<br>
exten => connect,n,ChanSpy(${check_channel},qoE)<br>exten => connect,n,Hangup<br>exten => check,1,Noop(Check channel ${check_channel})<br>exten => check,n,Record(${file}:wav,120,,q)<br>exten => check,n,System(/usr/local/scripts/asterisk/check_for_lost_call.php disconnect "${check_channel}" "${file}.wav")<br>
exten => check,n,Hangup<br><br>[from-gag-to-pes]<br>exten => _X.,1,Noop(Call from "${CALLERID(all)}" to "${EXTEN}")<br>exten => _X.,n,Set(GROUP()=${CALLERID(num)})<br>exten => _X.,n,System(/usr/local/scripts/asterisk/check_for_lost_call.php connect "${CHANNEL}")<br>
exten => _X.,n,Set(route=${FILTER(0123456789,${EXTEN})})<br>exten => _X.,n,Dial(${ASTBOX}/${route})<br>exten => _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><?php<br>$dir_call="/var/spool/asterisk/outgoing/";<br>$dir_tmp="/var/spool/asterisk/tmp/";<br><br>if ($argv[1]=='connect') {<br> $fn=$dir_tmp.str_replace("/","_",$argv[2]);<br>
$f = fopen($fn, "w");<br><br> fwrite($f, "CallerID: AsteriskPBX\n");<br> fwrite($f, "Channel: LOCAL/connect@check-for-lost-call\n");<br> fwrite($f, "Context: check-for-lost-call\nExtension: check\nPriority: 1\n");<br>
fwrite($f, "Set: CHANNEL(language)=ru\n");<br> fwrite($f, "Set: check_channel=$argv[2]\n");<br> fwrite($f, "Set: file=$dir_tmp".time()."_".str_replace("/","_",$argv[2])."\n");<br>
fclose($f);<br><br> rename($fn, $dir_call);<br>} elseif ($argv[1]=='disconnect') {<br> exec("asterisk -rx \"channel request hangup $argv[2]\"",$a);<br> }<br>?></code></dd></dl><br>My action :<br>
1) Make call into "from-gag-to-pes"<br>2)
"check_for_lost_call.php" make callfile and dial to
"LOCAL/connect@check-for-lost-call" and connect with
"check-for-lost-call,check,1"<br>3) End call<br><br>In some cases call form "check_for_lost_call.php" 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&t=83716&p=176695#"><br>
</a></dt><dd><code>CLI> 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't stop after 120 seconds of silence ?<br>
2) Why ChanSpy don't stop after call hangup ?<br>