autohotkey php,Autohotkey+php实现免浏览器听录音
環境說明:
Elastix 2.5
ln -s /var/spool/asterisk/monitor /var/www/html/
接口文件(php):
$con=mysql_connect("localhost","root","passwd");
if(!$con) echo "沒有連接成功!";
mysql_select_db("asteriskcdrdb", $con);
mysql_query("SET NAMES UTF8");
if(isset($_GET["phone"])){
$phone=$_GET["phone"];
if(isset($_GET["date"])){
$calldate=$_GET["date"];
$q = "SELECT * FROM `cdr` WHERE `dst`='$phone' and cast(`calldate` as date)='$calldate' order by `calldate` desc limit 100"; //此處注意dst和src
}else{
$q = "SELECT * FROM `cdr` WHERE `dst`='$phone' order by `calldate` desc limit 100";
}
$result = mysql_query($q, $con);
if(mysql_num_rows($result)>0){
while($obj=mysql_fetch_object($result)){
$obj->src;
$obj->dst;
$obj->channel;
$obj->billsec;
$obj->calldate;
$recordingfile = $obj->recordingfile;
if($recordingfile){
$a = explode("-",$recordingfile);;
$subdir = substr($a[3],0,4)."/".substr($a[3],4,2)."/".substr($a[3],6,2);
$uri = "/monitor/$subdir/$recordingfile";
}else{
$uri='';
}
echo $obj->src.",".$obj->dst.",".$obj->channel.",".$obj->dstchannel.",".$obj->disposition.",".$obj->billsec.",".$obj->calldate.",".$uri."\n";
}
}
}
mysql_free_result($result);
mysql_close($con);
?>
客戶端程序(Autohotkey):
FileCreateDir, %A_ScriptDir%\sox
FileCreateDir, c:\temp\
FileInstall, libgomp-1.dll, %A_ScriptDir%\sox\libgomp-1.dll
FileInstall, pthreadgc2.dll, %A_ScriptDir%\sox\pthreadgc2.dll
FileInstall, sox.exe, %A_ScriptDir%\sox\sox.exe
FileInstall, zlib1.dll, %A_ScriptDir%\sox\zlib1.dll
gui, Add, text, x0 y0 w60 h20, 號碼
gui, Add, edit, x60 y0 w140 h20 vphone,
Gui, Add, Checkbox, x200 y0 w100 h20 vcd, 呼叫時間
Gui, add, DateTime, x300 y0 w200 h20 vdate,
Gui, Add, Button, x500 y0 w100 h20 Default gsearch, 查詢
Gui, Add, Button, x600 y0 w100 h20 glisten, 聽取所選
gui, add, ListView, x0 y20 w700 h300, 被叫|主叫|通道|目標通道|狀態|通話時長|呼叫時間|錄音鏈接
Gui, Add, ActiveX, x0 w700 h100 vwmp, {6BF52A52-394A-11D3-B153-00C04F79FAA6}
gui, show, , 本地呼叫系統錄音聽取
GuiControl, , cd, 1
wmp.Settings.Volume := 100
return
search:
Gui, Submit, NoHide
if cd=1
{
FormatTime, calldate, % date, yyyy-MM-dd
search_url := "http://192.168.1.2/monitor.php?phone=" phone "&date=" calldate
}
else
search_url := "http://192.168.1.2/monitor.php?phone=" phone
result := URLDownloadToVar(search_url)
LV_Delete()
loop, Parse, result, `n, `r
{
obj := StrSplit(A_LoopField,",")
LV_Add("",obj*)
}
LV_ModifyCol()
return
listen:
FocusedRowNumber := LV_GetNext(0, "F")
if not FocusedRowNumber
{
MsgBox, 4144, 提示, 您未選擇任何一條記錄!
Return
}
LV_GetText(uri, FocusedRowNumber, 8)
if uri
{
url := "http://192.168.1.2" uri
if RegExMatch(uri,".*/(.*)\.gsm$",m)
{
URLDownloadToFile, % url, % "c:\temp\" m1 ".gsm"
RunWait, %A_ScriptDir%\sox\sox.exe c:\temp\%m1%.gsm c:\temp\%m1%.wav rate -v, , hide
}
else
{
RegExMatch(uri,".*/(.*)\.wav$",m)
URLDownloadToFile, % url, % "c:\temp\" m1 ".wav"
}
wmp.Url := "c:\temp\" m1 ".wav"
}
else
MsgBox, 64, 提示, 錄音鏈接不存在!
return
GuiClose:
ExitApp
總結
以上是生活随笔為你收集整理的autohotkey php,Autohotkey+php实现免浏览器听录音的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 金花茯砖茶的功效与作用、禁忌和食用方法
- 下一篇: 晓蜜瓜的功效与作用、禁忌和食用方法