Paulo_Mesquita | 2023-03-25 09:46:41 UTC | #1
Hi there,
I want to use this data action within a secure flow to check if the agent is still active on the call but the response is always empty.
Can you help me to understand what is wrong here. Get-Participant-State-20230325162319.custom.json|attachment (1.3 KB)
Jason_Mathison | 2023-03-27 15:57:58 UTC | #2
Hi Paulo,
Thank you for the action export. Could you also post an example of the response from the "execute" step in test mode? Feel free to redact any names or anything sensitive, but don't modify the shape of the JSON object.
--Jason
Paulo_Mesquita | 2023-03-27 20:20:53 UTC | #3
Hi Jason,
This is the JSON response:
{ "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "participants": [ { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "address": "sip:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx@localhost", "startTime": "2023-03-24T09:33:06.443Z", "connectedTime": "2023-03-24T09:33:12.753Z", "endTime": "2023-03-24T09:34:42.919Z", "purpose": "agent", "state": "terminated", "direction": "outbound", "disconnectType": "client", "held": false, "wrapupRequired": true, "wrapupPrompt": "optional", "mediaRoles": [ "full" ], "user": { "id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",, "selfUri": "/api/v2/users/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", }, "queue": { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",, "selfUri": "/api/v2/routing/queues/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", }, "team": { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "selfUri": "/api/v2/teams/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", }, "attributes": { "storeCard": "false", "amount": "" }, "errorInfo": { "message": "session xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx is inactive for command cloud.command.disconnect", "code": "error.ininedgecontrol.session.inactive", "messageWithParams": "session {sessionId} is inactive for command {type}", "messageParams": { "sessionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "type": "cloud.command.disconnect" }, "details": [], "errors": [] }, "script": { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "selfUri": "/api/v2/scripts/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", }, "provider": "Edge", "wrapup": { "code": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "notes": "", "tags": [], "durationSeconds": 101, "endTime": "2023-03-24T09:36:23.894Z" }, "screenRecordingState": "error", "startAcwTime": "2023-03-24T09:34:42.919Z", "endAcwTime": "2023-03-24T09:36:23.894Z", "muted": false, "confined": false, "recording": false, "recordingState": "none", "ani": "sip:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx@localhost", "dnis": "tel:+xxxxxxxxxxx" }, { "id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "name": "Mobile Number, New Zealand", "address": "tel:+xxxxxxxxxxx", "startTime": "2023-03-24T09:33:07.267Z", "connectedTime": "2023-03-24T09:33:12.751Z", "endTime": "2023-03-24T09:34:42.920Z", "purpose": "customer", "state": "terminated", "direction": "outbound", "disconnectType": "peer", "held": false, "wrapupRequired": false, "mediaRoles": [ "full" ], "queue": { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "selfUri": "/api/v2/routing/queues/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }, "attributes": {}, "provider": "Edge", "externalContact": { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "selfUri": "/api/v2/externalcontacts/contacts/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", }, "peer": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "muted": false, "confined": false, "recording": false, "recordingState": "none", "ani": "sip:+xxxxxxxxxx@10.47.xx.x;user=phone", "dnis": "tel:+xxxxxxxxxxx" } ], "otherMediaUris": [], "recentTransfers": [], "recordingState": "none", "selfUri": "/api/v2/conversations/calls/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", }
Jason_Mathison | 2023-03-28 21:01:22 UTC | #4
It looks like the issue is that you are trying to use an input value while creating your response:
"translationMap": { "participantStates": "$.participants[?(@.id == ${participantId})].state"
You can vote / add comments to an open idea to add this capability: https://genesyscloud.ideas.aha.io/ideas/OTB-I-224
Paulo_Mesquita | 2023-03-29 12:56:24 UTC | #5
Hi Jason,
I've made some changes to the data action and will return the participant Id of the active agent as a String. I am working with the assumption that if I don't get an Id that's because the agent is gone. :slight_smile:
{ "translationMap": { "participantId": "$.participants[?(@.purpose == 'agent' && @.state == 'connected')].id" }, "translationMapDefaults": { }, "successTemplate": "{\"participantId\": ${successTemplateUtils.firstFromArray(${participantId}, 'null')}}" }
Thank you.
zubair | 2023-03-29 18:24:05 UTC | #6
Hi Paulo
Wouldn't it be better to extract the agent state from the data action and base your decisions on the state value inside your flow rather than 'Not getting the Id' approach?? Just a thought.
Cheers Zubair
Jason_Mathison | 2023-03-29 19:28:35 UTC | #7
Hey Paulo,
While your approach sounds reasonable to me, I don't know very much about participants/agents/states in conversation objects to give you any feedback or advice about how to handle this.
--Jason
Paulo_Mesquita | 2023-03-29 21:25:53 UTC | #8
HI Zubair,
The ability to filter responses based on input contract is currently not supported.
This is actually a good thing for me because I don't have to worry about capturing the user participant id. Also, it helps me to cover self service scenarios where the the call is never answered by an agent and "agent participant id" does not exist.
John_Carnell | 2023-03-30 16:52:40 UTC | #9
This post was migrated from the old Developer Forum.
ref: 19120