copyright: years: 2017, 2023 lastupdated: "2023-01-08"
Action tags and state variables in the Voice Gateway API
The IBM® Voice Gateway API provides action tags and state variables that you define within the dialog in the Watson Assistant service. Action tags initiate actions that Voice Gateway takes during a conversation session, and state variables define Voice Gateway characteristics that persist throughout the conversation unless otherwise changed.
For more information about using the API, see Programming self-service agents and Defining actions and states.
The following sections list the action tags and state variables that you can define.
State variables
To indicate a change of state that remains between conversation turns, Voice Gateway exchanges state variables with the configured Watson Assistant service. These state variables are defined on a Watson Assistant dialog node as context variables in JSON format.
The following tables outline all of the state variables that are supported by Voice Gateway.
Variables set in the Watson Assistant dialog
You can set the following state variables within the Watson Assistant dialog to modify the Voice Gateway behavior. If a variable that has a related configuration environment variable isn't set, the value from the related environment variable is used.
| State variable name | Expected value | Description | Related configuration variable |
|---|---|---|---|
| vgwTransferTarget | SIP or telephone URI | Identifies the transfer to endpoint (e.g. tel:+18883334444). | TRANSFER_DEFAULT_TARGET |
| vgwTransferTargetHeader | User defined | Specifies which header field in a SIP BYE request to set as the transfer target when transferMethod is set to HANGUP. By default, Transfer-Target is used. Version 1.0.0.5a and later. |
|
| vgwTransferHeader | User defined | Defines a custom header in an outgoing SIP REFER message during a transfer. The custom header value is defined by the vgwTransferHeaderVal state variable. |
|
| vgwTransferHeaderVal | User defined | Defines the value of a custom header in an outgoing SIP REFER message during a transfer. The custom header itself is defined by the vgwTransferHeader state variable. |
|
| vgwUUIData | User defined | Defines User-to-User Information (UUI) data to send in an outgoing SIP REFER message during a transfer. Version 1.0.0.4c and later. |
|
| vgwUUISendMethod | uuiHeader / contactHeader / referToURL |
The method by which the User-to-User Information (UUI) data is sent. By default, the UUI data is sent in the User-to-User header field. Version 1.0.0.4c and later. The following values are supported:
Contact or Refer-To header field, the data is encoded as a URI header. If the Refer-To header value is a tel URL, the UUI data is sent as a URL parameter. |
|
| vgwByeCustomHeader | User defined | Defines a custom header in an outgoing SIP BYE message. The custom header value is defined by the vgwByeCustomHeaderVal state variables. Version 1.0.0.2 and later. |
|
| vgwByeCustomHeaderVal | User defined | Defines the value of a custom header in an outgoing SIP BYE message. The custom header is defined by the vgwByeCustomHeader state variables. |
|
| vgwFinalUtteranceTimeout | Time in ms | The amount of time in milliseconds that Voice Gateway waits to receive a final utterance from the Speech to Text service. The timeout occurs if Voice Gateway does not receive a final utterance within the specified time limit, even if hypotheses continue to be generated. When the timeout occurs, Voice Gateway sends Watson Assistant a text update with the word "vgwFinalUtteranceTimeout" to indicate that no final utterance was received. Version 1.0.0.4c and later. | FINAL_UTTERANCE_TIMEOUT |
| vgwPostResponseTimeoutCount | Time in ms | The amount of time in milliseconds to wait for a new utterance after the response is played back to the caller. If this value is exceeded, the Watson Assistant receives a text update with the word "vgwPostResponseTimeout" to indicate that a timeout occurred. | POST_RESPONSE_TIMEOUT |
| vgwConversationResponseTimeout | Time in ms | The amount of time in milliseconds that Voice Gateway waits to receive a response from Watson Assistant. If the time is exceeded, Voice Gateway tries again to contact Watson Assistant. If the service still can't be reached, the call fails. Version 1.0.0.3 and later. | WATSON_CONVERSATION_READ_TIMEOUT |
| vgwTransferFailedMessage | Text string | If the vgwDisconnectCallOnTransferFailure parameter is set to Yes, the message that is streamed to the caller if the call transfer fails. Configure your Watson Assistant dialog to set this variable on the first
turn. |
TRANSFER_FAILED_REPLY_MESSAGE |
| vgwTransferFailedAudioURL | User defined | A URL to an audio file that is played if the Text to Speech service can't be contacted when the Voice Gateway attempts to play back the vgwTransferFailedMessage message. Configure your Watson Assistant dialog to set this variable on the first turn. | TRANSFER_FAILED_REPLY_AUDIO_URL |
| vgwDisconnectCallOnTransferFailure | Yes / No |
Informs Voice Gateway whether to disconnect the call when a call transfer fails. When set to No, Voice Gateway initiates a conversation turn by sending "vgwCallTransferFailed" text to Watson Assistant.
Then, Watson Assistant can either disconnect the call or transfer it to a different destination as configured in the dialog. Version 1.0.0.2 or later. |
DISCONNECT_CALL_ON_TRANSFER_FAILURE |
| vgwConversationFailedMessage | Text string | Message streamed to the caller when a call is being transferred / disconnected due to a failure of one of the Watson services. Configure your Watson Assistant dialog to set this variable on the first turn. | CONVERSATION_FAILED_REPLY_MESSAGE |
| vgwConversationFailedAudioURL | User defined | A URL to an audio file that is played if the Text to Speech service can't be contacted when the Voice Gateway attempts to play back the vgwConversationFailedMessage message. Configure your Watson Assistant dialog to set this variable on the first turn. | CONVERSATION_FAILED_REPLY_AUDIO_URL |
| vgwSessionInactivityTimeout | Time in min | Inactivity timeout interval. The timeout interval value specifies in minutes how long the Voice Gateway allows a session to be inactive. When the timeout expires, the Voice Gateway ends the session. | SESSION_INACTIVITY_TIMEOUT |
| vgwErrAudioURL | User defined | A URL to an audio file that is played if the Text to Speech service can't be contacted when the Voice Gateway attempts to play back a response. The audio file must be in WAV format. Version 1.0.0.2 and later. |
|
| vgwDisconnectCallOnNoUserInputTurnCount | User defined | Informs the Voice Gateway whether to disconnect the call on consecutive post response timeouts. Determines the number of consecutive post response timeouts to allow before the call is disconnected. Version 1.0.6 or later. | DISCONNECT_CALL_ON_NO_USER_INPUT_TURN_COUNT |
Variables set by Voice Gateway
Important: Some state variables require that you set an associated environment variable in the Voice Gateway configuration. The value that you define in the configuration is then passed to Watson Assistant on the state variable. The following table lists each state variable and its related environment variable, if applicable.
Variables that don't have a related configuration environment variable are always enabled.
| State variable name | Expected value | Description | Related configuration variable |
|---|---|---|---|
| vgwSessionID | User defined | A custom session ID header pulled from the SIP INVITE request. The value represents the global session ID that is used in all Voice Gateway audit logs related to the session. | CUSTOM_SIP_SESSION_HEADER |
| vgwSIPCallID | SIP Call-ID | The SIP call ID associated with the conversation session. | SEND_SIP_CALL_ID_TO_CONVERSATION |
| vgwSIPRequestURI | SIP Request URI | The SIP request URI that started the conversation session. | SEND_SIP_REQUEST_URI_TO_CONVERSATION |
| vgwSIPToURI | SIP To URI | The SIP To URI associated with the conversation session. | SEND_SIP_TO_URI_TO_CONVERSATION |
| vgwSIPFromURI | SIP From URI | The SIP From URI associated with theWatson Assistant service. | SEND_SIP_FROM_URI_TO_CONVERSATION |
| vgwSIPCustomInviteHeader | User defined | A user-defined SIP header that is pulled from the initial SIP INVITE request and passed to the Watson Assistant service. | CUSTOM_SIP_INVITE_HEADER |
| vgwSIPCustomInviteHeaders | User defined | A user-defined list of SIP headers that are pulled from the initial SIP INVITE request and passed to the Watson Assistant service. For example: "vgwSIPCustomInviteHeaders":{ |
CUSTOM_SIP_INVITE_HEADERS |
| vgwBargeInOccurred | Yes / No |
Indicates whether barge-in occurred. | None |
| vgwHangUp | Yes / No |
Indicates whether the conversation session was ended. | None |
| vgwHangupReason | String | When a hang up is initiated either by the caller or because of an error, this variable is sent to Watson Assistant to indicate why the call was disconnected. The text in the message request that is sent to Watson Assistant also includes "vgwHangUp". | None |
| vgwCallTransferred | Yes |
Indicates that the call was transferred. Version 1.0.0.2 and later. | None |
| vgwTransferReason | String | Indicates the reason why a call was transferred. Version 1.0.0.2 and later. | None |
| vgwCallTransferFailed | Yes |
Indicates that the call transfer failed. When this variable is set, the text field contains the string "vgwCallTransferFailed". Version 1.0.0.2 and later. | None |
| vgwSTTResponse | JSON object | The final response from the Speech to Text service in JSON format, including the transcript and confidence score for the top hypothesis and any alternatives. Replaces vgwTextAlternatives in Version 1.0.0.2 and later.
The format matches exactly the format that is received from the Speech to Text service:
|
None |
| vgwIsDTMF | Yes / No |
Indicates whether the input to Watson Assistant is dual-tone multi-frequency signaling (DTMF). Version 1.0.0.1 and later. | None |
| vgwDTMFCollectionSucceeded | Yes/No |
Variable sent to Voice Gateway from Watson Assistant to indicate whether the DTMF collection succeeded or failed. When Yes, a DTMF collection succeeded, and returns the expected number of digits. When No, a
DTMF collection failed, and didn't collect the specified number of digits. Even when No, all collected digits are passed to the SOE or workspace in the input string of the turn request. Version 1.0.0.7 and later. |
None |
| vgwNetworkWarnings | JSON array | An array of network warnings that occurred during the Watson Assistant turn. To send network warnings, RTCP must be enabled. Version 1.0.0.5 and later. | None |
| vgwReceivedOnChannel | SMS |
If an utterance is received over the SMS channel, this variable presents and is set to SMS. Version 1.0.0.6c and later. |
None |
| vgwSMSUserPhoneNumber | String | The phone number where the SMS message was received from. | None |
| vgwSMSContext | String | The context extracted from the opaque data, smsOpaqueData, received from SMS Gateway. |
None |
| vgwSMSMessage | String | The SMS message received from the caller. | None |
| vgwSMSMedia | JSON array | The MMS message received from the caller.{ |
None |
| vgwIsOutboundCall | Yes / No |
Indicates whether the call is an outbound call. Version 1.0.2.0 and later. | None |
| vgwSTTProvider | String | The name of the STT provider that is used for the call. The state variable is set if the STT provider name is configured. Version 1.0.2 and later. | None |
| vgwTTSProvider | String | The name of the TTS provider that is used for the call. The state variable is set if the TTS provider name is configured. Version 1.0.2 and later. | None |
Deprecated state variables
Deprecated state variables set in the Watson Assistant dialog
The following state variables are deprecated and were replaced with corresponding action tags. Although the state variables continue to function, you can't define these deprecated state variables and the action tags within a node. Your Watson Assistant dialog can contain a mixture of action tags and deprecated state variables, but the JSON definition for each node can contain only one or the other.
| Deprecated state variable | Expected value | Description | Replacement action tag |
|---|---|---|---|
| vgwHangUp | Yes / No |
Informs the Voice Gateway to hang up the call after the included text response is played back to the caller. Deprecated in Version 1.0.0.2. | vgwActHangup |
| vgwTransfer | Yes / No |
Informs the Voice Gateway to initiate a transfer after the included text response is played back to the caller. Deprecated in Version 1.0.0.2. | vgwActTransfer |
| vgwConversationConfigSettings | JSON array | A JSON object that contains a set of parameters that define a Watson Assistant workspace so that you can dynamically switch to a different workspace based on the call. Learn more in Dynamically configuring Watson services. Version 1.0.0.1. Deprecated in Version 1.0.0.2. | vgwActSetConversationConfig |
| vgwSTTConfigSettings | JSON array | A JSON object that contains a set of parameters for the Voice Gateway to pass to the Watson Speech to Text service. The Watson Assistant service dynamically defines the parameters based on the call. For example, if Watson Assistant detects that the caller is speaking Spanish, the service can change the language model to es-ES_NarrowbandModel. For more information, see Dynamically configuring Watson services. Deprecated in Version 1.0.0.2. | vgwActSetSTTConfig |
| vgwTTSConfigSettings | JSON array | A JSON object that contains a set of parameters for the Voice Gateway to pass to the Watson Text to Speech service. The Watson Assistant service dynamically defines the parameters based on the call. For example, if Watson Assistant detects that the caller is speaking Spanish, the service can change the voice to es-ES_EnriqueVoice. For more information, see Dynamically configuring Watson services. Deprecated in Version 1.0.0.2. | vgwActSetTTSConfig |
| vgwExcludeFromTTSCache | Yes / No |
If Text to Speech response caching is enabled, this variable informs Voice Gateway to not cache the response from the Text to Speech service. For example, responses that contain sensitive PHI, PII, and PCI DSS data or dynamic information such as customer names or birth dates should be excluded. Because this state variable does not remain on the context between turns, it must be set on the Watson Assistant dialog node for each utterance that you don't want to cache. For more information, see Reducing response time to the Watson Text to Speech service. Version 1.0.0.1. Deprecated in Version 1.0.0.2. | vgwActExcludeFromTTSCache |
| vgwMusicOnHoldURL | URL | A URL to an audio file that is played in a loop as soon as the included text is played back, such as for playing music on hold (MOH). If no text is included, the audio is played immediately. The file must be single channel (mono), PCM-encoded, and have a 8,000 Hz sampling rate with 16 bits per sample. Deprecated in Version 1.0.0.2. | vgwActPlayUrl |
| vgwOneTimeAudioURL | URL | A URL to an audio file that is played a single time as soon as the included text is played back, such as for one-time utterances. If no text is included, the audio is played immediately. The file must be single channel (mono), PCM-encoded, and have a 8,000 Hz sampling rate with 16 bits per sample. Deprecated in Version 1.0.0.2. | vgwActPlayUrl |
| vgwForceNoInputTurn | Yes / No |
Forces a new turn with no input from the Media Relay. For example, you might want to send this variable so that the Watson Assistant can play music on hold before it initiates the long transaction. Deprecated in Version 1.0.0.2. | vgwActForceNoInputTurn |
| vgwPauseSTT | Yes / No |
Informs the Voice Gateway whether to pause speech-to-text processing. In contrast to the related action tags, when this state is applied, the same value is used in all subsequent transactions unless a new request arrives that overrides
the existing value. If recording is enabled and the vgwPauseSTT value is set to Yes, the audio from the caller isn't captured. Deprecated in Version 1.0.0.3. |
vgwActPauseSTT and vgwActUnPauseSTT |
| vgwAllowBargeIn | Yes / No |
Informs the Voice Gateway whether barge-in is allowed. When applied, the same value is used in all subsequent transactions, unless a new request arrives that overrides the existing value. Deprecated in Version 1.0.0.3. | vgwActEnableSpeechBargeIn, vgwActDisableSpeechBargeIn, vgwActEnableDTMFBargeIn, and vgwActDisableDTMFBargeIn |
| vgwAllowDTMF | Yes / No |
Informs the Voice Gateway whether dual-tone multi-frequency signaling (DTMF) is allowed. When applied, the same value is used in all subsequent transactions, unless a new request arrives that overrides the existing value. When set
to No, DTMFs are ignored. Deprecated in Version 1.0.0.3. |
vgwActPauseDTMF and vgwActUnPauseDTMF |
| vgwPreResponseTimeoutCount | Time in ms | The amount of time in milliseconds to wait for a new utterance before playing back a response. Can be used to collect DTMF digits or a multi-utterance response. Deprecated in Version 1.0.0.6c. |
|
Deprecated state variables set by Voice Gateway
| Deprecated state variable | Expected value | Description | Replacement |
|---|---|---|---|
| vgwTextAlternatives | JSON array | The confidence level for the top hypothesis and any alternatives.
The format matches exactly the format that is received from the Speech to Text service: [{"transcript":"hello there my name is Jose matter eco","confidence":0.758},{"transcript":"hello there my name is Jose matter Pico"},{"transcript":"hello there my name is Jose matter ego"},{"transcript":"hello there my name is Jose matter peco"}]. Deprecated in Version 1.0.0.2. |
vgwSTTResponse |
| vgwSMSChannel | True/False |
Indicates whether the message was received from an SMS channel. Deprecated in Version 1.0.0.6c. | None |