[asterisk-bugs] Don't stop Record after silence and/or don't exit from ChanSpy after call hangup.

Alex axonaro at gmail.com
Thu Aug 16 03:37:16 CDT 2012


On forum :
http://forums.asterisk.org/viewtopic.php?f=1&t=83716&p=176695

Don't stop Record after silence and/or don't exit from ChanSpy after call
hangup.

My dialplan :
Code:  <http://forums.asterisk.org/viewtopic.php?f=1&t=83716&p=176695#>
[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

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 at 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);
   }
?>
My action :
1) Make call into "from-gag-to-pes"
2) "check_for_lost_call.php" make callfile and dial to
"LOCAL/connect at check-for-lost-call" and connect with
"check-for-lost-call,check,1"
3) End call

In some cases call form "check_for_lost_call.php" not ended after I hangup
and in console I see :
Code:
<http://forums.asterisk.org/viewtopic.php?f=1&t=83716&p=176695#>CLI> core
show channels concise
Local/connect at 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 at 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 :
1) Why Record don't stop after 120 seconds of silence ?
2) Why ChanSpy don't stop after call hangup ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-bugs/attachments/20120816/d77fad69/attachment-0001.htm>


More information about the asterisk-bugs mailing list