Enable functions dynamically
In this example, the transfer function is toggled off from the start. The AI agent will toggle this
function on after the get_joke function is called and will also toggle the get_joke function off. This creates a scenario where a user can only
be transferred after hearing a joke from the AI, and can only request one joke. The AI agent will then match the transfer destination
based on the user’s input, with the meta_data table serving as a directory for the transfer destinations.
If no match is found, the AI agent will fall back to the ".*" expression, which will inform the user
that the transfer was unsuccessful and requires a valid input.
transfer function
When passing a SWML object that includes a connect (or other method that transfers the call) in output.action[], your script must be JSON, and "transfer": true, must be included before the SWML in the same action object. Refer to the example above.
We set the function to being toggled off with the following line:
get_joke function
In the above function, we set the transfer function to be toggled on.
Now when a user asks to be transferred, the AI agent will now be able to do so because the transfer function is toggled on.
Additionally, the get_joke function is toggled off, so the user will not be able to request another joke.