Hey
@Marian O'Connell,
I don't have specific experience with the interaction state within the script itself but I've encountered similar issues with looping actions or changing state within scripts.
As it relates to the Interaction State, the docs do read as if it should see the state as "Disconnected", but it does not make clear if the disconnection happens after ALL parties are disconnected (including agent) or not.
To quickly determine if that variable is a reliable source, add a text box within the script that outputs the
Scripter.Interaction State value. Then make a test call to see that state change.
Note - I actually output all script, custom + built-in variables in a text section at the bottom of my script as I'm debugging/building to see the different variable states/values during a call/interaction.
As it relates to the looping issue, this is how I've solved this issue in the past:
Create two unique containers (vertical or horizontal) that would house the content you would want to show for each portion of the call. Then create two Dynamic Boolean Variables that would evaluate based on the Interaction State. Ex: CallInProgress and CallDisconnected. For the in-progress variable use an evaluation statement like so:
ifElse(equal({{Scripter.Interaction State}}, "Disconnected"), 0, 1) and for the disconnected variable use a statement like so:
ifElse(equal({{Scripter.Interaction State}}, "Disconnected"), 1, 0).
Once those sections and variables are created, in the editor select the in-progress section, and in the right sidebar expand the Layout tab, and select the CallInProgress variable in the Visible dropdown. Do the same process for the disconnected section but choose the other variable in the Visible dropdown.
Now you should have two sections that dynamically hide/unhide based on the state of the call.
The biggest gotcha that clicked for me was when I realized that the Dynamic Type Variables will re-evaluate on each script re-render. The custom actions work more like a callback function that is isolated to its execution. My guess is that the interaction state value is being passed to the action at the time of its execution and has no context of its value outside of the initiation.
Let me know if you have any questions or if you come up with any other solutions. I'm always excited to learn different ways to build my scripts.
------------------------------
Nick Searle
Cege Media
------------------------------