Changeset 13995
- Timestamp:
- 04/24/12 13:45:53 (1 year ago)
- Files:
-
- modules/branches/2.10 (modified) (2 props)
- modules/branches/2.10/cdr/page.cdr.php (modified) (6 diffs)
- modules/branches/2.10/ivr/install.php (modified) (2 diffs)
- modules/branches/2.10/recordings/page.recordings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.10
- Property svn:mergeinfo set to /modules/branches/2.11:13994
- Property svnmerge-integrated changed from /modules/branches/2.11:1-13652 /modules/branches/2.9:1-12787 to /modules/branches/2.11:1-13652,13994 /modules/branches/2.9:1-12787
modules/branches/2.10/cdr/page.cdr.php
r13206 r13995 45 45 $system_monitor_dir = isset($amp_conf['ASTSPOOLDIR'])?$amp_conf['ASTSPOOLDIR']."/monitor":"/var/spool/asterisk/monitor"; 46 46 47 // What format for recordings are set? 48 $sql = "SELECT value FROM globals where variable = 'MIXMON_FORMAT'"; 49 $mixmonformat = $db->getOne($sql); 50 if(DB::IsError($mixmonformat)) { 51 die_freepbx($mixmonformat->getMessage()); 52 } 53 $system_audio_format = $mixmonformat; 54 //$system_audio_format = 'wav'; 47 // if CDRDBHOST and CDRDBTYPE are not empty then we assume an external connection and don't use the default connection 48 // 49 if (!empty($amp_conf["CDRDBHOST"]) && !empty($amp_conf["CDRDBTYPE"])) { 50 $db_hash = array('mysql' => 'mysql', 'postgres' => 'pgsql'); 51 $db_type = $db_hash[$amp_conf["CDRDBTYPE"]]; 52 $db_host = $amp_conf["CDRDBHOST"]; 53 $db_port = empty($amp_conf["CDRDBPORT"]) ? '' : ':' . $amp_conf["CDRDBPORT"]; 54 $db_user = empty($amp_conf["CDRDBUSER"]) ? $amp_conf["AMPDBUSER"] : $amp_conf["CDRDBUSER"]; 55 $db_pass = empty($amp_conf["CDRDBPASS"]) ? $amp_conf["AMPDBPASS"] : $amp_conf["CDRDBPASS"]; 56 $datasource = $db_type . '://' . $db_user . ':' . $db_pass . '@' . $db_host . $db_port . '/' . $db_name; 57 $dbcdr = DB::connect($datasource); // attempt connection 58 if(DB::isError($dbcdr)) { 59 die_freepbx($dbcdr->getDebugInfo()); 60 } 61 } else { 62 $dbcdr = $db; 63 } 64 55 65 $h_step = 30; 56 66 ?> … … 472 482 if ( isset($_POST['need_csv']) && $_POST['need_csv'] == 'true' ) { 473 483 $query = "(SELECT calldate, clid, did, src, dst, dcontext, channel, dstchannel, lastapp, lastdata, duration, billsec, disposition, amaflags, accountcode, uniqueid, userfield FROM $db_name.$db_table_name $where $order $sort LIMIT $result_limit)"; 474 $resultcsv = $db ->getAll($query, DB_FETCHMODE_ASSOC);484 $resultcsv = $dbcdr->getAll($query, DB_FETCHMODE_ASSOC); 475 485 cdr_export_csv($resultcsv); 476 486 } … … 478 488 if ( isset($_POST['need_html']) && $_POST['need_html'] == 'true' ) { 479 489 $query = "SELECT `calldate`, `clid`, `did`, `src`, `dst`, `dcontext`, `channel`, `dstchannel`, `lastapp`, `lastdata`, `duration`, `billsec`, `disposition`, `amaflags`, `accountcode`, `uniqueid`, `userfield`, unix_timestamp(calldate) as `call_timestamp`, `recordingfile` FROM $db_name.$db_table_name $where $order $sort LIMIT $result_limit"; 480 $results = $db ->getAll($query, DB_FETCHMODE_ASSOC);490 $results = $dbcdr->getAll($query, DB_FETCHMODE_ASSOC); 481 491 } 482 492 if ( isset($results) ) { … … 640 650 if ( isset($_POST['need_chart']) && $_POST['need_chart'] == 'true' ) { 641 651 $query2 = "SELECT $group_by_field AS group_by_field, count(*) AS total_calls, sum(duration) AS total_duration FROM $db_name.$db_table_name $where GROUP BY group_by_field ORDER BY group_by_field ASC LIMIT $result_limit"; 642 $result2 = $db ->getAll($query2, DB_FETCHMODE_ASSOC);652 $result2 = $dbcdr->getAll($query2, DB_FETCHMODE_ASSOC); 643 653 644 654 $tot_calls = 0; … … 698 708 /* not date time fields */ 699 709 $query3 = "SELECT $group_by_field AS group_by_field, count(*) AS total_calls, unix_timestamp(calldate) AS ts, duration FROM $db_name.$db_table_name $where GROUP BY group_by_field, unix_timestamp(calldate) ORDER BY group_by_field ASC LIMIT $result_limit"; 700 $result3 = $db ->getAll($query3, DB_FETCHMODE_ASSOC);710 $result3 = $dbcdr->getAll($query3, DB_FETCHMODE_ASSOC); 701 711 $group_by_str = ''; 702 712 foreach($result3 as $row) { … … 724 734 /* data fields */ 725 735 $query3 = "SELECT unix_timestamp(calldate) AS ts, duration FROM $db_name.$db_table_name $where ORDER BY unix_timestamp(calldate) ASC LIMIT $result_limit"; 726 $result3 = $db ->getAll($query3, DB_FETCHMODE_ASSOC);736 $result3 = $dbcdr->getAll($query3, DB_FETCHMODE_ASSOC); 727 737 $group_by_str = ''; 728 738 foreach($result3 as $row) { modules/branches/2.10/ivr/install.php
r13919 r13995 295 295 296 296 //this was installed perviously, but we perfer to use our old table when migrating 297 sql('RENAME TABLE ivr_dests TO ivr_entries'); 298 299 /* 297 300 sql('DROP TABLE ivr_details'); 298 301 sql('RENAME TABLE ivr TO ivr_details'); 299 sql('RENAME TABLE ivr_dests TO ivr_entries');300 302 sql('ALTER TABLE ivr_details 301 303 CHANGE ivr_id id int(11) NOT NULL AUTO_INCREMENT, … … 319 321 DROP enable_directory, 320 322 DROP dircontext'); 323 */ 321 324 325 $ivr_details = sql('SELECT * from ivr', 'getAll', DB_FETCHMODE_ASSOC); 326 $ins_arr = array(); 327 foreach ($ivr_details as $r) { 328 if ($r['name'] == "__install_done") { 329 continue; 330 } 331 $ins_arr[] = array( 332 $r['ivr_id'], // id 333 $r['displayname'], // name 334 $r['announcement_id'], // announcement 335 $r['enable_directdial'], // directdial 336 $r['loops'], // invalid_loops 337 $r['alt_timeout'], // timeout_enabled 338 $r['invalid_id'], // invalid_recording 339 $r['retvm'], // retvm 340 $r['timeout'], // timeout_time 341 $r['timeout_id'], // timeout_recording 342 $r['loops'], // timeout_loops 343 ); 344 } 345 $compiled = $db->prepare(' 346 INSERT INTO ivr_details 347 (id, name, announcement, directdial, invalid_loops, timeout_enabled, invalid_recording, retvm, timeout_time, timeout_recording, timeout_loops) 348 VALUES 349 (?,?,?,?,?,?,?,?,?,?,?) 350 '); 351 $result = $db->executeMultiple($compiled,$ins_arr); 352 if(DB::IsError($result)) { 353 die_freepbx($result->getDebugInfo().'error migrating ivr to ivr_details'); 354 } else { 355 out(_("migrated table ivr to ivr_details")); 356 sql('DROP TABLE ivr'); 357 } 358 359 /* 322 360 sql('DELETE FROM ivr_details WHERE name = "__install_done"'); 323 361 //copy loops from invalid to timeout 324 362 sql('UPDATE ivr_details SET timeout_loops = invalid_loops'); 363 */ 364 325 365 $ivr = $db->getAll('SELECT * FROM ivr_details', DB_FETCHMODE_ASSOC); 326 366 if($db->IsError($ivr)) { modules/branches/2.10/recordings/page.recordings.php
r13091 r13995 211 211 $destfilename = $recordings_save_path.$dest."ivrrecording.".$suffix; 212 212 move_uploaded_file($_FILES['ivrfile']['tmp_name'], $destfilename); 213 system("chgrp asterisk ".$destfilename);213 system("chgrp " . $amp_conf['AMPASTERISKGROUP'] . " " . $destfilename); 214 214 system("chmod g+rw ".$destfilename); 215 215 echo "<h6>"._("Successfully uploaded")." ".$_FILES['ivrfile']['name']."</h6>";
