mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-03-27 18:55:42 +00:00
Reload music on hold when there is changes. The module will not reload if there is someone actively listening to music on hold at that time.
This commit is contained in:
@@ -180,6 +180,11 @@ if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['upload_file']['t
|
||||
fwrite($fout, $file_contents);
|
||||
fclose($fout);
|
||||
|
||||
//reload the module
|
||||
require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php";
|
||||
$moh = new switch_music_on_hold;
|
||||
$moh->reload();
|
||||
|
||||
//set an upload message
|
||||
$save_msg = "Uploaded file to ".$target_dir."/".htmlentities($_FILES['upload_file']['name']);
|
||||
}
|
||||
|
||||
@@ -85,6 +85,21 @@ include "root.php";
|
||||
return $select;
|
||||
}
|
||||
|
||||
public function reload() {
|
||||
//if the handle does not exist create it
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
//if the handle still does not exist show an error message
|
||||
if (!$fp) {
|
||||
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
|
||||
}
|
||||
//send the api command to check if the module exists
|
||||
if ($fp) {
|
||||
$cmd = "reload mod_local_stream";
|
||||
$switch_result = event_socket_request($fp, 'api '.$cmd);
|
||||
unset($cmd);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php";
|
||||
|
||||
Reference in New Issue
Block a user