We have the following requirement in building a simple call center:
-
A bunch of customers would be registered into a web application.
-
Connect would initiate calls to these numbers.
-
The call flow would be as follows:
Customer picks up call
A simple audio file is played to the user
Customer responds through natural language (voice)
This voice is analyzed in real time, transcript is picked up, and the transcript is fed into a simple logic in a lambda function.
The lambda function determines what would be the next audio file to be played.
The audio file is then picked out of the S3 bucket and played to the user. This process goes back and forth until the lambda determines whether the call must be transferred to an agent. And if so, they would be transferred.
In order to go about this, I have created the following Contact flow (this isn't the complete one, but its a simple proof-of-concept to test out the voice analysis)
{
"Version": "2019-10-30",
"StartAction": "9e0d03d7-8045-4c95-afee-06bda3ba6ca7",
"Metadata": {
"entryPointPosition": {
"x": -140.8,
"y": 33.6
},
"ActionMetadata": {
"9e0d03d7-8045-4c95-afee-06bda3ba6ca7": {
"position": {
"x": -18.4,
"y": 24.8
}
},
"421283f3-c5e9-4a9f-a8ce-c5599fb38933": {
"position": {
"x": 625.6,
"y": 656
}
},
"c17decd1-c9a9-4f1e-bcc0-6b7101c34965": {
"position": {
"x": 1042.4,
"y": 242.4
}
},
"c583f7f6-fd6e-44b9-914f-26b6c246f47e": {
"position": {
"x": -120.8,
"y": 211.2
},
"toCustomer": true,
"fromCustomer": true
},
"d6236838-1250-4c89-9845-a44d170ebfd3": {
"position": {
"x": 143.2,
"y": 208.8
}
},
"2f5e4e0e-ed68-4bec-8e7c-f28008d1b3c5": {
"position": {
"x": 361.6,
"y": 196
}
},
"c884051f-4cb9-4317-96ef-c5eaec0a2c7b": {
"position": {
"x": 825.6,
"y": 312
},
"parameters": {
"QueueId": {
"displayName": "BasicQueue"
}
},
"queue": {
"text": "BasicQueue"
}
},
"f7446253-f2a3-4d42-bc50-5b12bf210ac2": {
"position": {
"x": 216,
"y": 567.2
}
},
"6388d0bd-f386-470d-8927-0b626d4eb5f9": {
"position": {
"x": 461.6,
"y": -27.2
}
},
"cce0d82c-dbe3-43ec-9842-1493c40c05a7": {
"position": {
"x": 736.8,
"y": 64.8
},
"dynamicMetadata": {}
}
},
"Annotations": [],
"name": "AICallFlow",
"description": "",
"type": "contactFlow",
"status": "published",
"hash": {}
},
"Actions": [
{
"Parameters": {
"FlowLoggingBehavior": "Enabled"
},
"Identifier": "9e0d03d7-8045-4c95-afee-06bda3ba6ca7",
"Type": "UpdateFlowLoggingBehavior",
"Transitions": {
"NextAction": "c583f7f6-fd6e-44b9-914f-26b6c246f47e"
}
},
{
"Parameters": {},
"Identifier": "421283f3-c5e9-4a9f-a8ce-c5599fb38933",
"Type": "DisconnectParticipant",
"Transitions": {}
},
{
"Parameters": {},
"Identifier": "c17decd1-c9a9-4f1e-bcc0-6b7101c34965",
"Type": "TransferContactToQueue",
"Transitions": {
"NextAction": "f7446253-f2a3-4d42-bc50-5b12bf210ac2",
"Errors": [
{
"NextAction": "f7446253-f2a3-4d42-bc50-5b12bf210ac2",
"ErrorType": "QueueAtCapacity"
},
{
"NextAction": "f7446253-f2a3-4d42-bc50-5b12bf210ac2",
"ErrorType": "NoMatchingError"
}
]
}
},
{
"Parameters": {
"MediaStreamingState": "Enabled",
"MediaStreamType": "Audio",
"Participants": [
{
"ParticipantType": "Customer",
"MediaDirections": [
"To",
"From"
]
}
]
},
"Identifier": "c583f7f6-fd6e-44b9-914f-26b6c246f47e",
"Type": "UpdateContactMediaStreamingBehavior",
"Transitions": {
"NextAction": "d6236838-1250-4c89-9845-a44d170ebfd3",
"Errors": [
{
"NextAction": "f7446253-f2a3-4d42-bc50-5b12bf210ac2",
"ErrorType": "NoMatchingError"
}
]
}
},
{
"Parameters": {
"RecordingBehavior": {
"RecordedParticipants": [
"Agent",
"Customer"
],
"ScreenRecordedParticipants": [
"Agent"
],
"IVRRecordingBehavior": "Enabled"
},
"AnalyticsBehavior": {
"Enabled": "True",
"AnalyticsLanguage": "en-US",
"AnalyticsRedactionBehavior": "Disabled",
"AnalyticsRedactionResults": "RedactedAndOriginal",
"ChannelConfiguration": {
"Chat": {
"AnalyticsModes": [
"ContactLens"
]
},
"Voice": {
"AnalyticsModes": [
"RealTime"
]
}
},
"SentimentConfiguration": {
"Enabled": "False"
}
}
},
"Identifier": "d6236838-1250-4c89-9845-a44d170ebfd3",
"Type": "UpdateContactRecordingBehavior",
"Transitions": {
"NextAction": "2f5e4e0e-ed68-4bec-8e7c-f28008d1b3c5"
}
},
{
"Parameters": {
"Text": "Hello there."
},
"Identifier": "2f5e4e0e-ed68-4bec-8e7c-f28008d1b3c5",
"Type": "MessageParticipant",
"Transitions": {
"NextAction": "6388d0bd-f386-470d-8927-0b626d4eb5f9",
"Errors": [
{
"NextAction": "f7446253-f2a3-4d42-bc50-5b12bf210ac2",
"ErrorType": "NoMatchingError"
}
]
}
},
{
"Parameters": {
"QueueId": "-------------------------"
},
"Identifier": "c884051f-4cb9-4317-96ef-c5eaec0a2c7b",
"Type": "UpdateContactTargetQueue",
"Transitions": {
"NextAction": "c17decd1-c9a9-4f1e-bcc0-6b7101c34965",
"Errors": [
{
"NextAction": "f7446253-f2a3-4d42-bc50-5b12bf210ac2",
"ErrorType": "NoMatchingError"
}
]
}
},
{
"Parameters": {
"MediaStreamingState": "Disabled",
"Participants": [
{
"ParticipantType": "Customer",
"MediaDirections": [
"To",
"From"
]
}
],
"MediaStreamType": "Audio"
},
"Identifier": "f7446253-f2a3-4d42-bc50-5b12bf210ac2",
"Type": "UpdateContactMediaStreamingBehavior",
"Transitions": {
"NextAction": "421283f3-c5e9-4a9f-a8ce-c5599fb38933",
"Errors": [
{
"NextAction": "421283f3-c5e9-4a9f-a8ce-c5599fb38933",
"ErrorType": "NoMatchingError"
}
]
}
},
{
"Parameters": {},
"Identifier": "6388d0bd-f386-470d-8927-0b626d4eb5f9",
"Type": "Wait",
"Transitions": {
"NextAction": "2f5e4e0e-ed68-4bec-8e7c-f28008d1b3c5",
"Conditions": [
{
"NextAction": "cce0d82c-dbe3-43ec-9842-1493c40c05a7",
"Condition": {
"Operator": "Equals",
"Operands": [
"WaitCompleted"
]
}
}
],
"Errors": [
{
"NextAction": "2f5e4e0e-ed68-4bec-8e7c-f28008d1b3c5",
"ErrorType": "NoMatchingError"
}
]
}
},
{
"Parameters": {
"LambdaFunctionARN": "----------------------",
"InvocationTimeLimitSeconds": "3",
"ResponseValidation": {
"ResponseType": "STRING_MAP"
}
},
"Identifier": "cce0d82c-dbe3-43ec-9842-1493c40c05a7",
"Type": "InvokeLambdaFunction",
"Transitions": {
"NextAction": "c884051f-4cb9-4317-96ef-c5eaec0a2c7b",
"Errors": [
{
"NextAction": "f7446253-f2a3-4d42-bc50-5b12bf210ac2",
"ErrorType": "NoMatchingError"
}
]
}
}
]
}
https://ibb.co/0R78qd54
Data streams as well as live media streaming (via video streams) have been enabled.
Most resources are outdated (GitHub repos are archived upon introduction of Contact Lens)
So far, the transcript doesn't come to the lambda, additionally I'm not exactly sure how to wait till the customer finishes speaking?
If this is not exactly possible, how could I go about it instead?
Any help would be very much appreciated :)