feat(sounds): absolute audio paths for custom sounds making IVRs fully language-agnostic (v1.5.0)
This commit is contained in:
1 parent
6c74e09203
commit
accec47d08
4 files changed
+15
-9
No files matched your search
@@ -2219,18 +2219,24 @@ class ConfigGenerator
|
||||
$stmt = $this->db->prepare('SELECT slug FROM sounds WHERE id = :id');
|
||||
$stmt->execute([':id' => (int)$soundRef]);
|
||||
$slug = $stmt->fetchColumn();
|
||||
return $slug ? "custom/{$slug}" : $fallback;
|
||||
return $slug ? "/var/lib/asterisk/sounds/custom/{$slug}" : $fallback;
|
||||
}
|
||||
$ref = trim((string)$soundRef);
|
||||
if (str_starts_with($ref, 'sound-')) {
|
||||
return $this->resolveSoundFile(substr($ref, 6), $fallback);
|
||||
}
|
||||
if (str_starts_with($ref, 'custom/')) {
|
||||
return "/var/lib/asterisk/sounds/{$ref}";
|
||||
}
|
||||
if (str_starts_with($ref, '/var/lib/asterisk/sounds/custom/')) {
|
||||
return $ref;
|
||||
}
|
||||
if (!str_contains($ref, '/') && !in_array($ref, ['demo-instruct', 'demo-echotest', 'pbx-invalid', 'hello-world', 'beep', 'silence/1', 'vm-goodbye'])) {
|
||||
$stmt = $this->db->prepare('SELECT slug FROM sounds WHERE slug = :slug OR name = :name');
|
||||
$stmt->execute([':slug' => $ref, ':name' => $ref]);
|
||||
$slug = $stmt->fetchColumn();
|
||||
if ($slug) {
|
||||
return "custom/{$slug}";
|
||||
return "/var/lib/asterisk/sounds/custom/{$slug}";
|
||||
}
|
||||
}
|
||||
return $ref ?: $fallback;
|
||||
|
||||
Reference in new issue
Block a user