by sohaib » Wed May 23, 2012 10:23 am
Hi everyone,
I was facing issue while download recording from vicidial search for lead option, the problem was if the lead set get deleted we couldn't search recording for the numbers which got deleted with the lead set. So, i was searching for the option which extract recording directly from recording_log table from database.
So, i wanted to share it with everyone, this is my first development with vicidial, please share your comment regarding my work
html and php code are below:
----------------------------
HTML PAGE:
=========================
<html>
<body>
<table align='center'>
<tr>
<td><h1>Search Your Recording</h1></td>
</tr>
<title>Recording Search</title>
</br>
</br>
<table bgcolor='0099ff' align='center' border='1'>
<tr>
<form action='search.php'>
<td>Enter Recording Number<input type='text' name='filename' /> </td>
<td>
Select Month <select name='month'>
<option value='01'>Jan</option>
<option value='02'>Feb</option>
<option value='03'>Mar</option>
<option value='04'>Apr</option>
<option value='05'>May</option>
<option value='06'>Jun</option>
<option value='07'>Jul</option>
<option value='08'>Aug</option>
<option value='09'>Sep</option>
<option value='10'>Oct</option>
<option value='11'>Nov</option>
<option value='12'>Dec</option>
</select>
Select Year<select name='year'>
<!--<option value='2011'>2011</option>-->
<option value='2012'>2012</option>
</select>
</td>
</tr>
<tr>
<td colspan='2' align='center'> <input type='submit' name='search' /> </td>
</tr>
</form>
</table>
</br>
</br>
</br>
</br>
</br>
</br>
<table align='center'>
<tr><td><i style='color:666666'>
<p align='center'>Created By Sohaib Khan</p>
<p align='center'>In case of any issue, please email to <a href='mailto:mk.sohaib@gmail.com'>Sohaib Khan</a></p>
</i></td></tr>
</table>
</body>
</html>
---------------------------------------
============================
PhP code
-----------------------------------
<?php
//getting Variable from html
$num=$_GET["filename"];
$mon=$_GET["month"];
$year=$_GET["year"];
//connecting to my sql
$con=mysql_connect("192.168.0.22","cron","ess1234");
if (!$con)
{
die('could not connect: ' .mysql_error());
}
else
//echo $num;
//echo "</br>";
//concatenation both year and month to find recording
$ym = $year.$mon;
//echo $ym;
if ($num == "")
{
echo "You have not entered any number, please go back and enter any number";
echo "</br>";
echo "<a href=http://192.168.0.18/rec/index.html>Go Back </a>";
}
else
//selecting Database
{
mysql_select_db("asterisk_old", $con);
$qr = "select location,filename from recording_log where filename like '$ym%$num%'";
//echo $qr;
$result = mysql_query($qr);
$num_rows = mysql_num_rows($result);
if ($num_rows == 0)
{
echo "No Result Found";
echo "</br>";
echo "<a href=http://192.168.0.18/rec/index.html>Go Back </a>";
}
else
{
while ($row=mysql_fetch_array($result))
{
echo "<table>";
echo "<tr>";
echo "<td>";
echo "<a href=".$row['location'].">".$row['filename']."</a>";
echo "</td></tr></table>";
echo "<br />";
}
echo "<a href='http://192.168.0.18/rec'>Search another recording</a>";
}
}
?>