getfile and convo gen
getfile and convo gen

<?php <?php
include('common.inc.php'); include('common.inc.php');
$sth = $conn->prepare( 'select * from recordings limit 100;'); $sth = $conn->prepare( 'select * from recordings limit 100;');
   
$sth->execute( ); $sth->execute( );
$recordings = $sth->fetchAll(); $recordings = $sth->fetchAll();
$convos = Array(); $convos = Array();
$convo = Array(); $convo = Array();
foreach ($recordings as $i => $recording) { foreach ($recordings as $i => $recording) {
   
if (count($convo) > 0 && strcasecmp($convo[count($convos)]['tgid'], $recording['tgid']) != 0) { if (count($convo) > 0) {
  echo "<br> ".strcasecmp($convos[count($convos)-1][0]['call_timestamp'],$recording['call_timestamp']);
  if (abs(strcasecmp($convos[count($convos)-1][0]['call_timestamp'],$recording['call_timestamp'])) > 2) {
  echo " ".$convos[count($convos)-1][0]['call_timestamp']." ".$recording['call_timestamp'];
  }
  if (strcasecmp($convos[count($convos)-1][0]['tgid'], $recording['tgid']) != 0 ) {
$convos[] = $convo; $convos[] = $convo;
$convo = Array(); $convo = Array();
  }
} ; } ;
//print_r($recording); //print_r($recording);
$convo[] = $recording; $convo[] = $recording;
//print_r($convo); //print_r($convo);
echo "<br>\n"; //echo "<br>\n";
} }
foreach ($convos as $i => $convo) { foreach ($convos as $i => $convo) {
print_r($convo); foreach($convo as $recording) {
echo "<br>\n"; echo $recording['filename']." , ";
  }
  echo "<br><hr>\n";
} }
?> ?>
   
   
file:b/getfile.php (new)
  <?php
  $reqfile = "path/to/file.3gp";
  $contenttype="audio/3gpp";
 
  if($fn=fopen($reqfile, "rba")){
  header("Content-Type: ".$contenttype);
  header("Content-Length: ".filesize($reqfile));
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  header("Pragma: no-cache");
  header("Expires: Mon, 26 Jul 1997 06:00:00 GMT");
  header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0");
  passthru("ffmpeg -i 2012-09-29-1348911268.34-demo.wav -ar 8000 -ab 4.75k -");
  fpassthru($fn);
  fclose($fn);
  }else{
  exit("error....");
  }
  exit();
  ?>