From 4cf53c97198929d20d0e52a60d316b8d2a7cec3f Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 19 Jul 2022 12:02:54 -0600 Subject: [PATCH] Work around for FreeSWITCH bug where .loc break Music on Hold. Fixed in the following commit. https://github.com/signalwire/freeswitch/pull/1577 The commit was accepted. Hoping the bug fix is included in the next release of FreeSWITCH 1.10.8. However we need a work around for those using older versions and 1.10.8 hasn't been released yet. --- app/music_on_hold/music_on_hold.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/music_on_hold/music_on_hold.php b/app/music_on_hold/music_on_hold.php index e6e22c4874..f0228417c3 100644 --- a/app/music_on_hold/music_on_hold.php +++ b/app/music_on_hold/music_on_hold.php @@ -229,6 +229,7 @@ //define default path if ($action == "add") { $stream_path = path_join($_SESSION['switch']['sounds']['dir'], 'music', $_SESSION['domain_name'], $stream_name, $path_rate); + $stream_path = str_replace('.loc', '._loc', $stream_path); // 14.03.22 freeswitch bug } //find whether the path already exists @@ -277,6 +278,13 @@ //check target folder, move uploaded file if (!is_dir($stream_path)) { mkdir($stream_path, 0770, true); + + // 14.03.22 freeswitch bug - shouldn't be needed with freeswitch 1.10.8 + if (preg_match('|^(/usr/share/freeswitch/sounds/music/(.*?\._loc.*?))/|', $stream_path, $m)) { + $fs_bug_target = $m[2]; + $fs_bug_link = str_replace('._loc', '.loc', $m[1]); + symlink($fs_bug_target, $fs_bug_link); + } } if (is_dir($stream_path)) { if (copy($stream_file_name_temp, $stream_path.'/'.$stream_file_name)) {