mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Set VoipWatch to auto reconnect when disconnected
Will not automatically refresh Voip Watch page (can just click on link to reload)
This commit is contained in:
@@ -70,7 +70,7 @@ if ($p)
|
|||||||
kill_process($p);
|
kill_process($p);
|
||||||
}
|
}
|
||||||
|
|
||||||
xhtml_head(T_("Monitor VoIP Process"),true,false,false,false,10,true);
|
xhtml_head(T_("Monitor VoIP Process"),true,false,false,false,false,true);
|
||||||
|
|
||||||
print "<h1>" . T_("Running process:") . " $p</h1>";
|
print "<h1>" . T_("Running process:") . " $p</h1>";
|
||||||
|
|
||||||
|
|||||||
@@ -52,8 +52,11 @@ class voip {
|
|||||||
*/
|
*/
|
||||||
function __destruct() {
|
function __destruct() {
|
||||||
//close the socket
|
//close the socket
|
||||||
fclose($this->socket);
|
if ($this->socket !== false)
|
||||||
$this->socket = false;
|
{
|
||||||
|
fclose($this->socket);
|
||||||
|
$this->socket = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -318,8 +321,8 @@ class voip {
|
|||||||
$this->socket = fsockopen($ip,VOIP_PORT,$errno,$errstr,1);
|
$this->socket = fsockopen($ip,VOIP_PORT,$errno,$errstr,1);
|
||||||
if (!$this->socket)
|
if (!$this->socket)
|
||||||
{
|
{
|
||||||
print "$errno: $errstr";
|
//print "$errno: $errstr";
|
||||||
exit();
|
//exit();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,6 +468,12 @@ class voipWatch extends voip {
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
if (!$this->isConnected() || $this->socket === false){
|
||||||
|
print(T_("Disconnected") . "\n");
|
||||||
|
$this->connect(VOIP_SERVER,VOIP_ADMIN_USER,VOIP_ADMIN_PASS,true);
|
||||||
|
if ($this->isConnected()) print (T_("Reconnected") . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
$in = fgets($this->socket, 4096);
|
$in = fgets($this->socket, 4096);
|
||||||
|
|
||||||
//print "IN: $in\n";
|
//print "IN: $in\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user