mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Event socket bug fix and more docs (#6823)
* Add documentation to methods. Use is_resource for added type detection * Allow connect to specify timeout in microseconds with default 30,000 * Update calling mechanism for event sockets * Update project for new singleton event sockets * remove unused variable * catch errors on closing the socket
This commit is contained in:
@@ -595,10 +595,10 @@
|
||||
|
||||
//send the message waiting status
|
||||
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$switch_cmd = "luarun app.lua voicemail mwi ".$this->voicemail_id."@".$_SESSION['domain_name'];
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,7 +843,7 @@
|
||||
* range download method (helps safari play audio sources)
|
||||
*/
|
||||
private function range_download($file) {
|
||||
$fp = @fopen($file, 'rb');
|
||||
$esl = @fopen($file, 'rb');
|
||||
|
||||
$size = filesize($file); // File size
|
||||
$length = $size; // Content length
|
||||
@@ -909,7 +909,7 @@
|
||||
$start = $c_start;
|
||||
$end = $c_end;
|
||||
$length = $end - $start + 1; // Calculate new content length
|
||||
fseek($fp, $start);
|
||||
fseek($esl, $start);
|
||||
header('HTTP/1.1 206 Partial Content');
|
||||
}
|
||||
// Notify the client the byte range we'll be outputting
|
||||
@@ -918,14 +918,14 @@
|
||||
|
||||
// Start buffered download
|
||||
$buffer = 1024 * 8;
|
||||
while(!feof($fp) && ($p = ftell($fp)) <= $end) {
|
||||
while(!feof($esl) && ($p = ftell($esl)) <= $end) {
|
||||
if ($p + $buffer > $end) {
|
||||
// In case we're only outputtin a chunk, make sure we don't
|
||||
// read past the length
|
||||
$buffer = $end - $p + 1;
|
||||
}
|
||||
set_time_limit(0); // Reset time limit for big files
|
||||
echo fread($fp, $buffer);
|
||||
echo fread($esl, $buffer);
|
||||
flush(); // Free up memory. Otherwise large files will trigger PHP's memory limit.
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user