Compare commits
9
Commits
e2af2c34c9
...
v1.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0948a8da24 | ||
|
|
c5eb849095 | ||
|
|
1d09f06dc2 | ||
|
|
54fe591355 | ||
|
|
7ccb2189e7 | ||
|
|
9c1e705b13 | ||
|
|
c638f14c06 | ||
|
|
e8c25309e3 | ||
|
|
e6540c866b |
No files matched your search
+9
-5
@@ -61,7 +61,8 @@ apt-get install -y --no-install-recommends \
|
|||||||
acl \
|
acl \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
rsync \
|
rsync \
|
||||||
sox
|
sox \
|
||||||
|
sshpass
|
||||||
|
|
||||||
# Vérification et installation d'Asterisk
|
# Vérification et installation d'Asterisk
|
||||||
echo -e "${C_GREEN} -> Installation du moteur Asterisk PBX...${C_RESET}"
|
echo -e "${C_GREEN} -> Installation du moteur Asterisk PBX...${C_RESET}"
|
||||||
@@ -141,6 +142,7 @@ else
|
|||||||
echo " -> Clonage du dépôt public officiel depuis https://git.sorcier-research.com..."
|
echo " -> Clonage du dépôt public officiel depuis https://git.sorcier-research.com..."
|
||||||
rm -rf "$TARGET_DIR"
|
rm -rf "$TARGET_DIR"
|
||||||
git clone https://git.sorcier-research.com/sorcier/NexusPBX.git "$TARGET_DIR"
|
git clone https://git.sorcier-research.com/sorcier/NexusPBX.git "$TARGET_DIR"
|
||||||
|
git config --system --add safe.directory "$TARGET_DIR" 2>/dev/null || true
|
||||||
cd "$TARGET_DIR"
|
cd "$TARGET_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -187,18 +189,19 @@ setfacl -R -d -m u:www-data:rwx,g:asterisk:rwx /etc/asterisk /var/lib/asterisk/s
|
|||||||
# Droits sudoers pour l'interface web (www-data)
|
# Droits sudoers pour l'interface web (www-data)
|
||||||
cat << 'EOF' > /etc/sudoers.d/nexus-pbx
|
cat << 'EOF' > /etc/sudoers.d/nexus-pbx
|
||||||
# Privilèges spécifiques NexusPBX pour l'utilisateur Web www-data
|
# Privilèges spécifiques NexusPBX pour l'utilisateur Web www-data
|
||||||
www-data ALL=(ALL) NOPASSWD: /usr/sbin/asterisk, /usr/sbin/nginx, /usr/bin/systemctl, /usr/bin/fail2ban-client, /bin/fail2ban-client, /var/www/nexus-pbx/scripts/nexus-firewall, /usr/bin/certbot, /usr/sbin/nft, /usr/sbin/iptables
|
www-data ALL=(ALL) NOPASSWD: /usr/sbin/asterisk, /usr/sbin/nginx, /usr/bin/systemctl, /usr/bin/fail2ban-client, /bin/fail2ban-client, /var/www/nexus-pbx/scripts/nexus-firewall, /usr/bin/certbot, /usr/sbin/nft, /usr/sbin/iptables, /var/www/nexus-pbx/scripts/update.sh, /usr/local/bin/nexus-update
|
||||||
EOF
|
EOF
|
||||||
chmod 0440 /etc/sudoers.d/nexus-pbx
|
chmod 0440 /etc/sudoers.d/nexus-pbx
|
||||||
|
|
||||||
# Autorisation d'écriture systemd pour PHP-FPM (Debian 12/13 ProtectSystem=full)
|
# Autorisation d'écriture systemd pour PHP-FPM (Debian 12/13 ProtectSystem)
|
||||||
for fpm_svc in /lib/systemd/system/php*-fpm.service /usr/lib/systemd/system/php*-fpm.service; do
|
for fpm_svc in /lib/systemd/system/php*-fpm.service /usr/lib/systemd/system/php*-fpm.service; do
|
||||||
if [ -f "$fpm_svc" ]; then
|
if [ -f "$fpm_svc" ]; then
|
||||||
svc_name=$(basename "$fpm_svc")
|
svc_name=$(basename "$fpm_svc")
|
||||||
mkdir -p "/etc/systemd/system/${svc_name}.d"
|
mkdir -p "/etc/systemd/system/${svc_name}.d"
|
||||||
cat << 'EOF_OVERRIDE' > "/etc/systemd/system/${svc_name}.d/override.conf"
|
cat << 'EOF_OVERRIDE' > "/etc/systemd/system/${svc_name}.d/override.conf"
|
||||||
[Service]
|
[Service]
|
||||||
ReadWritePaths=/etc/asterisk /etc/fail2ban /etc/nginx /var/log /var/lib/asterisk /var/spool/asterisk
|
ProtectSystem=false
|
||||||
|
ReadWritePaths=/etc/asterisk /etc/fail2ban /etc/nginx /var/log /var/lib/asterisk /var/spool/asterisk /var/www /usr/local/bin /etc/sudoers.d
|
||||||
EOF_OVERRIDE
|
EOF_OVERRIDE
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -425,9 +428,10 @@ chmod 0644 /etc/cron.d/nexus-backup
|
|||||||
touch /var/log/nexus_backup.log && chown www-data:asterisk /var/log/nexus_backup.log && chmod 664 /var/log/nexus_backup.log
|
touch /var/log/nexus_backup.log && chown www-data:asterisk /var/log/nexus_backup.log && chmod 664 /var/log/nexus_backup.log
|
||||||
|
|
||||||
# CLI symlinks
|
# CLI symlinks
|
||||||
chmod +x "$TARGET_DIR/scripts/nexus-firewall" "$TARGET_DIR/scripts/nexus-banner.sh"
|
chmod +x "$TARGET_DIR/scripts/nexus-firewall" "$TARGET_DIR/scripts/nexus-banner.sh" "$TARGET_DIR/scripts/update.sh"
|
||||||
ln -sf "$TARGET_DIR/scripts/nexus-firewall" /usr/local/bin/nexus-firewall
|
ln -sf "$TARGET_DIR/scripts/nexus-firewall" /usr/local/bin/nexus-firewall
|
||||||
ln -sf "$TARGET_DIR/scripts/nexus-banner.sh" /usr/local/bin/nexus-banner
|
ln -sf "$TARGET_DIR/scripts/nexus-banner.sh" /usr/local/bin/nexus-banner
|
||||||
|
ln -sf "$TARGET_DIR/scripts/update.sh" /usr/local/bin/nexus-update
|
||||||
|
|
||||||
# Bannière interactive lors de chaque connexion terminal (SSH / Console)
|
# Bannière interactive lors de chaque connexion terminal (SSH / Console)
|
||||||
cat << 'EOF' > /etc/profile.d/nexus-motd.sh
|
cat << 'EOF' > /etc/profile.d/nexus-motd.sh
|
||||||
|
|||||||
+46
-14
@@ -136,8 +136,15 @@ try {
|
|||||||
$settings['local_networks'] = [$settings['local_net']];
|
$settings['local_networks'] = [$settings['local_net']];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$appDir = dirname(__DIR__);
|
||||||
|
$installedVerData = file_exists("{$appDir}/version.json")
|
||||||
|
? json_decode((string)file_get_contents("{$appDir}/version.json"), true)
|
||||||
|
: [];
|
||||||
|
$installedVer = $installedVerData['version'] ?? '1.4.0';
|
||||||
|
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
|
'version' => $installedVer,
|
||||||
'user' => Auth::getUsername(),
|
'user' => Auth::getUsername(),
|
||||||
'settings' => $settings,
|
'settings' => $settings,
|
||||||
'extensions' => $extensions,
|
'extensions' => $extensions,
|
||||||
@@ -1126,7 +1133,7 @@ try {
|
|||||||
$inband_progress = (int)!empty($payload['inband_progress']);
|
$inband_progress = (int)!empty($payload['inband_progress']);
|
||||||
$match_ips = trim((string)($payload['match_ips'] ?? ''));
|
$match_ips = trim((string)($payload['match_ips'] ?? ''));
|
||||||
$context = preg_replace('/[^a-zA-Z0-9_\-]/', '', trim((string)($payload['context'] ?? 'from-external'))) ?: 'from-external';
|
$context = preg_replace('/[^a-zA-Z0-9_\-]/', '', trim((string)($payload['context'] ?? 'from-external'))) ?: 'from-external';
|
||||||
$inbound_dest = trim((string)($payload['inbound_dest'] ?? 'ivr-accueil')) ?: 'hangup';
|
$inbound_dest = trim((string)($payload['inbound_dest'] ?? 'terminate-hangup')) ?: 'terminate-hangup';
|
||||||
$outbound_prefix = preg_replace('/[^0-9*#X._\[\]\-+]/', '', trim((string)($payload['outbound_prefix'] ?? '')));
|
$outbound_prefix = preg_replace('/[^0-9*#X._\[\]\-+]/', '', trim((string)($payload['outbound_prefix'] ?? '')));
|
||||||
$custom_endpoint_params = trim((string)($payload['custom_endpoint_params'] ?? ''));
|
$custom_endpoint_params = trim((string)($payload['custom_endpoint_params'] ?? ''));
|
||||||
$custom_reg_params = trim((string)($payload['custom_reg_params'] ?? ''));
|
$custom_reg_params = trim((string)($payload['custom_reg_params'] ?? ''));
|
||||||
@@ -2233,32 +2240,52 @@ try {
|
|||||||
|
|
||||||
case 'check_update':
|
case 'check_update':
|
||||||
$appDir = dirname(__DIR__);
|
$appDir = dirname(__DIR__);
|
||||||
|
clearstatcache(true, "{$appDir}/version.json");
|
||||||
$localVerJson = file_exists("{$appDir}/version.json")
|
$localVerJson = file_exists("{$appDir}/version.json")
|
||||||
? json_decode((string)file_get_contents("{$appDir}/version.json"), true)
|
? json_decode((string)file_get_contents("{$appDir}/version.json"), true)
|
||||||
: ['version' => '1.2.0', 'changelog' => []];
|
: ['version' => '1.3.8', 'changelog' => []];
|
||||||
|
|
||||||
$currentVer = $localVerJson['version'] ?? '1.2.0';
|
$currentVer = $localVerJson['version'] ?? '1.3.8';
|
||||||
$remoteVer = $currentVer;
|
$remoteVer = $currentVer;
|
||||||
$remoteChangelog = [];
|
$remoteChangelog = [];
|
||||||
$remoteDate = '';
|
$remoteDate = '';
|
||||||
|
|
||||||
exec("git --git-dir={$appDir}/.git fetch origin main --quiet 2>/dev/null", $output, $code);
|
// 1. Interrogation directe via HTTP Raw avec cache-busting strict (bypass OpenResty/Cloudflare max-age)
|
||||||
$remoteJsonRaw = shell_exec("git --git-dir={$appDir}/.git show origin/main:version.json 2>/dev/null");
|
$ts = time();
|
||||||
if ($remoteJsonRaw) {
|
$rawHttp = @shell_exec("curl -k -s -H 'Cache-Control: no-cache, no-store' -H 'Pragma: no-cache' --connect-timeout 4 \"https://git.sorcier-research.com/sorcier/NexusPBX/raw/branch/main/version.json?_t={$ts}\" 2>/dev/null");
|
||||||
$remoteData = json_decode($remoteJsonRaw, true);
|
if (empty($rawHttp)) {
|
||||||
|
$ctx = stream_context_create([
|
||||||
|
'http' => [
|
||||||
|
'timeout' => 4,
|
||||||
|
'header' => "Cache-Control: no-cache\r\nPragma: no-cache\r\n"
|
||||||
|
],
|
||||||
|
'ssl' => ['verify_peer' => false, 'verify_peer_name' => false]
|
||||||
|
]);
|
||||||
|
$rawHttp = @file_get_contents("https://git.sorcier-research.com/sorcier/NexusPBX/raw/branch/main/version.json?_t={$ts}", false, $ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($rawHttp)) {
|
||||||
|
$remoteData = json_decode((string)$rawHttp, true);
|
||||||
if (is_array($remoteData) && !empty($remoteData['version'])) {
|
if (is_array($remoteData) && !empty($remoteData['version'])) {
|
||||||
$remoteVer = (string)$remoteData['version'];
|
$remoteVer = (string)$remoteData['version'];
|
||||||
$remoteChangelog = $remoteData['changelog'] ?? [];
|
$remoteChangelog = $remoteData['changelog'] ?? [];
|
||||||
$remoteDate = $remoteData['release_date'] ?? '';
|
$remoteDate = $remoteData['release_date'] ?? '';
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 2. Fallback local Git si indisponibilité du serveur HTTP
|
||||||
|
exec("git --git-dir={$appDir}/.git fetch origin main --quiet 2>/dev/null", $output, $code);
|
||||||
|
$remoteJsonRaw = shell_exec("git --git-dir={$appDir}/.git show origin/main:version.json 2>/dev/null");
|
||||||
|
if ($remoteJsonRaw) {
|
||||||
|
$remoteData = json_decode($remoteJsonRaw, true);
|
||||||
|
if (is_array($remoteData) && !empty($remoteData['version'])) {
|
||||||
|
$remoteVer = (string)$remoteData['version'];
|
||||||
|
$remoteChangelog = $remoteData['changelog'] ?? [];
|
||||||
|
$remoteDate = $remoteData['release_date'] ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$hasUpdate = version_compare($remoteVer, $currentVer, '>');
|
$hasUpdate = version_compare($remoteVer, $currentVer, '>');
|
||||||
$localHash = trim((string)shell_exec("git --git-dir={$appDir}/.git rev-parse HEAD 2>/dev/null"));
|
|
||||||
$remoteHash = trim((string)shell_exec("git --git-dir={$appDir}/.git rev-parse origin/main 2>/dev/null"));
|
|
||||||
if (!$hasUpdate && $localHash !== '' && $remoteHash !== '' && $localHash !== $remoteHash) {
|
|
||||||
$hasUpdate = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
@@ -2277,13 +2304,18 @@ try {
|
|||||||
$outputStr = implode("\n", $output);
|
$outputStr = implode("\n", $output);
|
||||||
|
|
||||||
$appDir = dirname(__DIR__);
|
$appDir = dirname(__DIR__);
|
||||||
|
clearstatcache(true, "{$appDir}/version.json");
|
||||||
|
if (function_exists('opcache_reset')) {
|
||||||
|
@opcache_reset();
|
||||||
|
}
|
||||||
|
|
||||||
$newVerJson = file_exists("{$appDir}/version.json")
|
$newVerJson = file_exists("{$appDir}/version.json")
|
||||||
? json_decode((string)file_get_contents("{$appDir}/version.json"), true)
|
? json_decode((string)file_get_contents("{$appDir}/version.json"), true)
|
||||||
: ['version' => '1.3.0'];
|
: ['version' => '1.3.8'];
|
||||||
|
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
'success' => ($code === 0),
|
'success' => ($code === 0),
|
||||||
'new_version' => $newVerJson['version'] ?? '1.3.0',
|
'new_version' => $newVerJson['version'] ?? '1.3.8',
|
||||||
'output' => $outputStr,
|
'output' => $outputStr,
|
||||||
'message' => ($code === 0) ? "Mise à jour réussie !" : "Erreur lors de la mise à jour",
|
'message' => ($code === 0) ? "Mise à jour réussie !" : "Erreur lors de la mise à jour",
|
||||||
]);
|
]);
|
||||||
|
|||||||
+217
-64
@@ -629,20 +629,56 @@ function drawDualAreaChart(svgId, seriesA, seriesB, maxVal, colorA, colorB, unit
|
|||||||
const padTop = 14;
|
const padTop = 14;
|
||||||
const padBottom = 18;
|
const padBottom = 18;
|
||||||
const plotH = height - padTop - padBottom;
|
const plotH = height - padTop - padBottom;
|
||||||
|
const baselineY = padTop + plotH;
|
||||||
const safeMax = maxVal > 0 ? maxVal : 100;
|
const safeMax = maxVal > 0 ? maxVal : 100;
|
||||||
|
|
||||||
const toPoints = (arr) => arr.map((val, idx) => {
|
const clampY = (y) => Math.max(padTop, Math.min(baselineY, y));
|
||||||
const x = (idx / (arr.length - 1)) * width;
|
|
||||||
const ratio = Math.max(0, Math.min(1, val / safeMax));
|
|
||||||
const y = padTop + plotH - (ratio * plotH);
|
|
||||||
return `${x.toFixed(1)},${y.toFixed(1)}`;
|
|
||||||
});
|
|
||||||
|
|
||||||
const ptsA = toPoints(seriesA);
|
// Génération de courbes splines adoucies (Catmull-Rom / Bézier cubique) pour éliminer les angles pointus
|
||||||
const ptsB = toPoints(seriesB);
|
const computeSmoothPaths = (arr, tension = 0.2) => {
|
||||||
|
if (!arr || arr.length === 0) return { line: '', area: '' };
|
||||||
|
|
||||||
const areaA = `0,${padTop + plotH} ` + ptsA.join(' ') + ` ${width},${padTop + plotH}`;
|
const points = arr.map((val, idx) => {
|
||||||
const areaB = `0,${padTop + plotH} ` + ptsB.join(' ') + ` ${width},${padTop + plotH}`;
|
const x = (idx / (arr.length - 1)) * width;
|
||||||
|
const ratio = Math.max(0, Math.min(1, val / safeMax));
|
||||||
|
const y = baselineY - (ratio * plotH);
|
||||||
|
return { x, y };
|
||||||
|
});
|
||||||
|
|
||||||
|
if (points.length === 1) {
|
||||||
|
return {
|
||||||
|
line: `M ${points[0].x.toFixed(1)},${points[0].y.toFixed(1)}`,
|
||||||
|
area: `M 0,${baselineY} L ${points[0].x.toFixed(1)},${points[0].y.toFixed(1)} L ${width},${baselineY} Z`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let line = `M ${points[0].x.toFixed(1)},${points[0].y.toFixed(1)}`;
|
||||||
|
|
||||||
|
for (let i = 0; i < points.length - 1; i++) {
|
||||||
|
const p0 = points[i === 0 ? i : i - 1];
|
||||||
|
const p1 = points[i];
|
||||||
|
const p2 = points[i + 1];
|
||||||
|
const p3 = points[i + 2 < points.length ? i + 2 : i + 1];
|
||||||
|
|
||||||
|
let cp1x = p1.x + (p2.x - p0.x) * tension;
|
||||||
|
let cp1y = p1.y + (p2.y - p0.y) * tension;
|
||||||
|
|
||||||
|
let cp2x = p2.x - (p3.x - p1.x) * tension;
|
||||||
|
let cp2y = p2.y - (p3.y - p1.y) * tension;
|
||||||
|
|
||||||
|
// Clamping vertical pour garantir que la courbe ne déborde pas sous l'axe ni au-dessus du max
|
||||||
|
cp1y = clampY(cp1y);
|
||||||
|
cp2y = clampY(cp2y);
|
||||||
|
|
||||||
|
line += ` C ${cp1x.toFixed(1)},${cp1y.toFixed(1)} ${cp2x.toFixed(1)},${cp2y.toFixed(1)} ${p2.x.toFixed(1)},${p2.y.toFixed(1)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const area = `${line} L ${width},${baselineY} L 0,${baselineY} Z`;
|
||||||
|
return { line, area };
|
||||||
|
};
|
||||||
|
|
||||||
|
const pathA = computeSmoothPaths(seriesA);
|
||||||
|
const pathB = computeSmoothPaths(seriesB);
|
||||||
|
|
||||||
const gradIdA = `${svgId}-grad-a`;
|
const gradIdA = `${svgId}-grad-a`;
|
||||||
const gradIdB = `${svgId}-grad-b`;
|
const gradIdB = `${svgId}-grad-b`;
|
||||||
@@ -662,18 +698,18 @@ function drawDualAreaChart(svgId, seriesA, seriesB, maxVal, colorA, colorB, unit
|
|||||||
<!-- Lignes de grille horizontales -->
|
<!-- Lignes de grille horizontales -->
|
||||||
<line x1="0" y1="${padTop}" x2="${width}" y2="${padTop}" stroke="#2c323f" stroke-dasharray="3,3" stroke-width="1"/>
|
<line x1="0" y1="${padTop}" x2="${width}" y2="${padTop}" stroke="#2c323f" stroke-dasharray="3,3" stroke-width="1"/>
|
||||||
<line x1="0" y1="${padTop + plotH / 2}" x2="${width}" y2="${padTop + plotH / 2}" stroke="#2c323f" stroke-dasharray="3,3" stroke-width="1"/>
|
<line x1="0" y1="${padTop + plotH / 2}" x2="${width}" y2="${padTop + plotH / 2}" stroke="#2c323f" stroke-dasharray="3,3" stroke-width="1"/>
|
||||||
<line x1="0" y1="${padTop + plotH}" x2="${width}" y2="${padTop + plotH}" stroke="#3d4657" stroke-width="1"/>
|
<line x1="0" y1="${baselineY}" x2="${width}" y2="${baselineY}" stroke="#3d4657" stroke-width="1"/>
|
||||||
|
|
||||||
<text x="6" y="${padTop + 10}" fill="#94a3b8" font-size="10" font-family="monospace">${Math.round(safeMax)} ${unitLabel}</text>
|
<text x="6" y="${padTop + 10}" fill="#94a3b8" font-size="10" font-family="monospace">${Math.round(safeMax)} ${unitLabel}</text>
|
||||||
<text x="6" y="${padTop + plotH / 2 - 4}" fill="#64748b" font-size="10" font-family="monospace">${Math.round(safeMax / 2)} ${unitLabel}</text>
|
<text x="6" y="${padTop + plotH / 2 - 4}" fill="#64748b" font-size="10" font-family="monospace">${Math.round(safeMax / 2)} ${unitLabel}</text>
|
||||||
|
|
||||||
<!-- Courbe B -->
|
<!-- Courbe B lissée avec dégradé -->
|
||||||
<polygon points="${areaB}" fill="url(#${gradIdB})"/>
|
<path d="${pathB.area}" fill="url(#${gradIdB})"/>
|
||||||
<polyline fill="none" stroke="${colorB}" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" points="${ptsB.join(' ')}"/>
|
<path d="${pathB.line}" fill="none" stroke="${colorB}" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
|
||||||
<!-- Courbe A -->
|
<!-- Courbe A lissée avec dégradé -->
|
||||||
<polygon points="${areaA}" fill="url(#${gradIdA})"/>
|
<path d="${pathA.area}" fill="url(#${gradIdA})"/>
|
||||||
<polyline fill="none" stroke="${colorA}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" points="${ptsA.join(' ')}"/>
|
<path d="${pathA.line}" fill="none" stroke="${colorA}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3003,7 +3039,7 @@ function openIvrModal(ivr = null) {
|
|||||||
document.getElementById('modal-ivr-title').textContent = ivr ? `Modifier le SVI « ${ivr.name} »` : 'Nouveau Serveur Vocal Interactif (SVI / IVR)';
|
document.getElementById('modal-ivr-title').textContent = ivr ? `Modifier le SVI « ${ivr.name} »` : 'Nouveau Serveur Vocal Interactif (SVI / IVR)';
|
||||||
|
|
||||||
form.elements['id'].value = ivr ? ivr.id : '';
|
form.elements['id'].value = ivr ? ivr.id : '';
|
||||||
form.elements['name'].value = ivr ? ivr.name : 'ivr-accueil';
|
form.elements['name'].value = ivr ? ivr.name : '';
|
||||||
form.elements['description'].value = ivr && ivr.description ? ivr.description : '';
|
form.elements['description'].value = ivr && ivr.description ? ivr.description : '';
|
||||||
form.elements['timeout'].value = ivr ? Number(ivr.timeout) : 5;
|
form.elements['timeout'].value = ivr ? Number(ivr.timeout) : 5;
|
||||||
form.elements['timeout_retries'].value = ivr ? Number(ivr.timeout_retries || 2) : 2;
|
form.elements['timeout_retries'].value = ivr ? Number(ivr.timeout_retries || 2) : 2;
|
||||||
@@ -4945,28 +4981,93 @@ async function createBackupNow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function confirmRestoreBackup(filename) {
|
let pendingRestoreAction = null;
|
||||||
const ok = confirm(`⚠️ ATTENTION — RESTAURATION COMPLÈTE DU SYSTÈME NEXUSPBX ⚠️\n\nVoulez-vous restaurer le système depuis l'archive :\n${filename} ?\n\nCette action va :\n1. Remplacer la base de données SQLite\n2. Restaurer tous les fichiers sons, annonces et musiques\n3. Restaurer toutes les boîtes vocales, salutations et PINs\n4. Recharger l'intégralité du PBX Asterisk\n\nConfirmez-vous la restauration immédiate ?`);
|
let pendingRestoreInput = null;
|
||||||
if (!ok) return;
|
|
||||||
|
|
||||||
showToast("Restauration du système en cours... Veuillez patienter.", "info");
|
function showRestoreModal({ title, filename, badgeText, onConfirm, inputEl = null }) {
|
||||||
|
const titleEl = document.getElementById('modal-restore-title');
|
||||||
|
if (titleEl) titleEl.textContent = title || "Restauration Complète du Système";
|
||||||
|
|
||||||
|
const nameEl = document.getElementById('restore-target-name');
|
||||||
|
if (nameEl) nameEl.textContent = filename || "Archive de sauvegarde";
|
||||||
|
|
||||||
|
const badgeEl = document.getElementById('restore-target-badge');
|
||||||
|
if (badgeEl) badgeEl.textContent = badgeText || "Archive";
|
||||||
|
|
||||||
|
const confirmBtn = document.getElementById('btn-confirm-restore');
|
||||||
|
const cancelBtn = document.getElementById('btn-cancel-restore');
|
||||||
|
if (confirmBtn) {
|
||||||
|
confirmBtn.disabled = false;
|
||||||
|
confirmBtn.innerHTML = `
|
||||||
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/></svg>
|
||||||
|
<span>Confirmer la Restauration</span>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
if (cancelBtn) cancelBtn.disabled = false;
|
||||||
|
|
||||||
|
pendingRestoreAction = onConfirm;
|
||||||
|
pendingRestoreInput = inputEl;
|
||||||
|
|
||||||
|
openModal('modal-restore-backup');
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeRestoreModal() {
|
||||||
|
closeModal('modal-restore-backup');
|
||||||
|
if (pendingRestoreInput) {
|
||||||
|
pendingRestoreInput.value = '';
|
||||||
|
pendingRestoreInput = null;
|
||||||
|
}
|
||||||
|
pendingRestoreAction = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function executePendingRestore() {
|
||||||
|
if (!pendingRestoreAction) return;
|
||||||
|
const confirmBtn = document.getElementById('btn-confirm-restore');
|
||||||
|
const cancelBtn = document.getElementById('btn-cancel-restore');
|
||||||
|
if (confirmBtn) {
|
||||||
|
confirmBtn.disabled = true;
|
||||||
|
confirmBtn.innerHTML = `
|
||||||
|
<svg class="animate-spin w-4 h-4" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z"></path></svg>
|
||||||
|
<span>Restauration en cours...</span>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
if (cancelBtn) cancelBtn.disabled = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await apiCall('restore_backup', { filename });
|
await pendingRestoreAction();
|
||||||
showToast(res.message || "Restauration terminée avec succès !", 'success');
|
|
||||||
setTimeout(() => {
|
|
||||||
window.location.reload();
|
|
||||||
}, 2000);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showToast("Échec de la restauration : " + err.message, 'error');
|
showToast("Erreur inattendue : " + err.message, "error");
|
||||||
|
closeRestoreModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function confirmRestoreBackup(filename) {
|
||||||
|
showRestoreModal({
|
||||||
|
title: "Restauration du Système NexusPBX",
|
||||||
|
filename: filename,
|
||||||
|
badgeText: "Archive Locale",
|
||||||
|
onConfirm: async () => {
|
||||||
|
showToast("Restauration du système en cours... Veuillez patienter.", "info");
|
||||||
|
try {
|
||||||
|
const res = await apiCall('restore_backup', { filename });
|
||||||
|
closeRestoreModal();
|
||||||
|
showToast(res.message || "Restauration terminée avec succès !", 'success');
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, 2000);
|
||||||
|
} catch (err) {
|
||||||
|
closeRestoreModal();
|
||||||
|
showToast("Échec de la restauration : " + err.message, 'error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function triggerBackupUpload() {
|
function triggerBackupUpload() {
|
||||||
document.getElementById('backup-upload-input')?.click();
|
document.getElementById('backup-upload-input')?.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleBackupUpload(input) {
|
function handleBackupUpload(input) {
|
||||||
const file = input?.files?.[0];
|
const file = input?.files?.[0];
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
|
||||||
@@ -4977,35 +5078,38 @@ async function handleBackupUpload(input) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ok = confirm(`⚠️ RESTAURATION DISASTER RECOVERY VIA FICHIER TÉLÉVERSÉ ⚠️\n\nFichier sélectionné : ${file.name} (${(file.size / (1024 * 1024)).toFixed(2)} Mo)\n\nVoulez-vous restaurer immédiatement le système NexusPBX avec cette archive ?\nToutes les données actuelles seront remplacées.`);
|
const fileSizeMb = (file.size / (1024 * 1024)).toFixed(2);
|
||||||
if (!ok) {
|
|
||||||
input.value = '';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
showToast("Téléversement et restauration de l'archive en cours...", "info");
|
showRestoreModal({
|
||||||
|
title: "Disaster Recovery — Archive Téléversée",
|
||||||
|
filename: `${file.name} (${fileSizeMb} Mo)`,
|
||||||
|
badgeText: "Fichier Téléversé",
|
||||||
|
inputEl: input,
|
||||||
|
onConfirm: async () => {
|
||||||
|
showToast("Téléversement et restauration de l'archive en cours...", "info");
|
||||||
|
const fd = new FormData();
|
||||||
|
fd.append('backup_file', file);
|
||||||
|
|
||||||
const fd = new FormData();
|
try {
|
||||||
fd.append('backup_file', file);
|
const response = await fetch('/api.php?action=upload_restore_backup', {
|
||||||
|
method: 'POST',
|
||||||
try {
|
body: fd
|
||||||
const response = await fetch('/api.php?action=upload_restore_backup', {
|
});
|
||||||
method: 'POST',
|
const res = await response.json();
|
||||||
body: fd
|
closeRestoreModal();
|
||||||
});
|
if (!res.success) {
|
||||||
const res = await response.json();
|
throw new Error(res.message || "Erreur lors de la restauration");
|
||||||
if (!res.success) {
|
}
|
||||||
throw new Error(res.message || "Erreur lors de la restauration");
|
showToast(res.message, 'success');
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, 2000);
|
||||||
|
} catch (err) {
|
||||||
|
closeRestoreModal();
|
||||||
|
showToast("Échec de la restauration : " + err.message, 'error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
showToast(res.message, 'success');
|
});
|
||||||
setTimeout(() => {
|
|
||||||
window.location.reload();
|
|
||||||
}, 2000);
|
|
||||||
} catch (err) {
|
|
||||||
showToast("Échec de la restauration : " + err.message, 'error');
|
|
||||||
} finally {
|
|
||||||
input.value = '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadBackup(filename) {
|
function downloadBackup(filename) {
|
||||||
@@ -5667,25 +5771,42 @@ async function checkSystemUpdate(notify = false) {
|
|||||||
const TWENTY_FOUR_HOURS = 24 * 60 * 60 * 1000;
|
const TWENTY_FOUR_HOURS = 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
// Si pas de clic explicite (notify === false), vérifier si un check a déjà été fait il y a moins de 24h
|
// Si pas de clic explicite (notify === false), vérifier si un check a déjà été fait il y a moins de 24h
|
||||||
|
const installedVer = (appState && appState.version) ? appState.version : (document.querySelector('meta[name="nexus-app-version"]')?.content || '');
|
||||||
if (!notify) {
|
if (!notify) {
|
||||||
const lastTs = parseInt(localStorage.getItem(STORAGE_KEY_TIME) || '0', 10);
|
const lastTs = parseInt(localStorage.getItem(STORAGE_KEY_TIME) || '0', 10);
|
||||||
const cachedRaw = localStorage.getItem(STORAGE_KEY_DATA);
|
const cachedRaw = localStorage.getItem(STORAGE_KEY_DATA);
|
||||||
if (lastTs && (Date.now() - lastTs < TWENTY_FOUR_HOURS) && cachedRaw) {
|
if (lastTs && (Date.now() - lastTs < TWENTY_FOUR_HOURS) && cachedRaw) {
|
||||||
try {
|
try {
|
||||||
const cached = JSON.parse(cachedRaw);
|
const cached = JSON.parse(cachedRaw);
|
||||||
applyUpdateUI(cached);
|
// Si la version locale correspond et qu'on n'a pas un vieux flag "mise à jour dispo" vers la version déjà installée
|
||||||
return;
|
if (installedVer && (cached.current_version !== installedVer || (cached.has_update && cached.latest_version === installedVer))) {
|
||||||
} catch (_) {}
|
// Cache périmé suite à une mise à jour : on purge pour rafraîchir en direct
|
||||||
|
localStorage.removeItem(STORAGE_KEY_TIME);
|
||||||
|
localStorage.removeItem(STORAGE_KEY_DATA);
|
||||||
|
} else {
|
||||||
|
applyUpdateUI(cached);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (_) {
|
||||||
|
localStorage.removeItem(STORAGE_KEY_TIME);
|
||||||
|
localStorage.removeItem(STORAGE_KEY_DATA);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
localStorage.removeItem(STORAGE_KEY_TIME);
|
||||||
|
localStorage.removeItem(STORAGE_KEY_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let origBtnHtml = null;
|
||||||
if (btnCheck) {
|
if (btnCheck) {
|
||||||
btnCheck.disabled = true;
|
btnCheck.disabled = true;
|
||||||
btnCheck.classList.add('opacity-50');
|
btnCheck.classList.add('opacity-50');
|
||||||
|
origBtnHtml = btnCheck.innerHTML;
|
||||||
|
btnCheck.innerHTML = `<svg class="animate-spin w-4 h-4 text-cyan-400" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z"></path></svg><span>Vérification en cours...</span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api.php?action=check_update');
|
const res = await fetch('/api.php?action=check_update&_t=' + Date.now());
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
// Enregistrement du timestamp de vérification et des données en cache local (24h)
|
// Enregistrement du timestamp de vérification et des données en cache local (24h)
|
||||||
@@ -5709,6 +5830,7 @@ async function checkSystemUpdate(notify = false) {
|
|||||||
if (btnCheck) {
|
if (btnCheck) {
|
||||||
btnCheck.disabled = false;
|
btnCheck.disabled = false;
|
||||||
btnCheck.classList.remove('opacity-50');
|
btnCheck.classList.remove('opacity-50');
|
||||||
|
if (origBtnHtml) btnCheck.innerHTML = origBtnHtml;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5785,8 +5907,12 @@ async function runSystemUpdate() {
|
|||||||
|
|
||||||
showToast("Mise à jour en cours d'exécution en arrière-plan...", 'info');
|
showToast("Mise à jour en cours d'exécution en arrière-plan...", 'info');
|
||||||
|
|
||||||
|
// Purge préventive du cache local
|
||||||
|
localStorage.removeItem('nexus_update_last_check_ts');
|
||||||
|
localStorage.removeItem('nexus_update_cached_data');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api.php?action=run_update', {
|
const res = await fetch('/api.php?action=run_update&_t=' + Date.now(), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({})
|
body: JSON.stringify({})
|
||||||
@@ -5794,14 +5920,41 @@ async function runSystemUpdate() {
|
|||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
showToast(`NexusPBX a été mis à jour avec succès en v${data.new_version} ! Rechargement...`, 'success');
|
const newVer = data.new_version || '';
|
||||||
|
|
||||||
|
// 1. Mettre à jour immédiatement le cache avec l'état à jour
|
||||||
|
localStorage.setItem('nexus_update_last_check_ts', Date.now().toString());
|
||||||
|
localStorage.setItem('nexus_update_cached_data', JSON.stringify({
|
||||||
|
success: true,
|
||||||
|
current_version: newVer,
|
||||||
|
latest_version: newVer,
|
||||||
|
has_update: false,
|
||||||
|
changelog: [],
|
||||||
|
release_date: ''
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 2. Mettre à jour visuellement les badges immédiatement
|
||||||
|
const verTag = document.getElementById('system-version-tag');
|
||||||
|
const appBadge = document.getElementById('app-version-badge');
|
||||||
|
const headerUpdateBadge = document.getElementById('header-update-badge');
|
||||||
|
const pingDot = document.getElementById('update-ping-dot');
|
||||||
|
|
||||||
|
if (verTag && newVer) verTag.textContent = `v${newVer}`;
|
||||||
|
if (appBadge && newVer) appBadge.textContent = `v${newVer}`;
|
||||||
|
if (headerUpdateBadge) headerUpdateBadge.style.display = 'none';
|
||||||
|
if (btnRun) btnRun.style.display = 'none';
|
||||||
|
if (pingDot) pingDot.classList.add('hidden');
|
||||||
|
|
||||||
|
showToast(`NexusPBX a été mis à jour avec succès en v${newVer} ! Rechargement...`, 'success');
|
||||||
if (statusText) {
|
if (statusText) {
|
||||||
statusText.className = 'text-emerald-400 font-bold';
|
statusText.className = 'text-emerald-400 font-bold';
|
||||||
statusText.textContent = `Mise à jour terminée avec succès (v${data.new_version}) ! Rechargement de la page...`;
|
statusText.textContent = `Mise à jour terminée avec succès (v${newVer}) ! Rechargement...`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 3. Rechargement avec paramètre anti-cache pour forcer le navigateur à récupérer le nouveau DOM
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.href = window.location.origin + window.location.pathname + '?_t=' + Date.now();
|
||||||
}, 2500);
|
}, 2000);
|
||||||
} else {
|
} else {
|
||||||
alert("Erreur lors de la mise à jour :\n\n" + (data.output || data.message));
|
alert("Erreur lors de la mise à jour :\n\n" + (data.output || data.message));
|
||||||
if (btnRun) {
|
if (btnRun) {
|
||||||
|
|||||||
+94
-7
@@ -10,12 +10,16 @@ use App\Auth;
|
|||||||
Database::getConnection();
|
Database::getConnection();
|
||||||
$isAuth = Auth::isAuthenticated();
|
$isAuth = Auth::isAuthenticated();
|
||||||
$currentUser = Auth::getUsername();
|
$currentUser = Auth::getUsername();
|
||||||
|
|
||||||
|
$appVerData = file_exists(__DIR__ . '/../version.json') ? json_decode((string)file_get_contents(__DIR__ . '/../version.json'), true) : [];
|
||||||
|
$appVersion = $appVerData['version'] ?? '1.4.0';
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr" class="h-full">
|
<html lang="fr" class="h-full">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="nexus-app-version" content="<?= htmlspecialchars($appVersion) ?>">
|
||||||
<title>NexusPBX — Supervision & Gestion PJSIP sur Debian</title>
|
<title>NexusPBX — Supervision & Gestion PJSIP sur Debian</title>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
<script>
|
<script>
|
||||||
@@ -176,11 +180,6 @@ $currentUser = Auth::getUsername();
|
|||||||
Se connecter au PBX
|
Se connecter au PBX
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="mt-6 pt-5 border-t border-anthracite-700 text-xs text-slate-300 flex items-center justify-between">
|
|
||||||
<span>Accès initial par défaut :</span>
|
|
||||||
<code class="px-2.5 py-1 rounded bg-anthracite-950 border border-anthracite-700 text-indigo-300 font-mono">admin / admin123</code>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -207,7 +206,7 @@ $currentUser = Auth::getUsername();
|
|||||||
<div class="font-black text-white text-2xl tracking-tight leading-none">
|
<div class="font-black text-white text-2xl tracking-tight leading-none">
|
||||||
Nexus<span class="text-indigo-400">PBX</span>
|
Nexus<span class="text-indigo-400">PBX</span>
|
||||||
</div>
|
</div>
|
||||||
<span id="app-version-badge" class="px-1.5 py-0.5 text-[10px] font-mono font-bold tracking-wider rounded bg-indigo-500/20 text-indigo-300 border border-indigo-500/30">v1.3.0</span>
|
<span id="app-version-badge" class="px-1.5 py-0.5 text-[10px] font-mono font-bold tracking-wider rounded bg-indigo-500/20 text-indigo-300 border border-indigo-500/30">v<?= htmlspecialchars($appVersion) ?></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-[10px] text-slate-400 font-medium tracking-wide mt-0.5">Moteur VoIP & Téléphonie IP</div>
|
<div class="text-[10px] text-slate-400 font-medium tracking-wide mt-0.5">Moteur VoIP & Téléphonie IP</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1577,7 +1576,7 @@ $currentUser = Auth::getUsername();
|
|||||||
<span id="update-dot" class="relative inline-flex rounded-full h-3 w-3 bg-emerald-500"></span>
|
<span id="update-dot" class="relative inline-flex rounded-full h-3 w-3 bg-emerald-500"></span>
|
||||||
</span>
|
</span>
|
||||||
<h3 class="text-base font-bold text-white">Mises à Jour du Système NexusPBX</h3>
|
<h3 class="text-base font-bold text-white">Mises à Jour du Système NexusPBX</h3>
|
||||||
<span id="system-version-tag" class="px-2 py-0.5 text-xs font-mono font-bold rounded-lg bg-indigo-500/20 text-indigo-300 border border-indigo-500/30">v1.3.0</span>
|
<span id="system-version-tag" class="px-2 py-0.5 text-xs font-mono font-bold rounded-lg bg-indigo-500/20 text-indigo-300 border border-indigo-500/30">v<?= htmlspecialchars($appVersion) ?></span>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-xs text-slate-300 mt-1">Vérifiez les nouvelles versions officielles et mettez à jour votre PBX en 1 clic sans coupure de service.</p>
|
<p class="text-xs text-slate-300 mt-1">Vérifiez les nouvelles versions officielles et mettez à jour votre PBX en 1 clic sans coupure de service.</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -4628,6 +4627,94 @@ $currentUser = Auth::getUsername();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- ===================================================================== -->
|
||||||
|
<!-- MODALE : CONFIRMATION RESTAURATION DU SYSTÈME (THEME NEXUSPBX) -->
|
||||||
|
<!-- ===================================================================== -->
|
||||||
|
<div id="modal-restore-backup" class="fixed inset-0 z-50 hidden items-center justify-center bg-black/80 backdrop-blur-sm p-3 sm:p-4 overflow-y-auto">
|
||||||
|
<div class="bg-anthracite-900 border border-amber-500/40 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden my-6 animate-fadeIn">
|
||||||
|
<!-- Entête stylisée -->
|
||||||
|
<div class="px-6 py-5 border-b border-anthracite-800 bg-gradient-to-r from-amber-950/40 via-anthracite-900 to-anthracite-900 flex items-start justify-between">
|
||||||
|
<div class="flex items-center gap-3.5">
|
||||||
|
<div class="w-11 h-11 rounded-xl bg-amber-500/15 border border-amber-500/30 text-amber-400 flex items-center justify-center shrink-0 shadow-lg shadow-amber-950/50">
|
||||||
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<h3 id="modal-restore-title" class="text-base font-bold text-white">Restauration Complète du Système</h3>
|
||||||
|
<span id="restore-target-badge" class="px-2 py-0.5 rounded text-[10px] font-bold tracking-wide uppercase bg-amber-500/20 text-amber-300 border border-amber-500/30">Archive</span>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-slate-400 mt-0.5">Disaster Recovery & Remise en état Asterisk</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" onclick="closeRestoreModal()" class="text-slate-400 hover:text-white p-1.5 rounded-lg hover:bg-anthracite-800 transition">
|
||||||
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Corps de la modale -->
|
||||||
|
<div class="p-6 space-y-4">
|
||||||
|
<!-- Fichier cible -->
|
||||||
|
<div class="p-3.5 rounded-xl bg-anthracite-950/90 border border-anthracite-800 space-y-1.5">
|
||||||
|
<div class="text-[11px] font-semibold text-slate-400 flex items-center gap-1.5 uppercase tracking-wider">
|
||||||
|
<svg class="w-3.5 h-3.5 text-amber-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"/></svg>
|
||||||
|
Archive sélectionnée pour la restauration
|
||||||
|
</div>
|
||||||
|
<div id="restore-target-name" class="font-mono text-xs font-semibold text-amber-300 break-all bg-black/40 px-3 py-2 rounded-lg border border-anthracite-800/80">
|
||||||
|
nom_de_l_archive.tar.gz
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Ce que fait la restauration -->
|
||||||
|
<div class="space-y-2">
|
||||||
|
<div class="text-xs font-semibold text-slate-300">Cette action va restaurer et écraser :</div>
|
||||||
|
<ul class="text-xs text-slate-400 space-y-1.5 pl-1">
|
||||||
|
<li class="flex items-center gap-2">
|
||||||
|
<span class="w-1.5 h-1.5 rounded-full bg-cyan-400 shrink-0"></span>
|
||||||
|
<span><strong>Base SQLite</strong> : postes SIP, trunks, routes, SVI, téléavertissement, annuaires.</span>
|
||||||
|
</li>
|
||||||
|
<li class="flex items-center gap-2">
|
||||||
|
<span class="w-1.5 h-1.5 rounded-full bg-indigo-400 shrink-0"></span>
|
||||||
|
<span><strong>Médiathèque</strong> : jingles, musiques d'attente (MoH), annonces personnalisées.</span>
|
||||||
|
</li>
|
||||||
|
<li class="flex items-center gap-2">
|
||||||
|
<span class="w-1.5 h-1.5 rounded-full bg-amber-400 shrink-0"></span>
|
||||||
|
<span><strong>Messageries vocales</strong> : boîtes vocales, salutations enregistrées, PINs.</span>
|
||||||
|
</li>
|
||||||
|
<li class="flex items-center gap-2">
|
||||||
|
<span class="w-1.5 h-1.5 rounded-full bg-emerald-400 shrink-0"></span>
|
||||||
|
<span><strong>Moteur Asterisk</strong> : régénération du dialplan et rechargement PJSIP à chaud.</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Avertissement -->
|
||||||
|
<div class="p-3 rounded-xl bg-amber-950/30 border border-amber-500/30 flex items-start gap-3">
|
||||||
|
<svg class="w-5 h-5 text-amber-400 shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
|
||||||
|
</svg>
|
||||||
|
<div class="text-xs text-amber-200/90 leading-relaxed">
|
||||||
|
<strong>Attention :</strong> Toutes les données et configurations modifiées après la date de cette sauvegarde seront définitivement remplacées.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Boutons d'action -->
|
||||||
|
<div class="pt-3 border-t border-anthracite-800 flex items-center justify-end gap-2.5">
|
||||||
|
<button type="button" id="btn-cancel-restore" onclick="closeRestoreModal()"
|
||||||
|
class="px-4 py-2.5 rounded-xl text-xs font-semibold bg-anthracite-800 hover:bg-anthracite-750 text-slate-300 border border-anthracite-700 transition">
|
||||||
|
Annuler
|
||||||
|
</button>
|
||||||
|
<button type="button" id="btn-confirm-restore" onclick="executePendingRestore()"
|
||||||
|
class="px-5 py-2.5 rounded-xl text-xs font-bold bg-gradient-to-r from-amber-600 via-red-600 to-red-700 hover:from-amber-500 hover:to-red-600 text-white shadow-lg shadow-red-900/40 transition flex items-center gap-2">
|
||||||
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/></svg>
|
||||||
|
<span>Confirmer la Restauration</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- ===================================================================== -->
|
<!-- ===================================================================== -->
|
||||||
<!-- MODAL : URL XML YEALINK REMOTE PHONEBOOK (cm_to_yl_ab.php) -->
|
<!-- MODAL : URL XML YEALINK REMOTE PHONEBOOK (cm_to_yl_ab.php) -->
|
||||||
<!-- ===================================================================== -->
|
<!-- ===================================================================== -->
|
||||||
|
|||||||
+5
-4
@@ -16,8 +16,8 @@ cd /var/www/nexus-pbx
|
|||||||
git fetch origin main
|
git fetch origin main
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
|
|
||||||
echo "-> Installation des dépendances système indispensables (ACL, ffmpeg, rsync, sox)..."
|
echo "-> Installation des dépendances système indispensables (ACL, ffmpeg, rsync, sox, sshpass)..."
|
||||||
which ffmpeg >/dev/null 2>&1 && which rsync >/dev/null 2>&1 && which setfacl >/dev/null 2>&1 || (apt-get update -y && apt-get install -y --no-install-recommends acl ffmpeg rsync sox)
|
which ffmpeg >/dev/null 2>&1 && which rsync >/dev/null 2>&1 && which setfacl >/dev/null 2>&1 && which sshpass >/dev/null 2>&1 || (apt-get update -y && apt-get install -y --no-install-recommends acl ffmpeg rsync sox sshpass)
|
||||||
|
|
||||||
echo "-> Création des dossiers et des fichiers de journalisation..."
|
echo "-> Création des dossiers et des fichiers de journalisation..."
|
||||||
mkdir -p /etc/fail2ban/filter.d /etc/asterisk /var/log/asterisk /var/log/nexus-pbx /var/www/nexus-pbx/storage/backups
|
mkdir -p /etc/fail2ban/filter.d /etc/asterisk /var/log/asterisk /var/log/nexus-pbx /var/www/nexus-pbx/storage/backups
|
||||||
@@ -85,7 +85,7 @@ chmod 0664 /etc/fail2ban/jail.local /etc/nginx/sites-available/nexus-pbx 2>/dev/
|
|||||||
setfacl -m u:www-data:rw /etc/fail2ban/jail.local /etc/nginx/sites-available/nexus-pbx 2>/dev/null || true
|
setfacl -m u:www-data:rw /etc/fail2ban/jail.local /etc/nginx/sites-available/nexus-pbx 2>/dev/null || true
|
||||||
|
|
||||||
cat << 'EOF' > /etc/sudoers.d/nexus-pbx
|
cat << 'EOF' > /etc/sudoers.d/nexus-pbx
|
||||||
www-data ALL=(ALL) NOPASSWD: /usr/sbin/asterisk, /usr/sbin/nginx, /usr/bin/systemctl, /usr/bin/fail2ban-client, /bin/fail2ban-client, /var/www/nexus-pbx/scripts/nexus-firewall, /usr/bin/certbot, /usr/sbin/nft, /usr/sbin/iptables
|
www-data ALL=(ALL) NOPASSWD: /usr/sbin/asterisk, /usr/sbin/nginx, /usr/bin/systemctl, /usr/bin/fail2ban-client, /bin/fail2ban-client, /var/www/nexus-pbx/scripts/nexus-firewall, /usr/bin/certbot, /usr/sbin/nft, /usr/sbin/iptables, /var/www/nexus-pbx/scripts/update.sh, /usr/local/bin/nexus-update
|
||||||
EOF
|
EOF
|
||||||
chmod 0440 /etc/sudoers.d/nexus-pbx
|
chmod 0440 /etc/sudoers.d/nexus-pbx
|
||||||
|
|
||||||
@@ -96,7 +96,8 @@ for fpm_svc in /lib/systemd/system/php*-fpm.service /usr/lib/systemd/system/php*
|
|||||||
mkdir -p "/etc/systemd/system/${svc_name}.d"
|
mkdir -p "/etc/systemd/system/${svc_name}.d"
|
||||||
cat << 'EOF_OVERRIDE' > "/etc/systemd/system/${svc_name}.d/override.conf"
|
cat << 'EOF_OVERRIDE' > "/etc/systemd/system/${svc_name}.d/override.conf"
|
||||||
[Service]
|
[Service]
|
||||||
ReadWritePaths=/etc/asterisk /etc/fail2ban /etc/nginx /var/log /var/lib/asterisk /var/spool/asterisk
|
ProtectSystem=false
|
||||||
|
ReadWritePaths=/etc/asterisk /etc/fail2ban /etc/nginx /var/log /var/lib/asterisk /var/spool/asterisk /var/www /usr/local/bin /etc/sudoers.d
|
||||||
EOF_OVERRIDE
|
EOF_OVERRIDE
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
+20
-5
@@ -37,6 +37,7 @@ for arg in "$@"; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
cd "$APP_DIR" || exit 1
|
cd "$APP_DIR" || exit 1
|
||||||
|
git config --system --add safe.directory "$APP_DIR" 2>/dev/null || true
|
||||||
git config --global --add safe.directory "$APP_DIR" 2>/dev/null || true
|
git config --global --add safe.directory "$APP_DIR" 2>/dev/null || true
|
||||||
|
|
||||||
# Lecture de la version locale
|
# Lecture de la version locale
|
||||||
@@ -92,15 +93,29 @@ echo -e "${C_GREEN} ✓ Sauvegarde de sécurité créée : $(basename "$BACKUP_
|
|||||||
|
|
||||||
# 2. Application des derniers fichiers de code Git
|
# 2. Application des derniers fichiers de code Git
|
||||||
echo -e "${C_GRAY}[2/6] Déploiement des nouveaux fichiers de code...${C_RESET}"
|
echo -e "${C_GRAY}[2/6] Déploiement des nouveaux fichiers de code...${C_RESET}"
|
||||||
git reset --hard "${GIT_REMOTE}/${GIT_BRANCH}"
|
git reset --hard FETCH_HEAD 2>/dev/null || git reset --hard "${GIT_REMOTE}/${GIT_BRANCH}"
|
||||||
chown -R www-data:asterisk "$APP_DIR"
|
chown -R www-data:asterisk "$APP_DIR" 2>/dev/null || true
|
||||||
chmod 2775 "$APP_DIR/storage" "$APP_DIR/storage/backups" "$APP_DIR/storage/sounds" 2>/dev/null || true
|
chmod 2775 "$APP_DIR/storage" "$APP_DIR/storage/backups" "$APP_DIR/storage/sounds" 2>/dev/null || true
|
||||||
|
chmod +x "$APP_DIR/scripts/update.sh" "$APP_DIR/scripts/nexus-firewall" "$APP_DIR/scripts/nexus-banner.sh" 2>/dev/null || true
|
||||||
|
|
||||||
|
# Liens symboliques CLI (non-bloquants si exécuté sous sandbox PHP ProtectSystem)
|
||||||
|
ln -sf "$APP_DIR/scripts/update.sh" /usr/local/bin/nexus-update 2>/dev/null || true
|
||||||
|
ln -sf "$APP_DIR/scripts/nexus-firewall" /usr/local/bin/nexus-firewall 2>/dev/null || true
|
||||||
|
ln -sf "$APP_DIR/scripts/nexus-banner.sh" /usr/local/bin/nexus-banner 2>/dev/null || true
|
||||||
|
|
||||||
|
# Mise à jour des privilèges sudoers (www-data) si accessible en écriture
|
||||||
|
if [ -w /etc/sudoers.d ]; then
|
||||||
|
cat << 'EOF_SUDO' > /etc/sudoers.d/nexus-pbx 2>/dev/null || true
|
||||||
|
www-data ALL=(ALL) NOPASSWD: /usr/sbin/asterisk, /usr/sbin/nginx, /usr/bin/systemctl, /usr/bin/fail2ban-client, /bin/fail2ban-client, /var/www/nexus-pbx/scripts/nexus-firewall, /usr/bin/certbot, /usr/sbin/nft, /usr/sbin/iptables, /var/www/nexus-pbx/scripts/update.sh, /usr/local/bin/nexus-update
|
||||||
|
EOF_SUDO
|
||||||
|
chmod 0440 /etc/sudoers.d/nexus-pbx 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
# 3. Vérification des dépendances Debian
|
# 3. Vérification des dépendances Debian
|
||||||
echo -e "${C_GRAY}[3/6] Vérification des composants et outils système...${C_RESET}"
|
echo -e "${C_GRAY}[3/6] Vérification des composants et outils système...${C_RESET}"
|
||||||
which ffmpeg >/dev/null 2>&1 && which rsync >/dev/null 2>&1 && which sox >/dev/null 2>&1 || {
|
which ffmpeg >/dev/null 2>&1 && which rsync >/dev/null 2>&1 && which sox >/dev/null 2>&1 && which sshpass >/dev/null 2>&1 || {
|
||||||
echo -e " -> Installation de paquets complémentaires..."
|
echo -e " -> Installation de paquets complémentaires..."
|
||||||
apt-get update -y -qq && apt-get install -y -qq --no-install-recommends acl ffmpeg rsync sox
|
(apt-get update -y -qq && apt-get install -y -qq --no-install-recommends acl ffmpeg rsync sox sshpass) 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# 4. Exécution des migrations SQLite et régénération Dialplan
|
# 4. Exécution des migrations SQLite et régénération Dialplan
|
||||||
@@ -124,7 +139,7 @@ echo -e "${C_GRAY}[6/6] Rechargement à chaud d'Asterisk et des services web...$
|
|||||||
asterisk -rx "core reload" >/dev/null 2>&1 || true
|
asterisk -rx "core reload" >/dev/null 2>&1 || true
|
||||||
asterisk -rx "pjsip reload" >/dev/null 2>&1 || true
|
asterisk -rx "pjsip reload" >/dev/null 2>&1 || true
|
||||||
asterisk -rx "dialplan reload" >/dev/null 2>&1 || true
|
asterisk -rx "dialplan reload" >/dev/null 2>&1 || true
|
||||||
systemctl reload php*-fpm 2>/dev/null || true
|
systemctl reload php8.4-fpm 2>/dev/null || systemctl reload php8.2-fpm 2>/dev/null || systemctl reload php*-fpm 2>/dev/null || true
|
||||||
systemctl reload nginx 2>/dev/null || true
|
systemctl reload nginx 2>/dev/null || true
|
||||||
|
|
||||||
NEW_VER="Inconnue"
|
NEW_VER="Inconnue"
|
||||||
|
|||||||
@@ -659,12 +659,24 @@ class BackupManager
|
|||||||
// MÉTHODES PRIVÉES / UTILITAIRES
|
// MÉTHODES PRIVÉES / UTILITAIRES
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
|
private static function isSshpassInstalled(): bool
|
||||||
|
{
|
||||||
|
return file_exists('/usr/bin/sshpass') || !empty(trim((string)shell_exec('which sshpass 2>/dev/null')));
|
||||||
|
}
|
||||||
|
|
||||||
private static function runSshCommand(string $host, int $port, string $user, string $authType, string $password, string $cmd): array
|
private static function runSshCommand(string $host, int $port, string $user, string $authType, string $password, string $cmd): array
|
||||||
{
|
{
|
||||||
$sshOptions = "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=8 -p " . (int)$port;
|
$sshOptions = "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=8 -p " . (int)$port;
|
||||||
$target = escapeshellarg("{$user}@{$host}");
|
$target = escapeshellarg("{$user}@{$host}");
|
||||||
|
|
||||||
if ($authType === 'password') {
|
if ($authType === 'password') {
|
||||||
|
if (!self::isSshpassInstalled()) {
|
||||||
|
return [
|
||||||
|
'exit_code' => 1,
|
||||||
|
'output' => '',
|
||||||
|
'error' => "Le paquet 'sshpass' n'est pas installé sur le système pour l'authentification SSH par mot de passe. Installez-le avec : apt install -y sshpass",
|
||||||
|
];
|
||||||
|
}
|
||||||
$fullCmd = "sshpass -p " . escapeshellarg($password) . " ssh {$sshOptions} {$target} " . escapeshellarg($cmd);
|
$fullCmd = "sshpass -p " . escapeshellarg($password) . " ssh {$sshOptions} {$target} " . escapeshellarg($cmd);
|
||||||
} else {
|
} else {
|
||||||
$fullCmd = "ssh {$sshOptions} {$target} " . escapeshellarg($cmd);
|
$fullCmd = "ssh {$sshOptions} {$target} " . escapeshellarg($cmd);
|
||||||
@@ -713,6 +725,12 @@ class BackupManager
|
|||||||
$src = escapeshellarg($localFile);
|
$src = escapeshellarg($localFile);
|
||||||
|
|
||||||
if ($authType === 'password') {
|
if ($authType === 'password') {
|
||||||
|
if (!self::isSshpassInstalled()) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'message' => "Le paquet 'sshpass' n'est pas installé sur le système pour l'authentification SSH par mot de passe. Installez-le avec : apt install -y sshpass",
|
||||||
|
];
|
||||||
|
}
|
||||||
$scpCmd = "sshpass -p " . escapeshellarg($password) . " scp {$scpOptions} {$src} {$dest}";
|
$scpCmd = "sshpass -p " . escapeshellarg($password) . " scp {$scpOptions} {$src} {$dest}";
|
||||||
} else {
|
} else {
|
||||||
$scpCmd = "scp {$scpOptions} {$src} {$dest}";
|
$scpCmd = "scp {$scpOptions} {$src} {$dest}";
|
||||||
@@ -742,6 +760,12 @@ class BackupManager
|
|||||||
$dest = escapeshellarg($localDest);
|
$dest = escapeshellarg($localDest);
|
||||||
|
|
||||||
if ($authType === 'password') {
|
if ($authType === 'password') {
|
||||||
|
if (!self::isSshpassInstalled()) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'message' => "Le paquet 'sshpass' n'est pas installé sur le système pour l'authentification SSH par mot de passe. Installez-le avec : apt install -y sshpass",
|
||||||
|
];
|
||||||
|
}
|
||||||
$scpCmd = "sshpass -p " . escapeshellarg($password) . " scp {$scpOptions} {$src} {$dest}";
|
$scpCmd = "sshpass -p " . escapeshellarg($password) . " scp {$scpOptions} {$src} {$dest}";
|
||||||
} else {
|
} else {
|
||||||
$scpCmd = "scp {$scpOptions} {$src} {$dest}";
|
$scpCmd = "scp {$scpOptions} {$src} {$dest}";
|
||||||
|
|||||||
+6
-230
@@ -159,7 +159,7 @@ class Database
|
|||||||
max_channels INTEGER NOT NULL DEFAULT 0,
|
max_channels INTEGER NOT NULL DEFAULT 0,
|
||||||
match_ips TEXT NOT NULL DEFAULT '',
|
match_ips TEXT NOT NULL DEFAULT '',
|
||||||
context VARCHAR(64) NOT NULL DEFAULT 'from-external',
|
context VARCHAR(64) NOT NULL DEFAULT 'from-external',
|
||||||
inbound_dest VARCHAR(64) NOT NULL DEFAULT 'ivr-accueil',
|
inbound_dest VARCHAR(64) NOT NULL DEFAULT 'terminate-hangup',
|
||||||
did_routes_json TEXT NOT NULL DEFAULT '{}',
|
did_routes_json TEXT NOT NULL DEFAULT '{}',
|
||||||
outbound_prefix VARCHAR(32) NOT NULL DEFAULT '',
|
outbound_prefix VARCHAR(32) NOT NULL DEFAULT '',
|
||||||
custom_endpoint_params TEXT NOT NULL DEFAULT '',
|
custom_endpoint_params TEXT NOT NULL DEFAULT '',
|
||||||
@@ -331,61 +331,6 @@ class Database
|
|||||||
':p' => password_hash('admin123', PASSWORD_DEFAULT),
|
':p' => password_hash('admin123', PASSWORD_DEFAULT),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Données de démonstration initiales si la table extensions est vide
|
|
||||||
$extCount = (int)$db->query('SELECT COUNT(*) FROM extensions')->fetchColumn();
|
|
||||||
if ($extCount === 0) {
|
|
||||||
$stmtExt = $db->prepare('
|
|
||||||
INSERT INTO extensions (extension, name, secret, transport, encryption, codecs, max_contacts, enabled)
|
|
||||||
VALUES (:ext, :name, :secret, :transport, :encryption, :codecs, :max_contacts, 1)
|
|
||||||
');
|
|
||||||
$stmtExt->execute([
|
|
||||||
':ext' => '101',
|
|
||||||
':name' => 'Accueil Bureau (LAN)',
|
|
||||||
':secret' => 'LanPass101!Sip',
|
|
||||||
':transport' => 'udp',
|
|
||||||
':encryption' => 0,
|
|
||||||
':codecs' => 'alaw,ulaw,g722',
|
|
||||||
':max_contacts' => 2,
|
|
||||||
]);
|
|
||||||
$stmtExt->execute([
|
|
||||||
':ext' => '102',
|
|
||||||
':name' => 'Direction Nomade (TLS/SRTP)',
|
|
||||||
':secret' => 'TlsSecure102!Sip',
|
|
||||||
':transport' => 'tls',
|
|
||||||
':encryption' => 1,
|
|
||||||
':codecs' => 'opus,g722,alaw',
|
|
||||||
':max_contacts' => 3,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$stmtGrp = $db->prepare('
|
|
||||||
INSERT INTO groups (extension, name, strategy, ring_time, members, failover_dest)
|
|
||||||
VALUES (:ext, :name, :strategy, :ring_time, :members, :failover)
|
|
||||||
');
|
|
||||||
$stmtGrp->execute([
|
|
||||||
':ext' => '600',
|
|
||||||
':name' => 'Support Général',
|
|
||||||
':strategy' => 'ringall',
|
|
||||||
':ring_time' => 25,
|
|
||||||
':members' => json_encode(['101', '102']),
|
|
||||||
':failover' => 'hangup',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$stmtIvr = $db->prepare('
|
|
||||||
INSERT INTO ivrs (name, audio_file, timeout, options_json)
|
|
||||||
VALUES (:name, :audio, :timeout, :options)
|
|
||||||
');
|
|
||||||
$stmtIvr->execute([
|
|
||||||
':name' => 'ivr-accueil',
|
|
||||||
':audio' => 'custom/bienvenue-entreprise',
|
|
||||||
':timeout' => 5,
|
|
||||||
':options' => json_encode([
|
|
||||||
'1' => 'ext-101',
|
|
||||||
'2' => 'grp-600',
|
|
||||||
'0' => 'ext-102',
|
|
||||||
]),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function migrateSettingsTable(PDO $db): void
|
private static function migrateSettingsTable(PDO $db): void
|
||||||
@@ -539,7 +484,7 @@ class Database
|
|||||||
max_channels INTEGER NOT NULL DEFAULT 0,
|
max_channels INTEGER NOT NULL DEFAULT 0,
|
||||||
match_ips TEXT NOT NULL DEFAULT '',
|
match_ips TEXT NOT NULL DEFAULT '',
|
||||||
context VARCHAR(64) NOT NULL DEFAULT 'from-external',
|
context VARCHAR(64) NOT NULL DEFAULT 'from-external',
|
||||||
inbound_dest VARCHAR(64) NOT NULL DEFAULT 'ivr-accueil',
|
inbound_dest VARCHAR(64) NOT NULL DEFAULT 'terminate-hangup',
|
||||||
did_routes_json TEXT NOT NULL DEFAULT '{}',
|
did_routes_json TEXT NOT NULL DEFAULT '{}',
|
||||||
outbound_prefix VARCHAR(32) NOT NULL DEFAULT '',
|
outbound_prefix VARCHAR(32) NOT NULL DEFAULT '',
|
||||||
custom_endpoint_params TEXT NOT NULL DEFAULT '',
|
custom_endpoint_params TEXT NOT NULL DEFAULT '',
|
||||||
@@ -594,166 +539,17 @@ class Database
|
|||||||
|
|
||||||
private static function migrateOutboundRoutesTable(PDO $db): void
|
private static function migrateOutboundRoutesTable(PDO $db): void
|
||||||
{
|
{
|
||||||
$count = (int)$db->query('SELECT COUNT(*) FROM outbound_routes')->fetchColumn();
|
// Aucun enregistrement de démonstration auto-injecté pour conserver une base propre
|
||||||
if ($count === 0) {
|
|
||||||
// Vérifie quels trunks et postes existent déjà pour pré-initialiser la route sortante principale
|
|
||||||
$trunks = $db->query('SELECT name, outbound_callerid FROM trunks ORDER BY id ASC')->fetchAll();
|
|
||||||
$firstTrunkName = !empty($trunks) ? (string)$trunks[0]['name'] : 'ovh-telecom';
|
|
||||||
$firstTrunkCid = !empty($trunks) && trim((string)$trunks[0]['outbound_callerid']) !== ''
|
|
||||||
? trim((string)$trunks[0]['outbound_callerid'])
|
|
||||||
: 'Mon Entreprise <0123456789>';
|
|
||||||
|
|
||||||
$exts = $db->query('SELECT extension FROM extensions ORDER BY CAST(extension AS INTEGER) ASC')->fetchAll(PDO::FETCH_COLUMN);
|
|
||||||
$grps = $db->query('SELECT extension FROM groups ORDER BY CAST(extension AS INTEGER) ASC')->fetchAll(PDO::FETCH_COLUMN);
|
|
||||||
|
|
||||||
$stmt = $db->prepare('
|
|
||||||
INSERT INTO outbound_routes (
|
|
||||||
priority, name, outbound_callerid, override_ext_cid, route_password,
|
|
||||||
route_type, moh_class, trunk_sequence_json, dial_patterns_json,
|
|
||||||
permission_mode, allowed_groups_json, allowed_extensions_json,
|
|
||||||
continue_next_route, congestion_dest, record_mode, enabled
|
|
||||||
) VALUES (
|
|
||||||
:priority, :name, :cid, :override_cid, :pwd,
|
|
||||||
:rtype, :moh, :trunks, :patterns,
|
|
||||||
:pmode, :agroups, :aexts,
|
|
||||||
:cont, :cdest, :rec, 1
|
|
||||||
)
|
|
||||||
');
|
|
||||||
|
|
||||||
// Route 1 : OVH (principale)
|
|
||||||
$stmt->execute([
|
|
||||||
':priority' => 1,
|
|
||||||
':name' => 'OVH',
|
|
||||||
':cid' => $firstTrunkCid,
|
|
||||||
':override_cid' => 0,
|
|
||||||
':pwd' => '',
|
|
||||||
':rtype' => 'normal',
|
|
||||||
':moh' => 'default',
|
|
||||||
':trunks' => json_encode([$firstTrunkName]),
|
|
||||||
':patterns' => json_encode([
|
|
||||||
['prepend' => '', 'prefix' => '', 'match_pattern' => '0[1-59]XXXXXXXX', 'callerid' => ''],
|
|
||||||
['prepend' => '', 'prefix' => '', 'match_pattern' => '0[67]XXXXXXXX', 'callerid' => ''],
|
|
||||||
['prepend' => '', 'prefix' => '', 'match_pattern' => '080[0-9]XXXXXX', 'callerid' => ''],
|
|
||||||
]),
|
|
||||||
':pmode' => 'all',
|
|
||||||
':agroups' => json_encode($grps),
|
|
||||||
':aexts' => json_encode($exts),
|
|
||||||
':cont' => 1,
|
|
||||||
':cdest' => 'all-circuits-busy',
|
|
||||||
':rec' => 'dontcare',
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Route 2 : Emergency (Numéros d'urgence)
|
|
||||||
$stmt->execute([
|
|
||||||
':priority' => 2,
|
|
||||||
':name' => 'Emergency',
|
|
||||||
':cid' => $firstTrunkCid,
|
|
||||||
':override_cid' => 1,
|
|
||||||
':pwd' => '',
|
|
||||||
':rtype' => 'emergency',
|
|
||||||
':moh' => 'default',
|
|
||||||
':trunks' => json_encode([$firstTrunkName]),
|
|
||||||
':patterns' => json_encode([
|
|
||||||
['prepend' => '', 'prefix' => '', 'match_pattern' => '15', 'callerid' => ''],
|
|
||||||
['prepend' => '', 'prefix' => '', 'match_pattern' => '17', 'callerid' => ''],
|
|
||||||
['prepend' => '', 'prefix' => '', 'match_pattern' => '18', 'callerid' => ''],
|
|
||||||
['prepend' => '', 'prefix' => '', 'match_pattern' => '112', 'callerid' => ''],
|
|
||||||
['prepend' => '', 'prefix' => '', 'match_pattern' => '114', 'callerid' => ''],
|
|
||||||
]),
|
|
||||||
':pmode' => 'all',
|
|
||||||
':agroups' => json_encode($grps),
|
|
||||||
':aexts' => json_encode($exts),
|
|
||||||
':cont' => 1,
|
|
||||||
':cdest' => 'terminate-congestion',
|
|
||||||
':rec' => 'dontcare',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function migrateExtensionGroupsTable(PDO $db): void
|
private static function migrateExtensionGroupsTable(PDO $db): void
|
||||||
{
|
{
|
||||||
$count = (int)$db->query('SELECT COUNT(*) FROM extension_groups')->fetchColumn();
|
// Aucun enregistrement de démonstration auto-injecté pour conserver une base propre
|
||||||
if ($count === 0) {
|
|
||||||
$stmt = $db->prepare('INSERT INTO extension_groups (name, description, color, members) VALUES (:n, :d, :c, :m)');
|
|
||||||
$stmt->execute([
|
|
||||||
':n' => 'Groupe Nice',
|
|
||||||
':d' => 'Extensions du site secondaire (Trunk passerelle locale)',
|
|
||||||
':c' => 'emerald',
|
|
||||||
':m' => json_encode(['101', '102']),
|
|
||||||
]);
|
|
||||||
$stmt->execute([
|
|
||||||
':n' => 'Groupe Paris',
|
|
||||||
':d' => 'Extensions du site de Paris (Trunk principal OVH)',
|
|
||||||
':c' => 'indigo',
|
|
||||||
':m' => json_encode(['103']),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function migrateSoundsTable(PDO $db): void
|
private static function migrateSoundsTable(PDO $db): void
|
||||||
{
|
{
|
||||||
$count = (int)$db->query('SELECT COUNT(*) FROM sounds')->fetchColumn();
|
// Aucun enregistrement de démonstration auto-injecté pour conserver une base propre
|
||||||
if ($count === 0) {
|
|
||||||
$stmt = $db->prepare('
|
|
||||||
INSERT INTO sounds (name, slug, site_category, usage_type, description, filename, original_filename, duration_sec, file_size, format)
|
|
||||||
VALUES (:name, :slug, :site, :usage, :desc, :file, :orig, :dur, :size, :fmt)
|
|
||||||
');
|
|
||||||
|
|
||||||
$demoSounds = [
|
|
||||||
[
|
|
||||||
':name' => 'Message d\'accueil SVI Standard',
|
|
||||||
':slug' => 'bienvenue-entreprise',
|
|
||||||
':site' => 'Global',
|
|
||||||
':usage' => 'ivr',
|
|
||||||
':desc' => 'Jingle d\'accueil principal du serveur vocal interactif',
|
|
||||||
':file' => 'bienvenue-entreprise.wav',
|
|
||||||
':orig' => 'bienvenue-entreprise.wav',
|
|
||||||
':dur' => 2,
|
|
||||||
':size' => 31800,
|
|
||||||
':fmt' => 'wav',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
':name' => 'Musique d\'attente Standard',
|
|
||||||
':slug' => 'attente-musicale-standard',
|
|
||||||
':site' => 'Global',
|
|
||||||
':usage' => 'moh',
|
|
||||||
':desc' => 'Mélodie douce d\'attente (MoH) par défaut pour les appels mis en garde',
|
|
||||||
':file' => 'attente-musicale-standard.wav',
|
|
||||||
':orig' => 'attente-musicale-standard.wav',
|
|
||||||
':dur' => 4,
|
|
||||||
':size' => 63600,
|
|
||||||
':fmt' => 'wav',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
':name' => 'Message Ligne Occupée & Congestion',
|
|
||||||
':slug' => 'ligne-occupee-congestion',
|
|
||||||
':site' => 'Global',
|
|
||||||
':usage' => 'congestion',
|
|
||||||
':desc' => 'Tonalité cadencée d\'occupation si aucun trunk ou poste n\'est disponible',
|
|
||||||
':file' => 'ligne-occupee-congestion.wav',
|
|
||||||
':orig' => 'ligne-occupee-congestion.wav',
|
|
||||||
':dur' => 1,
|
|
||||||
':size' => 16000,
|
|
||||||
':fmt' => 'wav',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
':name' => 'Annonce Fermeture Nice',
|
|
||||||
':slug' => 'annonce-fermeture-nice',
|
|
||||||
':site' => 'Site Nice',
|
|
||||||
':usage' => 'announcement',
|
|
||||||
':desc' => 'Message informant des horaires d\'ouverture du bureau de Nice',
|
|
||||||
':file' => 'annonce-fermeture-nice.wav',
|
|
||||||
':orig' => 'annonce-fermeture-nice.wav',
|
|
||||||
':dur' => 2,
|
|
||||||
':size' => 28800,
|
|
||||||
':fmt' => 'wav',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($demoSounds as $ds) {
|
|
||||||
$stmt->execute($ds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function migrateSoundSitesTable(PDO $db): void
|
private static function migrateSoundSitesTable(PDO $db): void
|
||||||
@@ -762,8 +558,6 @@ class Database
|
|||||||
if ($count === 0) {
|
if ($count === 0) {
|
||||||
$stmt = $db->prepare('INSERT INTO sound_sites (name, description) VALUES (:n, :d)');
|
$stmt = $db->prepare('INSERT INTO sound_sites (name, description) VALUES (:n, :d)');
|
||||||
$stmt->execute([':n' => 'Global', ':d' => 'Fichiers généraux partagés par tout le PBX']);
|
$stmt->execute([':n' => 'Global', ':d' => 'Fichiers généraux partagés par tout le PBX']);
|
||||||
$stmt->execute([':n' => 'Site Nice', ':d' => 'Annonces et musiques spécifiques au site de Nice']);
|
|
||||||
$stmt->execute([':n' => 'Site Paris', ':d' => 'Annonces et musiques spécifiques au site de Paris']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -954,25 +748,7 @@ class Database
|
|||||||
);
|
);
|
||||||
");
|
");
|
||||||
|
|
||||||
$count = (int)$db->query('SELECT COUNT(*) FROM paging_groups')->fetchColumn();
|
// Aucun groupe de paging par défaut pour conserver une base propre
|
||||||
if ($count === 0) {
|
|
||||||
$exts = $db->query('SELECT extension FROM extensions ORDER BY CAST(extension AS INTEGER) ASC')->fetchAll(PDO::FETCH_COLUMN);
|
|
||||||
$members = !empty($exts) ? $exts : ['101', '102'];
|
|
||||||
$stmt = $db->prepare('
|
|
||||||
INSERT INTO paging_groups (extension, name, description, members, duplex, busy_mode, play_beep, timeout, enabled)
|
|
||||||
VALUES (:ext, :name, :desc, :members, :duplex, :busy_mode, :play_beep, :timeout, 1)
|
|
||||||
');
|
|
||||||
$stmt->execute([
|
|
||||||
':ext' => '100',
|
|
||||||
':name' => 'Téléavertissement Général',
|
|
||||||
':desc' => 'Diffusion générale sur haut-parleur de tous les postes',
|
|
||||||
':members' => json_encode($members),
|
|
||||||
':duplex' => 0,
|
|
||||||
':busy_mode' => 'skip',
|
|
||||||
':play_beep' => 1,
|
|
||||||
':timeout' => 120,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +110,8 @@ class PhonebookManager
|
|||||||
if (!empty($activeExtIds)) {
|
if (!empty($activeExtIds)) {
|
||||||
$inClause = implode(',', $activeExtIds);
|
$inClause = implode(',', $activeExtIds);
|
||||||
$db->exec("DELETE FROM phonebook_contacts WHERE is_internal = 1 AND extension_id IS NOT NULL AND extension_id NOT IN ({$inClause})");
|
$db->exec("DELETE FROM phonebook_contacts WHERE is_internal = 1 AND extension_id IS NOT NULL AND extension_id NOT IN ({$inClause})");
|
||||||
|
} else {
|
||||||
|
$db->exec("DELETE FROM phonebook_contacts WHERE is_internal = 1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-6
@@ -1,13 +1,12 @@
|
|||||||
{
|
{
|
||||||
"version": "1.3.1",
|
"version": "1.4.0",
|
||||||
"codename": "Helios",
|
"codename": "Helios",
|
||||||
"release_date": "2026-11-04",
|
"release_date": "2026-11-04",
|
||||||
"min_php_version": "8.2",
|
"min_php_version": "8.2",
|
||||||
"changelog": [
|
"changelog": [
|
||||||
"Badge de notification automatique de mise à jour dans l'en-tête (à côté du test AMI)",
|
"Lissage élégant des graphiques CPU/RAM et Réseau (splines Bézier cubiques sans angles vifs)",
|
||||||
"Vérification intelligente en tâche de fond toutes les 24h sans solliciter le serveur",
|
"Amélioration des transitions et gradients dynamiques sur les graphiques du tableau de bord",
|
||||||
"Accès direct 1-clic aux détails et à l'installation des mises à jour",
|
"Mise à jour instantanée du numéro de version sur tous les badges sans aucun délai de cache navigateur",
|
||||||
"Gestion avancée des passerelles analogiques / FXO (Grandstream HT813, Cisco SPA)",
|
"Invalidation automatique du cache local et rechargement propre anti-cache après chaque mise à jour"
|
||||||
"Message vocal d'indisponibilité / congestion configurable sur les routes sortantes"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user