fix(api): fix endpoint quoting in pjsip send notify command

This commit is contained in:
sorcier committed 2026-11-06 02:05:33 +01:00
1 parent 7fd75fbff4
commit 040a4d646f
1 file changed
+6 -1
+6 -1
View File
@@ -495,9 +495,14 @@ try {
throw new InvalidArgumentException("Poste {$extension} introuvable."); throw new InvalidArgumentException("Poste {$extension} introuvable.");
} }
$cleanExt = preg_replace('/[^a-zA-Z0-9_\-]/', '', $extension);
try { try {
$ami = AmiClient::fromDatabase($db); $ami = AmiClient::fromDatabase($db);
$cmdOutput = $ami->runCommand("pjsip send notify reboot endpoint " . escapeshellarg($extension)); $cmdOutput = $ami->runCommand("pjsip send notify reboot endpoint {$cleanExt}");
if (stripos($cmdOutput, 'Unable to') !== false) {
throw new RuntimeException("Échec Asterisk : " . trim($cmdOutput));
}
echo json_encode([ echo json_encode([
'success' => true, 'success' => true,
'message' => "Ordre de redémarrage envoyé au poste {$extension} ({$extRow['name']}).", 'message' => "Ordre de redémarrage envoyé au poste {$extension} ({$extRow['name']}).",