amazon-connect / voicemail-for-amazon-connect

The Voicemail for Amazon Connect solution helps call center administrators and managers automate a voicemail solution using Amazon Connect. A customer can call in, enter the extension number of the agent they want to speak with, and leave a voicemail for that specific agent. The solution generates voicemail recordings and transcripts that are delivered to agents using their preferred communication setting: SMS and/or email.
https://aws.amazon.com/solutions/implementations/voicemail-for-amazon-connect/
Apache License 2.0
65 stars 78 forks source link

Error in KVS process recording lambda #113

Open monikadr opened 11 months ago

monikadr commented 11 months ago

Hello,

I see below error in KVSProcess recording lambda org.json.JSONException: JSONObject["agentId"] not found.

and here is the event - Record Data: { "AWSAccountId": "*****", "AWSContactTraceRecordFormatVersion": "2017-03-10", "Agent": null, "AgentConnectionAttempts": 0, "AnsweringMachineDetectionStatus": null, "Attributes": {}, "Campaign": { "CampaignId": null }, "Channel": "VOICE", "ConnectedToSystemTimestamp": "2023-10-01T06:44:49Z", "ContactDetails": {}, "ContactId": "****", "CustomerEndpoint": { "Address": "+1*", "Type": "TELEPHONE_NUMBER" }, "DisconnectReason": "CUSTOMER_DISCONNECT", "DisconnectTimestamp": "2023-10-01T06:44:50Z", "InitialContactId": null, "InitiationMethod": "INBOUND", "InitiationTimestamp": "2023-10-01T06:44:49Z", "InstanceARN": "*****", "LastUpdateTimestamp": "2023-10-01T06:45:57Z", "MediaStreams": [ { "Type": "AUDIO" } ], "NextContactId": null, "PreviousContactId": null, "Queue": null, "Recording": null, "Recordings": null, "References": [], "ScheduledTimestamp": null, "SystemEndpoint": { "Address": "+1**", "Type": "TELEPHONE_NUMBER" }, "TransferCompletedTimestamp": null, "TransferredToEndpoint": null, "VoiceIdResult": null }

This is happening in production, so please let me know what needs to be done

virtualgill commented 11 months ago

Hi there, can you provide some more details on your issue?

monikadr commented 11 months ago

Hello,

Voicemail are getting triggered correctly, My usecase is - we have voicemail enabled only when agents are not available to take the call and this voicemails is routed to only one agent always. So as per the functionality of voicemail is concerned it is working correctly.

But the KVS lambda function is triggered for every call that comes to the our AWS Connect number, if this call goes to a live agent then I see this error.

So question is why is this lambda function triggered for every call?

Also, I see some logging error in the cloduwatch logs this logging error is present for all the all i.e., the call navigated to agent or voicemail

RayShonami commented 11 months ago

@monikadr

I think I know the function you are talking about. This(KVS Process) function is used to process calls(Using kinesis) from Amazon Connect. It essentially reads every call and determines whether or not the call is a voicemail.

This error that you are seeing is because the function expects an agentId attribute to pass in every call but that is not always the case. So, because it cannot find the agentId, it throws this error.

monikadr commented 11 months ago

@RayShonami thank you for the information. I believe that is the default behavior and cannot be changed?

RayShonami commented 11 months ago

@monikadr Right.

If you wanted to change it, you would have to edit the function.

RayShonami commented 11 months ago

The function should just be updated to not throw this error message in this repo. As the error message is more confusing than helpful to normal users.

And doesn't necessarily explicitly state that the reason why the call failed to process was because it wasn't a voicemail recording. If it was a voicemail recording, obviously the agent id would be returned and stored as an attribute for the call. But since it's not, obviously the call is not a voicemail recording.

davelemons commented 10 months ago

Just an update that we are working on an update to this solution which will resolve this issue. No guarantees, but we are working to release an update in Q1 2024