Genesys Cloud (formerly PureCloud)

Discussion Thread View
Expand all | Collapse all

Scripting - Change Page action on call Disconnect

  • 1.  Scripting - Change Page action on call Disconnect

    Posted 13 days ago
    Hi,

    Within a script, I am trying to display a different page to the Agent when the Interaction is Disconnected, and before they select their wrap up code.

    I can see that there is an Interaction State of "Disconnected" which I have tried to use - Interaction states - Genesys Cloud Resource Center

    On Page Load, I call a Custom Action to check the interaction state.
    In the Custom Action, if the Call is in "Connected" state, I delay ~5 seconds and check the interaction state again...this runs in a loop.
    If the Call is in "Disconnected", Scripter.ChangePage is called to display a different page.

    But it's not working.
    The script does not appear to pick up the Disconnected state?
    I also tested with Terminated just to be sure, but this did not work either.

    Would anyone be able to help on this?

    Thanks!
    #Omni-ChannelDesktop/UserInterface
    #SystemAdministration
    #Unsure/Other

    ------------------------------
    Marian OConnell
    Wren Data Ltd.
    ------------------------------


  • 2.  RE: Scripting - Change Page action on call Disconnect

    Posted 11 days ago
    Hey @Marian OConnell,

    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
    ------------------------------



  • 3.  RE: Scripting - Change Page action on call Disconnect

    Posted 5 days ago
    Hi @Nick Searle,

    Great idea to put all the script, custom and built in variables at the bottom of my test scripts!

    We've done this previously with a looping check on the "Alerting" and "Connected" states. My take on the Genesys documentation was that "Disconnected" meant 1 party had left the conversation. Then "Terminated" was that the interaction was 100% ended.

    I will test with the above suggestion and hopefully it will lend me an insight towards what way the interactions states are working. I will let you know if I get it working!

    Thanks again Nick, appreciate the help on this one.

    ------------------------------
    Marian OConnell
    Wren Data Ltd.
    ------------------------------