Don’t stop Record after silence and/or don’t exit from ChanSpy after call hangup.
My dialplan :
[code][check-for-lost-call]
exten => connect,1,Noop(Connect to channel “${check_channel}”)
exten => connect,n,ChanSpy(${check_channel},qoE)
exten => connect,n,Hangup
exten => check,1,Noop(Check channel ${check_channel})
exten => check,n,Record(${file}:wav,120,q)
exten => check,n,System(/usr/local/scripts/asterisk/check_for_lost_call.php disconnect “${check_channel}” “${file}.wav”)
exten => check,n,Hangup
[from-gag-to-pes]
exten => _X.,1,Noop(Call from “${CALLERID(all)}” to “${EXTEN}”)
exten => _X.,n,Set(GROUP()=${CALLERID(num)})
exten => _X.,n,System(/usr/local/scripts/asterisk/check_for_lost_call.php connect “${CHANNEL}”)
exten => _X.,n,Set(route=${FILTER(0123456789,${EXTEN})})
exten => _X.,n,Dial(${ASTBOX}/${route})
exten => _X.,n,Hangup[/code]
check_for_lost_call.php
[code]#!/usr/bin/php -q
<?php $dir_call="/var/spool/asterisk/outgoing/"; $dir_tmp="/var/spool/asterisk/tmp/"; if ($argv[1]=='connect') { $fn=$dir_tmp.str_replace("/","_",$argv[2]); $f = fopen($fn, "w"); fwrite($f, "CallerID: AsteriskPBX\n"); fwrite($f, "Channel: LOCAL/connect@check-for-lost-call\n"); fwrite($f, "Context: check-for-lost-call\nExtension: check\nPriority: 1\n"); fwrite($f, "Set: CHANNEL(language)=ru\n"); fwrite($f, "Set: check_channel=$argv[2]\n"); fwrite($f, "Set: file=$dir_tmp".time()."_".str_replace("/","_",$argv[2])."\n"); fclose($f); rename($fn, $dir_call); } elseif ($argv[1]=='disconnect') { exec("asterisk -rx \"channel request hangup $argv[2]\"",$a); } ?>[/code]My action :
- Make call into “from-gag-to-pes”
- “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”
- End call
In some cases call form “check_for_lost_call.php” not ended after I hangup and in console I see :
CLI> core show channels concise
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
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
I have two question :
- Why Record don’t stop after 120 seconds of silence ?
- Why ChanSpy don’t stop after call hangup ?