Skip to main content

Access voice variables within a flow in studio

1. Types of voice variables

Voice bot variables are similar to regular variables, with the only difference being the way they are acquired. There are two types of voice variables that can be utilized in the process of building a flow in studio:

  1. Bot variables: These variables are automatically available to the bot at the beginning of the voice call.
  2. CDR variables: These variables are obtained once the call is terminated and are the CDR values that are created for reporting purposes.

2. Access voice variable values

To work with conversational details reports or call and conversational details reports, you may require access to voice variables (default and CDR). To push the necessary values into the database node and tables, you must create variables. Follow the steps below:

  1. Open the variables tab and add a variable by selecting Global variable.
  2. Add a custom variable name and select the variable data type (usually a string). Add the value (you can only use the variables given in the section below) and click Add.

To learn more about variables, visit this page.


Once the call is initiated, these voice bot variables (global variables) are accessible throughout the flows in the bot. To retrieve these variables, use the following format:

FormatDatatypeDescription
{{{data.call_sid}}}StringA unique identifier assigned to each voice call
{{{data.recording_url}}}StringThe downloadable URL of the ongoing call
{{{data.from}}}StringThe phone number the call was made from
{{{data.to}}}StringThe phone number the voice bot called
{{{data.direction}}}StringInbound or outbound call
{{{data.detected_language}}}StringThe language of the conversation that was identified (only present when auto-detect option is enabled)

Additional details are only obtained after the callback event is triggered, which can be retrieved by creating a new flow that executes after the call ends. To retrieve these details, use the following format:

FormatDatatypeDescription
{{variables.EVENT_DATA.duration}}StringThe total duration of the call, including ring time, agent transfer, etc.
{{variables.EVENT_DATA.voice_bot_duration}}StringThe duration for which the voice bot was speaking
{{variables.EVENT_DATA.voice_bot_bill_duration}}StringThe duration considered for billing purposes
{{variables.EVENT_DATA.disconnected_by}}StringThe entity responsible for disconnecting the call (either Bot or User)
{{variables.EVENT_DATA.status}}StringThe call status (answered, not answered, or failed)