.
This commit is contained in:
@@ -67,11 +67,13 @@ class FillerAudioLibrary:
|
|||||||
{key: len(value) for key, value in self._clips.items()},
|
{key: len(value) for key, value in self._clips.items()},
|
||||||
)
|
)
|
||||||
|
|
||||||
def pick(self, key: str | None = None) -> bytes | None:
|
def pick(self, key: str | None = None, *, allow_fallback: bool = True) -> bytes | None:
|
||||||
if not self._enabled:
|
if not self._enabled:
|
||||||
return None
|
return None
|
||||||
normalized_key = (key or "").strip().lower() or "generic"
|
normalized_key = (key or "").strip().lower() or "generic"
|
||||||
candidates = self._clips.get(normalized_key) or self._clips.get("generic") or []
|
candidates = self._clips.get(normalized_key) or []
|
||||||
|
if not candidates and allow_fallback:
|
||||||
|
candidates = self._clips.get("generic") or []
|
||||||
if not candidates:
|
if not candidates:
|
||||||
LOGGER.info("filler audio pick missed: key=%s available=%s", normalized_key, list(self._clips))
|
LOGGER.info("filler audio pick missed: key=%s available=%s", normalized_key, list(self._clips))
|
||||||
return None
|
return None
|
||||||
|
|||||||
+5
-1
@@ -1840,7 +1840,11 @@ class CallSession:
|
|||||||
) -> None:
|
) -> None:
|
||||||
first_audio_seen = False
|
first_audio_seen = False
|
||||||
started_monotonic = time.perf_counter()
|
started_monotonic = time.perf_counter()
|
||||||
cached_greeting = self._filler_audio.pick("initial_greeting") if self._filler_audio is not None else None
|
cached_greeting = (
|
||||||
|
self._filler_audio.pick("initial_greeting", allow_fallback=False)
|
||||||
|
if self._filler_audio is not None
|
||||||
|
else None
|
||||||
|
)
|
||||||
if cached_greeting:
|
if cached_greeting:
|
||||||
await self._play_cached_initial_greeting(
|
await self._play_cached_initial_greeting(
|
||||||
epoch=epoch,
|
epoch=epoch,
|
||||||
|
|||||||
Reference in New Issue
Block a user