diff --git a/functions/functions.operator.php b/functions/functions.operator.php index 34652775..2dfcdc90 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -537,6 +537,28 @@ function get_call_number($call_id) return false; } +/** + * Set the extension status in the database + * + * @param int $operator_id The queXS Operator ID + * @param bool the extension status (false for offline, true for online) + * + */ +function set_extension_status($operator_id,$online = true) +{ + global $db; + + $s = 0; + + if ($online) $s = 1; + + $sql = "UPDATE `operator` + SET voip_status = '$s' + WHERE operator_id = '$operator_id'"; + + $db->Execute($sql); +} + /** * Return the extension status from the database * diff --git a/functions/functions.voip.php b/functions/functions.voip.php index 9a4ffefc..761b3c25 100644 --- a/functions/functions.voip.php +++ b/functions/functions.voip.php @@ -433,13 +433,13 @@ class voipWatch extends voip { } - function setExtensionStatus($ext, $online = true) + function setExtensionStatus($ext, $online = true, $msg = false) { global $db; $s = $online ? 1 : 0; - print(T_("Extension") . " $ext " . ($online ? T_("online") : T_("offline")) . "\n"); + if ($msg) print(T_("Extension") . " $ext " . ($online ? T_("online") : T_("offline")) . "\n"); $sql = "UPDATE operator SET voip_status = '$s' @@ -483,9 +483,9 @@ class voipWatch extends voip { $s = $this->getExtensionStatus($e); if ($s == false) - $this->setExtensionStatus($e,false); + $this->setExtensionStatus($e,false,true); else - $this->setExtensionStatus($e,true); + $this->setExtensionStatus($e,true,true); } }