Changeset 12953
- Timestamp:
- 11/12/11 12:57:56 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/branches/2.10/amp_conf/htdocs/recordings/modules/callmonitor.module
r10735 r12953 33 33 */ 34 34 function navMenu($args) { 35 36 $ret .= "<small><small><a href='" . $_SESSION['ARI_ROOT'] . "?m=Callmonitor&f=display'>" . _("Call Monitor") . "</a></small></small>"; 37 38 return $ret; 35 return "<small><small><a href='" . $_SESSION['ARI_ROOT'] . "?m=Callmonitor&f=display'>" . _("Call Monitor") . "</a></small></small>"; 39 36 } 40 37 … … 106 103 global $CALLMONITOR_ALLOW_DELETE; 107 104 global $AJAX_PAGE_REFRESH_ENABLE; 105 global $amp_conf; 106 107 $recording_header = ''; 108 $recording_body = ''; 109 $ret = ''; 110 $controls = ''; 108 111 109 112 $display = new DisplaySearch(); … … 155 158 } 156 159 160 $ari_duration_filter = isset($_COOKIE['ari_duration_filter']) ? $_COOKIE['ari_duration_filter'] : ''; 157 161 $controls .= " 158 162 <small>" . _("duration") . "</small> 159 <input name='duration_filter' type='text' size=4 maxlength=8 value='" . $ _COOKIE['ari_duration_filter']. "'>163 <input name='duration_filter' type='text' size=4 maxlength=8 value='" . $ari_duration_filter . "'> 160 164 <button class='infobar' type='submit' onclick=\"document.callmonitor_form.a.value='ignore'\"> 161 165 " . _("ignore") . " … … 177 181 $fields[4]['field'] = "dst"; 178 182 $fields[4]['text'] = _("Destination"); 179 $fields[5]['field'] = "dcontext"; 180 $fields[5]['text'] = _("Context"); 181 $fields[6]['field'] = "duration"; 182 $fields[6]['text'] = _("Duration"); 183 $fields[5]['field'] = "duration"; 184 $fields[5]['text'] = _("Duration"); 183 185 184 186 $i = 0; 185 while ($fields[$i]) {186 187 $field = $ fields[$i]['field'];188 $text = $ fields[$i]['text'];187 foreach ($fields as $col) { 188 189 $field = $col['field']; 190 $text = $col['text']; 189 191 if ($order==$field) { 190 192 if ($sort=='asc') { … … 207 209 208 210 $unicode_q = urlencode($q); 211 if (!isset($folder)) $folder = ''; 209 212 $recording_header .= "<th><a href=" . $_SESSION['ARI_ROOT'] . "?m=" . $m . "&f=" . $f . "&q=" . $unicode_q . "&folder=" . $folder . "&order=" . $field . "&sort=" . $currentSort . ">" . $text . $arrowImg . "</a></th>"; 210 213 … … 220 223 $i++; 221 224 225 // check if CDR has recording file in it 226 // 227 if ($value['recordingfile']) { 228 $rec_parts = explode('-',$value['recordingfile']); 229 $fyear = substr($rec_parts[3],0,4); 230 $fmonth = substr($rec_parts[3],4,2); 231 $fday = substr($rec_parts[3],6,2); 232 $monitor_base = $amp_conf['MIXMON_DIR'] ? $amp_conf['MIXMON_DIR'] : $amp_conf['ASTSPOOLDIR'] . '/monitor'; 233 $recordingfile = "$monitor_base/$fyear/$fmonth/$fday/" . $value['recordingfile']; 234 if (!file_exists($recordingfile)) { 235 $recordingfile = ''; 236 } 237 } else { 238 $recordingfile = ''; 239 } 240 222 241 // recording file 223 $recording = $recordings[$value['uniqueid'] . $value['calldate']]; 242 // 243 if ($recordingfile) { 244 $recording = $recordingfile; 245 } else { 246 // for legacy systems ... 247 $recording = isset($recordings[$value['uniqueid'] . $value['calldate']]) ? $recordings[$value['uniqueid'] . $value['calldate']] : ''; 248 } 224 249 225 250 // date and time 226 $buf = explode(' ', $value[ calldate]);251 $buf = explode(' ', $value['calldate']); 227 252 $date = $buf[0]; 228 253 $time = $buf[1]; … … 247 272 <td width=70>" . $date . "</td> 248 273 <td>" . $time . "</td> 249 <td>" . $value[clid] . "</td> 250 <td>" . $value[src] . "</td> 251 <td>" . $value[dst] . "</td> 252 <td>" . $value[dcontext] . "</td> 253 <td width=90>" . $value[duration] . " sec</td> 274 <td>" . $value['clid'] . "</td> 275 <td>" . $value['src'] . "</td> 276 <td>" . $value['dst'] . "</td> 277 <td width=90>" . $value['duration'] . " sec</td> 254 278 <td>" . $recordingLink . " " . $downloadLink . "</td> 255 279 </tr>"; … … 407 431 } 408 432 409 $files = array(); 410 if (!$CALLMONITOR_ONLY_EXACT_MATCHING) { 411 $filter = ''; 412 $recursiveMax = 6; 413 $recursiveCount = 0; 414 foreach($paths as $key => $path) { 415 $path_files = getFiles($path,$filter,$recursiveMax,$recursiveCount); 416 if ($path_files) { 417 $files = array_merge($files,$path_files); 418 } 419 } 420 rsort($files); 421 } 433 // Once we've done the heavy lifting of searching for all file 434 // we don't need to do it again, if there are new recordings 435 // they will be found through the DB and a call to here 436 // won't be needed 437 // 438 if (isset($_SESSION['ari_user']['recordings_files'])) { 439 $files = $_SESSION['ari_user']['recordings_files']; 440 } else { 441 $files = array(); 442 if (!$CALLMONITOR_ONLY_EXACT_MATCHING) { 443 $filter = ''; 444 $recursiveMax = 6; 445 $recursiveCount = 0; 446 foreach($paths as $key => $path) { 447 $path_files = getFiles($path,$filter,$recursiveMax,$recursiveCount); 448 if ($path_files) { 449 $files = array_merge($files,$path_files); 450 } 451 } 452 rsort($files); 453 } 454 $_SESSION['ari_user']['recordings_files'] = $files; 455 } 422 456 423 457 if (is_array($data)) foreach($data as $data_key => $data_value) { … … 515 549 516 550 foreach($files as $key => $path) { 517 list($path,$filetype) = explode(".",$path,2); 551 $tmp_arr = explode(".",$path,2); 552 $path = $tmp_arr[0]; 553 $filetype = isset($tmp_arr[1]) ? $tmp_arr[1] : ''; 518 554 $parts = explode("-", $path); 519 555 if ((strlen($st)>1 && strpos($path,$st)!==FALSE && strlen($uniqueid)<=1) || … … 600 636 OR dst regexp '" . $tok . "' 601 637 OR dstchannel regexp '" . $tok . "' 602 OR dcontext regexp '" . $tok . "'603 638 OR duration regexp '" . $tok . "' 604 639 OR disposition regexp '" . $tok . "' … … 626 661 // admin 627 662 if (!$_SESSION['ari_user']['admin_callmonitor']) { 628 if ( !$searchText) {629 $searchText .= "WHERE ";663 if (empty($searchText)) { 664 $searchText = "WHERE "; 630 665 } else { 631 666 $searchText .= "AND ";
