Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

feat: Configure TTS voice name in config

Clémence Lesnéb780e2190f85
diff --git a/README.md b/README.md
index 88c8717..f64be8d 100644
--- a/README.md
+++ b/README.md
@@ -102,6 +102,7 @@ communication_service:
access_key: xxx
endpoint: https://xxx.france.communication.azure.com
phone_number: "+33612345678"
+ voice_name: fr-FR-DeniseNeural
cognitive_service:
# Must be of type "Azure AI services multi-service account"
diff --git a/helpers/config_models/communication_service.py b/helpers/config_models/communication_service.py
index bce8549..347d36c 100644
--- a/helpers/config_models/communication_service.py
+++ b/helpers/config_models/communication_service.py
@@ -5,3 +5,4 @@ class CommunicationServiceModel(BaseModel):
access_key: SecretStr
endpoint: str
phone_number: str
+ voice_name: str
diff --git a/main.py b/main.py
index 33383b2..e21766e 100644
--- a/main.py
+++ b/main.py
@@ -720,7 +720,11 @@ def audio_from_text(text: str) -> TextSource:
f"Text is too long to be processed by TTS, truncating to 400 characters, fix this!"
)
text = text[:400]
- return TextSource(text=text, voice_name="fr-FR-DeniseNeural", source_locale=CONFIG.workflow.conversation_lang)
+ return TextSource(
+ source_locale=CONFIG.workflow.conversation_lang,
+ text=text,
+ voice_name=CONFIG.communication_service.voice_name,
+ )
def callback_url(caller_id: str) -> str: