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:
- Bot variables: These variables are automatically available to the bot at the beginning of the voice call.
- 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:
- Open the variables tab and add a variable by selecting Global variable.
- 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.
Variables related for ongoing calls
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:
Format | Datatype | Description |
---|---|---|
{{{data.call_sid}}} | String | A unique identifier assigned to each voice call |
{{{data.recording_url}}} | String | The downloadable URL of the ongoing call |
{{{data.from}}} | String | The phone number the call was made from |
{{{data.to}}} | String | The phone number the voice bot called |
{{{data.direction}}} | String | Inbound or outbound call |
{{{data.detected_language}}} | String | The language of the conversation that was identified (only present when auto-detect option is enabled) |
Variables related for disconnected calls
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:
Format | Datatype | Description |
---|---|---|
{{variables.EVENT_DATA.duration}} | String | The total duration of the call, including ring time, agent transfer, etc. |
{{variables.EVENT_DATA.voice_bot_duration}} | String | The duration for which the voice bot was speaking |
{{variables.EVENT_DATA.voice_bot_bill_duration}} | String | The duration considered for billing purposes |
{{variables.EVENT_DATA.disconnected_by}} | String | The entity responsible for disconnecting the call (either Bot or User) |
{{variables.EVENT_DATA.status}} | String | The call status (answered, not answered, or failed) |