apriftis | 2019-09-24 14:04:32 UTC | #1
Hello guys,
I am working with your sdk. I was looking to get the latest message from a conversation, lets say when the call agent end it, while I am subscribed at the queue.
i saw this one, https://developer.mypurecloud.com/forum/t/how-to-identify-a-conversation-start-and-end-from-subscribed-notification-events/4345
but I have a case where two events came and they both have endtime to all participants, and the only difference is an object in the call array, about error info.
Is there any other way, more specific, to recognize that an event is actually the last one of a conversation?
Any flag, or property that should be exclusively at the last event?
Becky_Powell | 2019-09-24 21:18:23 UTC | #2
apriftis, post:1, topic:6094
but I have a case where two events came and they both have endtime to all participants, and the only difference is an object in the call array, about error info.
I'm not sure I understand. Can you provide an example please? (PII and OAuth client info redacted, please!)
apriftis | 2019-09-25 07:31:57 UTC | #3
Hello Becky,
First of all, I have subscribed to a queue so I can receive all call notifications. But from all these events I need to keep and save the event that happens when the conversation is totally finished.
I read that i have to loot at the event where all participants have end time filled. But I still, received two events with this conditions.
I will paste two events below . If you can compare these objects you will see that the are pretty much the same, except that one has an extra object, "errorInfo" in the call object.
Please take a look.
{ "TopicName": "v2.routing.queues.f14ca135-e3d7-499d-8015-f18b49460d06.conversations", "Version": "2", "EventBody": { "id": "85936663-eb05-4d60-8b3f-5e88740a0207", "participants": [ { "id": "b968ce83-8690-4ff2-9231-5fbcd6769e45", "connectedTime": "2019-09-24T09:48:29.24Z", "endTime": "2019-09-24T09:48:50.316Z", "queueId": "f14ca135-e3d7-499d-8015-f18b49460d06", "purpose": "acd", "wrapupRequired": false, "wrapupExpected": false, "conversationRoutingData": { "queue": { "id": "f14ca135-e3d7-499d-8015-f18b49460d06" }, "language": {}, "priority": 0 }, "attributes": {}, "callbacks": [ { "state": "DISCONNECTED", "disconnectType": "TRANSFER", "id": "2b1aa4f3-e574-41db-be5b-9215ecba651c", "held": false, "dialerPreview": { "id": "5d41051e-61d5-4abb-ae88-1b83dfe4e07c", "contactId": "ba0fea85ba6d427a8ef953722892b83f", "contactListId": "fa1ef186-412a-4602-9bcb-b7b9c79c7575", "campaignId": "6955c992-08a8-4d71-aecb-db3db00fe7ba", "phoneNumberColumns": [ { "columnName": "Phone", "type": "Work", "additionalProperties": {} } ], "additionalProperties": {} }, "callbackNumbers": [ "+302117609312" ], "callbackUserName": "Customer", "scriptId": "c12224c4-5ccc-4c3d-990c-4d56a783cf08", "peerId": "fd38e1af-05bd-4792-8eb3-b581e13cee05", "skipEnabled": false, "provider": "PureCloud Callback", "timeoutSeconds": 0, "connectedTime": "2019-09-24T09:48:29.298Z", "disconnectedTime": "2019-09-24T09:48:50.316Z", "additionalProperties": {} } ], "additionalProperties": {} }, { "id": "815e9b9b-2c07-45fd-ba10-5f42fc320a58", "connectedTime": "2019-09-24T09:48:50.318Z", "endTime": "2019-09-24T09:49:29.588Z", "userId": "436ceecb-19fd-4b97-a151-3245d319e497", "queueId": "f14ca135-e3d7-499d-8015-f18b49460d06", "purpose": "agent", "address": "sip:5d84e16ecdfbe119371aef7f+vivawallet.orgspan.com@localhost", "wrapupRequired": true, "wrapupExpected": true, "wrapupPrompt": "timeout", "wrapupTimeoutMs": 120000, "wrapup": { "code": "7fb334b0-0e9e-11e4-9191-0800200c9a66", "notes": "", "durationSeconds": 0, "endTime": "2019-09-24T09:49:13.274Z", "additionalProperties": {} }, "conversationRoutingData": { "queue": {}, "language": {}, "priority": 0 }, "alertingTimeoutMs": 30000, "attributes": { "AppointmentSlot2Time": "", "CallbackDate": "", "CallbackDateTime": "", "BusinessInfoVolume": "0", "ContactEmail": "", "AppointmentSlot1Date": "", "AppointmentSlot2Date": "", "FollowUpDateTime": "", "ContractBreakDate": "", "BusinessInfoCategory": "", "BusinessInfoProvider": "" }, "calls": [ { "state": "TERMINATED", "recordingState": "NONE", "disconnectType": "CLIENT", "direction": "OUTBOUND", "id": "d1f0cf2b-e3a6-4d09-8e71-07d1f9b4118f", "recording": false, "muted": false, "confined": false, "held": false, "self": { "nameRaw": "", "addressNormalized": "sip:5d84e16ecdfbe119371aef7f+vivawallet.orgspan.com@localhost", "addressRaw": "5d84e16ecdfbe119371aef7f+vivawallet.orgspan.com", "addressDisplayable": "unavailable", "additionalProperties": {} }, "other": { "name": "Athens, Greece", "nameRaw": "", "addressNormalized": "tel:+302117609312", "addressRaw": "tel:00302117609312", "addressDisplayable": "unavailable", "additionalProperties": {} }, "provider": "Edge", "scriptId": "c12224c4-5ccc-4c3d-990c-4d56a783cf08", "disconnectedTime": "2019-09-24T09:49:09.426Z", "additionalProperties": {} } ], "callbacks": [ { "state": "DISCONNECTED", "disconnectType": "CLIENT", "id": "f167bdc1-42d4-4947-9955-8c5f4e094c23", "held": false, "dialerPreview": { "id": "5d41051e-61d5-4abb-ae88-1b83dfe4e07c", "contactId": "ba0fea85ba6d427a8ef953722892b83f", "contactListId": "fa1ef186-412a-4602-9bcb-b7b9c79c7575", "campaignId": "6955c992-08a8-4d71-aecb-db3db00fe7ba", "phoneNumberColumns": [ { "columnName": "Phone", "type": "Work", "additionalProperties": {} } ], "additionalProperties": {} }, "callbackNumbers": [ "+302117609312" ], "callbackUserName": "Customer", "scriptId": "c12224c4-5ccc-4c3d-990c-4d56a783cf08", "peerId": "fd38e1af-05bd-4792-8eb3-b581e13cee05", "skipEnabled": false, "provider": "PureCloud Callback", "timeoutSeconds": 0, "connectedTime": "2019-09-24T09:48:50.318Z", "disconnectedTime": "2019-09-24T09:49:29.588Z", "additionalProperties": {} } ], "additionalProperties": {} }, { "id": "b695a8b0-287b-4c2c-8803-75ac7453a3a0", "connectedTime": "2019-09-24T09:48:29.238Z", "endTime": "2019-09-24T09:49:29.604Z", "name": "Customer", "queueId": "f14ca135-e3d7-499d-8015-f18b49460d06", "purpose": "customer", "address": "tel:+302117609312", "wrapupRequired": false, "wrapupExpected": false, "attributes": { "scriptId": "c12224c4-5ccc-4c3d-990c-4d56a783cf08", "dialerContactId": "ba0fea85ba6d427a8ef953722892b83f", "dialerContactListId": "fa1ef186-412a-4602-9bcb-b7b9c79c7575", "dialerInteractionId": "5d41051e-61d5-4abb-ae88-1b83dfe4e07c", "dialerCampaignId": "6955c992-08a8-4d71-aecb-db3db00fe7ba" }, "calls": [ { "state": "TERMINATED", "recordingState": "NONE", "disconnectType": "PEER", "direction": "OUTBOUND", "id": "1b6f5c58-354e-4c3f-bef2-eb8491d17c2c", "recording": false, "muted": false, "confined": false, "held": false, "self": { "name": "Athens, Greece", "nameRaw": "Athens, Greece", "addressNormalized": "tel:+302117609312", "addressRaw": "tel:+302117609312;tgrp=12d660ac-f594-4723-9c96-e80fefc2456c;trunk-context=vivawallet", "addressDisplayable": "unavailable", "additionalProperties": {} }, "other": { "name": "Viva", "nameRaw": "Viva", "addressNormalized": "sip:+302117609312@185.121.16.36;user=phone", "addressRaw": "sip:+302117609312@185.121.16.36;user=phone", "addressDisplayable": "unavailable", "additionalProperties": {} }, "provider": "Edge", "peerId": "d1f0cf2b-e3a6-4d09-8e71-07d1f9b4118f", "disconnectedTime": "2019-09-24T09:49:09.429Z", "additionalProperties": {} } ], "callbacks": [ { "state": "DISCONNECTED", "disconnectType": "PEER", "id": "fd38e1af-05bd-4792-8eb3-b581e13cee05", "held": false, "dialerPreview": { "id": "5d41051e-61d5-4abb-ae88-1b83dfe4e07c", "contactId": "ba0fea85ba6d427a8ef953722892b83f", "contactListId": "fa1ef186-412a-4602-9bcb-b7b9c79c7575", "campaignId": "6955c992-08a8-4d71-aecb-db3db00fe7ba", "phoneNumberColumns": [ { "columnName": "Phone", "type": "Work", "additionalProperties": {} } ], "additionalProperties": {} }, "callbackNumbers": [ "+302117609312" ], "callbackUserName": "Customer", "scriptId": "c12224c4-5ccc-4c3d-990c-4d56a783cf08", "skipEnabled": false, "provider": "PureCloud Callback", "timeoutSeconds": 0, "connectedTime": "2019-09-24T09:48:29.258Z", "disconnectedTime": "2019-09-24T09:49:29.604Z", "additionalProperties": {} } ], "additionalProperties": {} } ], "recordingState": "none", "address": "sip:5d84e16ecdfbe119371aef7f+vivawallet.orgspan.com@localhost" }, "Metadata": { "CorrelationId": "65254e5a-a2bb-4628-b9b0-566b7b98fb73" } }
{ "TopicName": "v2.routing.queues.f14ca135-e3d7-499d-8015-f18b49460d06.conversations", "Version": "2", "EventBody": { "id": "85936663-eb05-4d60-8b3f-5e88740a0207", "participants": [ { "id": "b968ce83-8690-4ff2-9231-5fbcd6769e45", "connectedTime": "2019-09-24T09:48:29.24Z", "endTime": "2019-09-24T09:48:50.316Z", "queueId": "f14ca135-e3d7-499d-8015-f18b49460d06", "purpose": "acd", "wrapupRequired": false, "wrapupExpected": false, "conversationRoutingData": { "queue": { "id": "f14ca135-e3d7-499d-8015-f18b49460d06" }, "language": {}, "priority": 0 }, "attributes": {}, "callbacks": [ { "state": "DISCONNECTED", "disconnectType": "TRANSFER", "id": "2b1aa4f3-e574-41db-be5b-9215ecba651c", "held": false, "dialerPreview": { "id": "5d41051e-61d5-4abb-ae88-1b83dfe4e07c", "contactId": "ba0fea85ba6d427a8ef953722892b83f", "contactListId": "fa1ef186-412a-4602-9bcb-b7b9c79c7575", "campaignId": "6955c992-08a8-4d71-aecb-db3db00fe7ba", "phoneNumberColumns": [ { "columnName": "Phone", "type": "Work", "additionalProperties": {} } ], "additionalProperties": {} }, "callbackNumbers": [ "+302117609312" ], "callbackUserName": "Customer", "scriptId": "c12224c4-5ccc-4c3d-990c-4d56a783cf08", "peerId": "fd38e1af-05bd-4792-8eb3-b581e13cee05", "skipEnabled": false, "provider": "PureCloud Callback", "timeoutSeconds": 0, "connectedTime": "2019-09-24T09:48:29.298Z", "disconnectedTime": "2019-09-24T09:48:50.316Z", "additionalProperties": {} } ], "additionalProperties": {} }, { "id": "815e9b9b-2c07-45fd-ba10-5f42fc320a58", "connectedTime": "2019-09-24T09:48:50.318Z", "endTime": "2019-09-24T09:49:29.588Z", "userId": "436ceecb-19fd-4b97-a151-3245d319e497", "queueId": "f14ca135-e3d7-499d-8015-f18b49460d06", "purpose": "agent", "address": "sip:5d84e16ecdfbe119371aef7f+vivawallet.orgspan.com@localhost", "wrapupRequired": true, "wrapupExpected": true, "wrapupPrompt": "timeout", "wrapupTimeoutMs": 120000, "wrapup": { "code": "7fb334b0-0e9e-11e4-9191-0800200c9a66", "notes": "", "durationSeconds": 0, "endTime": "2019-09-24T09:49:13.274Z", "additionalProperties": {} }, "conversationRoutingData": { "queue": {}, "language": {}, "priority": 0 }, "alertingTimeoutMs": 30000, "attributes": { "AppointmentSlot2Time": "", "CallbackDate": "", "CallbackDateTime": "", "BusinessInfoVolume": "0", "ContactEmail": "", "AppointmentSlot1Date": "", "AppointmentSlot2Date": "", "FollowUpDateTime": "", "ContractBreakDate": "", "BusinessInfoCategory": "", "BusinessInfoProvider": "" }, "calls": [ { "state": "TERMINATED", "recordingState": "NONE", "disconnectType": "CLIENT", "direction": "OUTBOUND", "id": "d1f0cf2b-e3a6-4d09-8e71-07d1f9b4118f", "recording": false, "muted": false, "confined": false, "held": false, "errorInfo": { "code": "error.ininedgecontrol.session.inactive", "message": "session d1f0cf2b-e3a6-4d09-8e71-07d1f9b4118f is inactive for command cloud.command.disconnect", "messageWithParams": "session {sessionId} is inactive for command {type}", "messageParams": { "type": "cloud.command.disconnect", "sessionId": "d1f0cf2b-e3a6-4d09-8e71-07d1f9b4118f" }, "additionalProperties": {} }, "self": { "nameRaw": "", "addressNormalized": "sip:5d84e16ecdfbe119371aef7f+vivawallet.orgspan.com@localhost", "addressRaw": "5d84e16ecdfbe119371aef7f+vivawallet.orgspan.com", "addressDisplayable": "unavailable", "additionalProperties": {} }, "other": { "name": "Athens, Greece", "nameRaw": "", "addressNormalized": "tel:+302117609312", "addressRaw": "tel:00302117609312", "addressDisplayable": "unavailable", "additionalProperties": {} }, "provider": "Edge", "scriptId": "c12224c4-5ccc-4c3d-990c-4d56a783cf08", "disconnectedTime": "2019-09-24T09:49:09.426Z", "additionalProperties": {} } ], "callbacks": [ { "state": "DISCONNECTED", "disconnectType": "CLIENT", "id": "f167bdc1-42d4-4947-9955-8c5f4e094c23", "held": false, "dialerPreview": { "id": "5d41051e-61d5-4abb-ae88-1b83dfe4e07c", "contactId": "ba0fea85ba6d427a8ef953722892b83f", "contactListId": "fa1ef186-412a-4602-9bcb-b7b9c79c7575", "campaignId": "6955c992-08a8-4d71-aecb-db3db00fe7ba", "phoneNumberColumns": [ { "columnName": "Phone", "type": "Work", "additionalProperties": {} } ], "additionalProperties": {} }, "callbackNumbers": [ "+302117609312" ], "callbackUserName": "Customer", "scriptId": "c12224c4-5ccc-4c3d-990c-4d56a783cf08", "peerId": "fd38e1af-05bd-4792-8eb3-b581e13cee05", "skipEnabled": false, "provider": "PureCloud Callback", "timeoutSeconds": 0, "connectedTime": "2019-09-24T09:48:50.318Z", "disconnectedTime": "2019-09-24T09:49:29.588Z", "additionalProperties": {} } ], "additionalProperties": {} }, { "id": "b695a8b0-287b-4c2c-8803-75ac7453a3a0", "connectedTime": "2019-09-24T09:48:29.238Z", "endTime": "2019-09-24T09:49:29.604Z", "name": "Customer", "queueId": "f14ca135-e3d7-499d-8015-f18b49460d06", "purpose": "customer", "address": "tel:+302117609312", "wrapupRequired": false, "wrapupExpected": false, "attributes": { "scriptId": "c12224c4-5ccc-4c3d-990c-4d56a783cf08", "dialerContactId": "ba0fea85ba6d427a8ef953722892b83f", "dialerContactListId": "fa1ef186-412a-4602-9bcb-b7b9c79c7575", "dialerInteractionId": "5d41051e-61d5-4abb-ae88-1b83dfe4e07c", "dialerCampaignId": "6955c992-08a8-4d71-aecb-db3db00fe7ba" }, "calls": [ { "state": "TERMINATED", "recordingState": "NONE", "disconnectType": "PEER", "direction": "OUTBOUND", "id": "1b6f5c58-354e-4c3f-bef2-eb8491d17c2c", "recording": false, "muted": false, "confined": false, "held": false, "self": { "name": "Athens, Greece", "nameRaw": "Athens, Greece", "addressNormalized": "tel:+302117609312", "addressRaw": "tel:+302117609312;tgrp=12d660ac-f594-4723-9c96-e80fefc2456c;trunk-context=vivawallet", "addressDisplayable": "unavailable", "additionalProperties": {} }, "other": { "name": "Viva", "nameRaw": "Viva", "addressNormalized": "sip:+302117609312@185.121.16.36;user=phone", "addressRaw": "sip:+302117609312@185.121.16.36;user=phone", "addressDisplayable": "unavailable", "additionalProperties": {} }, "provider": "Edge", "peerId": "d1f0cf2b-e3a6-4d09-8e71-07d1f9b4118f", "disconnectedTime": "2019-09-24T09:49:09.429Z", "additionalProperties": {} } ], "callbacks": [ { "state": "DISCONNECTED", "disconnectType": "PEER", "id": "fd38e1af-05bd-4792-8eb3-b581e13cee05", "held": false, "dialerPreview": { "id": "5d41051e-61d5-4abb-ae88-1b83dfe4e07c", "contactId": "ba0fea85ba6d427a8ef953722892b83f", "contactListId": "fa1ef186-412a-4602-9bcb-b7b9c79c7575", "campaignId": "6955c992-08a8-4d71-aecb-db3db00fe7ba", "phoneNumberColumns": [ { "columnName": "Phone", "type": "Work", "additionalProperties": {} } ], "additionalProperties": {} }, "callbackNumbers": [ "+302117609312" ], "callbackUserName": "Customer", "scriptId": "c12224c4-5ccc-4c3d-990c-4d56a783cf08", "skipEnabled": false, "provider": "PureCloud Callback", "timeoutSeconds": 0, "connectedTime": "2019-09-24T09:48:29.258Z", "disconnectedTime": "2019-09-24T09:49:29.604Z", "additionalProperties": {} } ], "additionalProperties": {} } ], "recordingState": "none", "address": "sip:5d84e16ecdfbe119371aef7f+vivawallet.orgspan.com@localhost" }, "Metadata": { "CorrelationId": "65254e5a-a2bb-4628-b9b0-566b7b98fb73" } }
tim.smith | 2019-09-30 14:10:40 UTC | #4
Whenever you receive a notification about a conversation, the data you receive represents the current state of the conversation at the time the event was created. Your application needs to keep track of the state of the conversation so it can diff the JSON object to see what values are different between the last known state and the data in the new notification event. Keep in mind that you'll get a notification for the conversation for anything that changes, not just participant state, so it is normal that you'll get further notifications for a conversation even after all participants have disconnected.
For example, if you're trying to identify when a conversation ended, you would want to identify a difference where the old state had participants that did not have an endTime, but the new state's participants do.
system | 2019-10-31 14:10:47 UTC | #5
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 6094