Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Dialogflow CX - How to use SSML

SSML is not working for VOICE call responses and it fact it makes the agent crash (the voice call just drops). The documentation suggest that Text and Output audio text support SSML, but no matter how I configure it either crashed (drops the call) or it doesn't recognized it and I hear "Less than speak greater than... etc etc"

Ref: Fulfillments  |  Dialogflow CX  |  Google Cloud

IVrol_0-1729784566930.png

 

Solved Solved
0 5 1,647
1 ACCEPTED SOLUTION

After checking with Support, the logs indicated that the voice I was using does not support SSML - I haven't found documentation on which voices do or do not support SSML

View solution in original post

5 REPLIES 5

Hi @IV-rol.,

Welcome to Google Cloud Community!

You're experiencing a common issue with SSML in Dialogflow CX voice calls. Although the documentation indicates that SSML is supported for text and output audio, there are certain limitations and potential misconfigurations that can cause call drops or unexpected outputs like the "less than, greater than" readout.

Here’s a summary of potential problems and troubleshooting steps:

1. SSML Compatibility and Implementation:

  • Platform Limitations: While Dialogflow CX supports SSML, the underlying Google Cloud Text-to-Speech engine may not fully support all SSML tags in voice call fulfillments. Some tags might work well in other contexts but could cause issues in real-time interactions. For example, the <say-as> tag is usually reliable, but incorrect usage or unusual phone number formats can lead to problems.
  • Parameter Issues: The way you're using $session.params.phonenumber in your SSML might be causing the issue. Ensure this parameter consistently holds a valid phone number format before integrating it into the SSML. Incorrect formatting (such as extra characters or mishandled international prefixes) can lead to speech synthesis errors.
  • SSML Tag Nesting and Syntax: Verify your SSML for syntax errors. Improper nesting or missing closing tags can lead to failures. A single misplaced character can result in unexpected behavior. Use an online SSML validator to check for simple syntax issues.

2. Troubleshooting Steps:

  • Simplify Your SSML: Start with a basic SSML example to isolate the problem. Remove complex elements like the <say-as> tag and see if simple <speak> tags function properly. Gradually reintroduce other elements to identify the source of the crash.
  • Format the Phone Number: Before using the phone number in SSML, add a validation step in your Dialogflow agent to ensure it’s properly formatted. Consider using a regular expression for validation before sending it to SSML.
  • Test with a Static Phone Number: Replace $session.params.phonenumber with a known valid phone number (e.g., "+15551234567") to rule out issues with parameter extraction or formatting. If this works, the problem likely lies in your parameter handling.
  • Check Dialogflow Logs: Review your Dialogflow logs for error messages when the call drops. These logs can provide important insights into the failure's source (e.g., SSML parsing or fulfillment errors).
  • Alternative Approach (Without SSML): If SSML continues to be problematic, consider omitting the <say-as> tag. You could rephrase the message to ensure clarity, such as: 

 

<speak>Thank you, $session.params.Name. The number I heard was $session.params.phonenumber. Is that correct?</speak>

 

While less elegant, this approach may be more reliable if SSML fails.

Example of Improved SSML:

 

<speak>Thank you <say-as interpret-as="name">$session.params.Name</say-as>. The number I heard was <say-as interpret-as="telephone">
  <say-as interpret-as="digits">$session.params.phonenumber</say-as>
</say-as>. Is that correct?</speak>

 

This example uses nested <say-as> tags to clarify the number as digits and then as a telephone number. Adjust the formatting for different regional numbers to enhance compatibility with speech synthesis.

Please refer to the SSML document for examples and tips for using SSML or in Text-to-Speech public docs.

I hope the above information is helpful.

Hi @dawnberdan, thanks for responding.
I unfortunately already tried simple SSML configuration without success. and even using a static value like you suggested.

IVrol_0-1730239504028.png

Where could I find the logs that will indicate the underlying problem? What is see under Conversation History does not help.

Hi @IV-rol,

The issue likely lies not within the SSML itself, but rather in how your Dialogflow agent processes the $session.params.NewPhoneContact.ANI parameter. The SSML is properly formatted to include the parameter; the concern is whether that parameter is populated correctly before the response is generated.

You should review the logs related to your Dialogflow agent's execution to find the context in which the agent attempts to evaluate $session.params.NewPhoneContact.ANI. The exact location of these logs depends on your Dialogflow deployment and logging configuration, so there isn’t a single universal location.

Here’s how to troubleshoot:

1. Verify Parameter Population: Ensure theNewPhoneContact.ANIparameter is correctly set within your Dialogflow agent before this response is triggered. It likely needs to be populated by a previous intent or webhook interaction.

2. Check Dialogflow Logs: Look for detailed logs in the Dialogflow console. The location may vary depending on your project setup, but generally, you should look for:

  • Dialogflow Logs: The Dialogflow console typically contains logs related to agent execution, which may indicate if the parameter was empty, null, or otherwise incorrectly populated.
  • Cloud Logging (if applicable): If your Dialogflow agent utilizes Cloud Functions or other Google Cloud services, these may log to Google Cloud Logging. Search these logs using your Dialogflow agent's identifier or related information.
  • Webhook Logs (if applicable): If you’re using a webhook to populate NewPhoneContact.ANI, check the logs from your webhook’s environment (e.g., Cloud Functions logs, your server’s logs) to see what value it sends to Dialogflow.

3. Debugging Techniques:

  • Use a Simple Test: Temporarily replace $session.params.NewPhoneContact.ANI in your Dialogflow agent with a hardcoded test value (like "555-1212"). If that works, it indicates the SSML and response configuration are correct, and the issue lies with parameterization.
  • Console Logging (if possible): If you can add debug logging to your webhook, print the contents of NewPhoneContact.ANI before it’s sent to Dialogflow to verify the data.
  • Break Down the Parameter: If the parameter is complex, try testing $session.params.NewPhoneContact first to confirm that part exists. Then check if ANI is a property of that object.

I hope it helps!

I appreciate the explanation, but this is surely an SSML problem. The variable has data, I can see the result on the chat test and while calling I have a previous fulfillment that say "Your number is one million, two thousand etc etc".

IVrol_0-1730296578456.png

The conversation history does not how an error it stops at the previous response "what is your name?" I respond Bob Smith and then the call drops. The Logs Explorer doesn't show anything either.

I'll try to open a support ticket - Thanks.

IVrol_1-1730296937114.png

 

After checking with Support, the logs indicated that the voice I was using does not support SSML - I haven't found documentation on which voices do or do not support SSML